Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uuDx0-0054m2-Tw for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Sep 2025 17:40:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uuDwz-0016JM-Vr for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Sep 2025 17:40:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uuDwz-0016JD-MB for pgsql-hackers@lists.postgresql.org; Thu, 04 Sep 2025 17:40:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uuDww-000Zag-0o for pgsql-hackers@lists.postgresql.org; Thu, 04 Sep 2025 17:40:45 +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 584Hed7B1046096; Thu, 4 Sep 2025 13:40:39 -0400 From: Tom Lane To: Fujii Masao cc: Andrei Klychkov , Jim Jones , pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters In-reply-to: References: <38091678-2820-4bc8-8df7-b417562f7860@uni-muenster.de> Comments: In-reply-to Fujii Masao message dated "Fri, 05 Sep 2025 01:42:06 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1046094.1757007639.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 04 Sep 2025 13:40:39 -0400 Message-ID: <1046095.1757007639@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fujii Masao writes: >>> Even with this patch, an empty string set via SET is still quoted. For= example: >>> = >>> =3D# SET local_preload_libraries TO ''; >>> SET >>> =3D# SHOW local_preload_libraries ; >>> local_preload_libraries >>> ------------------------- >>> "" >>> (1 row) >>> = >>> Is this behavior acceptable? I was thinking that an empty string shoul= d not >>> be quoted, regardless of whether it's set by ALTER SYSTEM SET or SET. > BTW, regarding the behavior change, I believe that users likely expect > the parameter to be reset when specifying an empty string, rather than > being set to "". So the proposed change seems reasonable. However, > the current behavior has existed for a long time, and I haven=E2=80=99t = seen > any complaints about it. I think this is largely based on confusion. In the above example, local_preload_libraries is being set to a list containing a single entry that is an empty string, and the output of SHOW is a fully accurate depiction of that state. It is *not* being set to an empty list --- we actually don't have any syntax that would permit doing so in SET. For comparison, there is a big difference between SET local_preload_libraries =3D a, b; SET local_preload_libraries =3D 'a, b'; In the latter case you get a single list entry containing the string "a, b". We do not try to parse that into multiple entries, and by the same token parsing an empty string into an empty list would be the Wrong Thing. We might want to start resolving this by inventing a syntax for setting a list GUC to an empty list. I'm not very sure what that should look like, except that it mustn't be SET ... TO ''. I'm not certain whether config-file parsing or ALTER SYSTEM would need any code changes once we resolve the ambiguity in SET. The config-file syntax is different and doesn't have this problem of not being able to represent an empty list. (Also, "let's unify the list-GUC syntax between config file and SET" seems like a non-starter. It'd be better no doubt if they hadn't diverged, but at this point we'd break far more than we fix if we change either one.) regards, tom lane