Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiLHv-0001Tu-6f for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2022 19:51:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oiLHt-0007Tr-W1 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2022 19:51:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiLHt-0007Th-Nv for pgsql-bugs@lists.postgresql.org; Tue, 11 Oct 2022 19:51:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oiLHr-0005IG-6e for pgsql-bugs@lists.postgresql.org; Tue, 11 Oct 2022 19:51:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 29BJpXjo489745; Tue, 11 Oct 2022 15:51:33 -0400 From: Tom Lane To: bryn@yugabyte.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17635: The behavior of quote_ident differs from what the doc specifies In-reply-to: <17635-bd4f9739f88ec6a9@postgresql.org> References: <17635-bd4f9739f88ec6a9@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 11 Oct 2022 18:28:51 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <489743.1665517893.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 11 Oct 2022 15:51:33 -0400 Message-ID: <489744.1665517893@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > The quote_ident doc here: > https://www.postgresql.org/docs/11/functions-string.html#FUNCTIONS-STRIN= G-OTHER > says this: > =C2=AB > Return the given string suitably quoted to be used as an identifier in a= n > SQL statement string. Quotes are added only if necessary... = > =C2=BB > But tests show that the returned text is often double-quoted when this i= s > 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