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.kla...@aklaver.com



Reply via email to