pgsql: Warning on SET of nonexisting setting with a prefix reserved by

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Warning on SET of nonexisting setting with a prefix reserved by
Date: 2021-12-01 14:22:32
Message-ID: E1msQVE-00067r-2e@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Warning on SET of nonexisting setting with a prefix reserved by an extension

An extension can already de facto reserve a GUC prefix using
EmitWarningsOnPlaceholders(). But this was only checked against
settings that exist at the time the extension is loaded (or the
extension chooses to call this). No diagnostic is given when a SET
command later uses a nonexisting setting with a custom prefix.

With this change, EmitWarningsOnPlaceholders() saves the prefixes it
reserves in a list, and SET checks when it finds a "placeholder"
setting whether it belongs to a reserved prefix and issues a warning
in that case.

Add a regression test that checks the patch using the "plpgsql"
registered prefix.

Author: Florin Irion <florin(dot)irion(at)enterprisedb(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/CA+HEvJDhWuuTpGTJT9Tgbdzm4QS4EzPAwDBScWK18H2Q=FVJFw(at)mail(dot)gmail(dot)com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/75d22069e00d638d08c04e3aba71688f3fb002ed

Modified Files
--------------
src/backend/utils/misc/guc.c | 47 +++++++++++++++++++++++++++++++++++++++
src/test/regress/expected/guc.out | 19 ++++++++++++++++
src/test/regress/sql/guc.sql | 11 +++++++++
3 files changed, 77 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2021-12-01 15:16:42 pgsql: Remove unused includes
Previous Message Robert Haas 2021-12-01 14:16:09 Re: pgsql: Update high level vacuumlazy.c comments.