From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Bryn Llewellyn <bryn(at)yugabyte(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE |
Date: | 2022-10-06 04:31:44 |
Message-ID: | 4fc877f4-14c1-9753-ff42-10c16baa4076@aklaver.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Christophe Pettus | 2022-10-06 04:51:54 | Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE |
Previous Message | Tom Lane | 2022-10-06 01:20:26 | Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE |