Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 5, 2022 at 5:17 PM Bryn Llewellyn <bryn@xxxxxxxxxxxx> 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.
»
But it's incorrect w.r.t. "quotes are added only if necessary" for this to return FALSE:

select 'dog$' = quote_ident('dog$');

The documentation also says:

"Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable."


So I can see an argument for the existing behavior.  It doesn't seem worth changing in any case.  And I don't really see the documentation being improved by covering this corner case in detail when the current behavior is at least intuitive.
David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux