Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE

Поиск
Список
Период
Сортировка
Искать
От
Adrian Klaver
Тема
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE
Дата
Msg-id
4fc877f4-14c1-9753-ff42-10c16baa4076@aklaver.com
Ответ на
Список
Дерево обсуждения
('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Adrian Klaver <adrian.klaver@aklaver.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
Aw: Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE "David G. Johnston" <david.g.johnston@gmail.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Tom Lane <tgl@sss.pgh.pa.us>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Gavan Schneider <list.pg.gavan@pendari.org>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE "David G. Johnston" <david.g.johnston@gmail.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Christophe Pettus <xof@thebuild.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Adrian Klaver <adrian.klaver@aklaver.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE "David G. Johnston" <david.g.johnston@gmail.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Christophe Pettus <xof@thebuild.com>
Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE Bryn Llewellyn <bryn@yugabyte.com>
On 10/5/22 17:16, Bryn Llewellyn wrote:
> The doc for "quote_ident()" says this:
> 
> «
> https://www.postgresql.org/docs/14/functions-string.html
> Returns the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled.
> »
> 
> B.t.w, the value of "quote_ident()" rests on the distinction between a name (what you provide with the function's actual argument) and an identifier (what it returns). Some of you flatly reject (borrowing a phrase from Tom) the distinction between these two terms of art. Oh well…

What it returns is text, quoted if needed:

create table "$dog"(n int);

select  pg_typeof(quote_ident('$dog')), quote_ident('$dog');
  pg_typeof | quote_ident
-----------+-------------
  text      | "$dog"

The way I see is if it where an actual identifier then this:

select * from quote_ident('$dog');
  quote_ident
-------------
  "$dog"

would be equal to this:

select * from "$dog";
  n
---



-- 
Adrian Klaver
adrian.klaver@aklaver.com



В списке pgsql-general по дате отправления
От: Tom Lane
Дата:
От: Christophe Pettus
Дата:
FAQ