On Fri, Jul 22, 2022 at 03:00:23PM -0400, Tom Lane wrote:
> Justin Pryzby <pry...@telsasoft.com> writes:
> > On Fri, Jul 22, 2022 at 01:53:21PM -0400, Tom Lane wrote:
> >> This indicates that the warning is being issued in the wrong place.
> >> It's okay if it comes out during ALTER SYSTEM.  It's not okay if it
> >> comes out during server start; then it's just an annoyance.
> 
> > The previous patch version checked if (!IsUnderPostmaster()) before warning.
> > Is there a better way ?
> 
> > ALTER SYSTEM uses PGC_S_FILE, the same as during startup..
> 
> Shouldn't you be doing this when the source is PGC_S_TEST, instead?
> That's pretty much what it's for.  See check_default_table_access_method
> and other examples.

That makes sense, but it doesn't work for ALTER SYSTEM, which uses PGC_S_FILE.

postgres=# ALTER SYSTEM SET shared_preload_libraries =a;
2022-07-22 14:07:25.489 CDT client backend[23623] psql WARNING:  source 3
WARNING:  source 3
2022-07-22 14:07:25.489 CDT client backend[23623] psql WARNING:  could not 
access file "$libdir/plugins/a"
2022-07-22 14:07:25.489 CDT client backend[23623] psql DETAIL:  The server will 
currently fail to start with this setting.
2022-07-22 14:07:25.489 CDT client backend[23623] psql HINT:  If the server is 
shut down, it will be necessary to manually edit the postgresql.auto.conf file 
to allow it to start again.

postgres=# ALTER SYSTEM SET default_table_access_method=abc;
Breakpoint 1, check_default_table_access_method (newval=0x7ffe4c6fe820, 
extra=0x7ffe4c6fe828, source=PGC_S_FILE) at tableamapi.c:112

-- 
Justin


Reply via email to