Re: warn if GUC set to an invalid shared library - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: warn if GUC set to an invalid shared library
Date
Msg-id CAKFQuwaRUiA2UOA7QvRaOnaWD1sbv3h3xB+W9KGSDkcsTpG3oA@mail.gmail.com
Whole thread Raw
In response to Re: warn if GUC set to an invalid shared library  (Maciek Sakrejda <m.sakrejda@gmail.com>)
Responses Re: warn if GUC set to an invalid shared library  (Maciek Sakrejda <m.sakrejda@gmail.com>)
List pgsql-hackers
On Tue, Feb 1, 2022 at 11:06 PM Maciek Sakrejda <m.sakrejda@gmail.com> wrote:
I tried running ALTER SYSTEM and got the warnings as expected:

postgres=# alter system set shared_preload_libraries = no_such_library,not_this_one_either;
WARNING:  could not access file "$libdir/plugins/no_such_library"
WARNING:  could not access file "$libdir/plugins/not_this_one_either"
ALTER SYSTEM

I think this is great, but it would be really helpful to also indicate that at this point the server will fail to come back up after a restart. In my mind, that's a big part of the reason for having a warning here. Having made this mistake a couple of times, I would be able to read between the lines, as would many other users, but if you're not familiar with Postgres this might still be pretty opaque.

+1

I would at least consider having the UX go something like:

postgres=# ALTER SYSTEM SET shared_preload_libraries = not_such_library;
ERROR: <paraphrase: your system will not reboot in its current state as that library is not present>.
HINT: to bypass the error please add FORCE before SET
postgres=# ALTER SYSTEM FORCE SET shared_preload_libraries = no_such_library;
NOTICE: Error suppressed while setting shared_preload_libraries.

That is, have the user express their desire to leave the system in a precarious state explicitly before actually doing so.

Upon startup, if the system already can track each separate location that shared_preload_libraries is set, printing out those locations and current values would be useful context.  Seeing ALTER SYSTEM in that listing would be helpful.

David J.

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: pg_receivewal - couple of improvements
Next
From: Daniel Gustafsson
Date:
Subject: Re: Ensure that STDERR is empty during connect_ok