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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Andrei Klychkov <andrew(dot)a(dot)klychkov(at)gmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters
Date: 2025-09-04 18:24:48
Message-ID: 1056071.1757010288@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-09-04 18:41:01 Re: GetNamedLWLockTranche crashes on Windows in normal backend
Previous Message Sami Imseih 2025-09-04 18:23:26 Re: GetNamedLWLockTranche crashes on Windows in normal backend