Re: warn if GUC set to an invalid shared library
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Maciek Sakrejda <m.sakrejda@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Justin Pryzby <justin@telsasoft.com>
Date: 2022-02-02T15:39:03Z
Lists: 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.