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: Maciek Sakrejda <maciek@pganalyze.com>
Cc: Andrei Klychkov <andrew.a.klychkov@gmail.com>, Jim Jones <jim.jones@uni-muenster.de>, Fujii Masao <masao.fujii@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-11-04T18:59:55Z
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.

Maciek Sakrejda <maciek@pganalyze.com> writes:
> On Tue, Nov 4, 2025 at 8:58 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> If you are feeling excited about that specific case, I think the
>> correct solution would be to install a GUC check_hook for
>> shared_preload_libraries (and probably its siblings too).

> For what it's worth, there was a patch that took a stab at this a
> while ago, but it ended up RWF:
> https://www.postgresql.org/message-id/flat/Z1kfMUoZkl9P0egB%40paquier.xyz#4a73293daf92aefbbdb43adc9688f082
> I was a reviewer and I still think something like that would be useful
> and prevent a lot of mistakes.

Hah, yeah, I thought that idea seemed familiar.

Re-reading that thread, it seems like a whole lot of the difficulties
arose precisely from not wanting to make the check_hook's complaints
be hard errors.  Maybe we should abandon the idea that we need to
permit setting the GUC to a value that we know will not work.  It was
argued that there were use-cases for that, but the argument seems
rather thin and not worth tying the behavior in knots for.

Another idea, considering our experience with search_path and
temp_tablespaces, is maybe it shouldn't be a hard error if the
GUC contains references to nonexistent libraries, only if the
syntax is bad.  As long as an empty-string item is bad syntax,
the check_hook could still prevent the problem we started this
thread with.

			regards, tom lane