pgsql: Reject "ALTER DATABASE/USER ... RESET foo" with invalid GUC name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Reject "ALTER DATABASE/USER ... RESET foo" with invalid GUC name
Date: 2025-09-12 22:10:16
Message-ID: E1uxByC-000PjF-0y@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Reject "ALTER DATABASE/USER ... RESET foo" with invalid GUC name.

If the database or user had no entry in pg_db_role_setting,
RESET silently did nothing --- including not checking the
validity of the given GUC name. This is quite inconsistent
and surprising, because you *would* get such an error if there
were any pg_db_role_setting entry, even though it contains
values for unrelated GUCs.

While this is clearly a bug, changing it in stable branches seems
unwise. The effect will be that some ALTER commands that formerly
were no-ops will now be errors, and people don't like that sort of
thing in minor releases.

Author: Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/30783e-68c28a00-9-41004480@130449754

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9a71989a8f61d7ee003c443a979a1bd43a08ff63

Modified Files
--------------
src/backend/catalog/pg_db_role_setting.c | 9 +++++++++
src/test/modules/unsafe_tests/expected/setconfig.out | 13 +++++++++++++
src/test/modules/unsafe_tests/sql/setconfig.sql | 9 +++++++++
3 files changed, 31 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-09-12 22:45:13 pgsql: Avoid context dependency in test case added by 9a71989a8.
Previous Message Tom Lane 2025-09-12 21:43:24 pgsql: Fix oversights in pg_event_trigger_dropped_objects() fixes.