PG Bug reporting form <noreply@postgresql.org> writes:
> The quote_ident doc here:
> https://www.postgresql.org/docs/11/functions-string.html#FUNCTIONS-STRING-OTHER
> says this:
> «
> Return the given string suitably quoted to be used as an identifier in an
> SQL statement string. Quotes are added only if necessary...
> »
> But tests show that the returned text is often double-quoted when this is
> NOT necessary.
As I said on the other thread, I think it's good from a future-proofing
standpoint that quote_ident is more conservative than strictly necessary.
One of the primary use-cases for it is preparing dumps that might get
loaded into future PG versions, or other RDBMSes altogether, that could
have different ideas of which characters are allowed in unquoted
identifiers. (Most obviously, we might stop lumping all non-ASCII
characters together.)
So I don't want to change the code. Perhaps we should remove "only"
from the quoted docs fragment, though.
regards, tom lane