Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Andrei Klychkov <andrew.a.klychkov@gmail.com>, Jim Jones <jim.jones@uni-muenster.de>, pgsql-hackers@lists.postgresql.org
Date: 2025-09-04T18:24:48Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Allow "SET list_guc TO NULL" to specify setting the GUC to empty.

I wrote:
> 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 experimented with the idea of allowing

	SET var TO ;

and got a bunch of shift-reduce conflicts from bison, which don't
look easy to avoid.  It's probably a bit too surprising anyway.

This works from a grammar standpoint:

	SET var TO NULL;

Because NULL is fully reserved, this isn't usurping any cases that
weren't syntax errors before.  It might still be too surprising.

Another idea is that we could redefine a single '' as meaning an empty
list if we were to forbid empty strings as members of GUC_LIST_QUOTE
variables.  This doesn't look like it'd be a big issue for the current
set of such variables:

local_preload_libraries
search_path
session_preload_libraries
shared_preload_libraries
temp_tablespaces
unix_socket_directories

We might break some applications that're relying on the current
behavior that an empty item would be effectively ignored.
But that seems a bit remote, and anyway they could just switch
to some other nonexistent name.

Actually, looking at the small number of GUCs that are marked
GUC_LIST_INPUT but not GUC_LIST_QUOTE, I wonder if we shouldn't
prohibit empty strings across-the-board for GUC_LIST_INPUT GUCs.
I don't see any where it'd be useful to allow them.  Then we
could allow '' to mean empty list for all of them.

			regards, tom lane