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

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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: 2026-09-16 20:11:58
Message-ID: CAOYmi+=TomajOOr3OkshSMrNWERAc9fT1je_TEy6Z1UseNy-hA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 4, 2025 at 8:58 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> I wrote:
> > Andrei Klychkov <andrew(dot)a(dot)klychkov(at)gmail(dot)com> writes:
> >> 2. It doesn't look to me that v5 solves the original issue of a user
> >> running ALTER SYSTEM SET <setting like shared_preload_libraries> = ''; ,
> >> then restarting the server and not getting it back online.
>
> > [ shrug... ] It's not supposed to "solve" that. That command is
> > erroneous, and if you didn't test the setting before restarting the
> > server, you shouldn't be too surprised if restart fails.
>
> 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). It couldn't
> go so far as to actually dlopen() the list items, but it could check
> that each one resolves as an accessible file.

Independently of the file-check question, should we consider enforcing
that any GUC_LIST_QUOTE parameters without an explicit check_hook must
at least pass the SplitGUCList() parser?

Fujii-san pointed out in [1] that my output_plugin_libraries addition
doesn't have a check_hook, so a superuser can accidentally put bad
list syntax into postgresql.conf and then fail later rather than at
startup. I wouldn't want to backport stricter behavior for the old
GUCs, but I do want to fix that for the new one. And for PG20 onwards
that seems like a QoL improvement for all of them.

Thanks,
--Jacob

P.S. This overlaps a bit with f3eb76b399, because the comments added
there make it seem like we can't get into this situation, but we can:

=# CREATE FUNCTION add(integer, integer)
RETURNS integer AS 'select $1 + $2;'
LANGUAGE SQL;
CREATE FUNCTION
=# show session_preload_libraries;
session_preload_libraries
---------------------------
test_decoding,
(1 row)

=# ALTER FUNCTION add (integer, integer)
SET session_preload_libraries FROM CURRENT;
ALTER FUNCTION
=# select pg_get_functiondef('add'::regproc);
ERROR: invalid list syntax in proconfig item

[1] https://postgr.es/m/CAHGQGwG81iHN46mY_19Bne5RuKfAjH4dOnQ7-8i%3D7KYJk_0rAg%40mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrizio Mello 2026-09-16 20:13:21 Re: Fix failing assert in deferred constraint trigger
Previous Message Etsuro Fujita 2026-09-16 20:08:59 Re: postgres_fdw: transaction mode inheritance corner cases