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: Andrei Klychkov <andrew(dot)a(dot)klychkov(at)gmail(dot)com>
Cc: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters
Date: 2025-11-04 16:58:00
Message-ID: 541349.1762275480@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

A potential objection is that this could result in unwanted failures
in some scenarios, say where you're restoring a dump and haven't
yet installed all the relevant extensions. I'm not quite sure if
there are realistic scenarios where that's actually a problem.
If it is, perhaps we could adjust the check_hook so it issues
WARNINGs not hard errors.

I'm not sure it's worth the trouble though. A quick look at dfmgr.c
suggests that it'd take quite a lot of refactoring (or else code
duplication, not good) to be able to apply the library lookup process
without actually doing dlopen. In any case that would be a totally
different patch from what we are discussing here.

> Anyway, the attached v6 is the same as v5, except now with proposed
> doc changes and a draft commit message. I spent some effort on
> getting the ALTER SYSTEM and SET ref pages back into sync; it seemed
> like more care has been taken with the ALTER SYSTEM synopsis and
> other details.

Hearing no further comments, I'm going to go ahead with v6.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2025-11-04 17:12:27 Re: foreign key on virtual generated column
Previous Message Andrew Dunstan 2025-11-04 16:55:28 Re: Non-text mode for pg_dumpall