On Wed, Oct 5, 2022 at 5:17 PM Bryn Llewellyn <bryn@yugabyte.com> 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.