pgsql: Disallow setting bogus GUCs within an extension's reserved names - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Disallow setting bogus GUCs within an extension's reserved names
Date
Msg-id E1nME5V-0001at-UA@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Disallow setting bogus GUCs within an extension's reserved namespace.

Commit 75d22069e tried to throw a warning for setting a custom GUC whose
prefix belongs to a previously-loaded extension, if there is no such GUC
defined by the extension.  But that caused unstable behavior with
parallel workers, because workers don't necessarily load extensions and
GUCs in the same order their leader did.  To make that work safely, we
have to completely disallow the case.  We now actually remove any such
GUCs at the time of initial extension load, and then throw an error not
just a warning if you try to add one later.  While this might create a
compatibility issue for a few people, the improvement in error-detection
capability seems worth it; it's hard to believe that there's any good
use-case for choosing such GUC names.

This also un-reverts 5609cc01c (Rename EmitWarningsOnPlaceholders() to
MarkGUCPrefixReserved()), since that function's old name is now even
more of a misnomer.

Florin Irion and Tom Lane

Discussion: https://postgr.es/m/1902182.1640711215@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/88103567cb8fa5be46dc9fac3e3b8774951a2be7

Modified Files
--------------
contrib/auth_delay/auth_delay.c                    |  2 +-
contrib/auto_explain/auto_explain.c                |  2 +-
contrib/basic_archive/basic_archive.c              |  2 +-
contrib/pg_prewarm/autoprewarm.c                   |  2 +-
contrib/pg_stat_statements/pg_stat_statements.c    |  2 +-
contrib/pg_trgm/trgm_op.c                          |  2 +-
contrib/postgres_fdw/option.c                      |  2 +-
contrib/sepgsql/hooks.c                            |  2 +-
src/backend/utils/misc/guc.c                       | 79 ++++++++++++++++++----
src/include/utils/guc.h                            |  5 +-
src/pl/plperl/plperl.c                             |  2 +-
src/pl/plpgsql/src/pl_handler.c                    |  2 +-
src/pl/tcl/pltcl.c                                 |  4 +-
src/test/modules/delay_execution/delay_execution.c |  2 +-
.../ssl_passphrase_callback/ssl_passphrase_func.c  |  2 +-
src/test/modules/worker_spi/worker_spi.c           |  2 +-
src/test/regress/expected/guc.out                  | 11 +++
src/test/regress/sql/guc.sql                       |  7 ++
18 files changed, 101 insertions(+), 31 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Fix temporary object cleanup failing due to toast access without
Next
From: Michael Paquier
Date:
Subject: pgsql: Add compute_query_id = regress