Re: BUG #17635: The behavior of quote_ident differs from what the doc specifies - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17635: The behavior of quote_ident differs from what the doc specifies
Date
Msg-id 489744.1665517893@sss.pgh.pa.us
Whole thread Raw
In response to BUG #17635: The behavior of quote_ident differs from what the doc specifies  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
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



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17635: The behavior of quote_ident differs from what the doc specifies
Next
From: PG Bug reporting form
Date:
Subject: BUG #17636: terminating connection because of crash of another server process