pgsql: psql: Schema-qualify catalogs in ALTER DATABASE RESET completion

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: psql: Schema-qualify catalogs in ALTER DATABASE RESET completion
Date: 2026-09-11 09:17:16
Message-ID: E1x4xNj-00000004Pkr-0ES3@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

psql: Schema-qualify catalogs in ALTER DATABASE RESET completion

The tab-completion query used for ALTER DATABASE ... RESET referenced
pg_db_role_setting and pg_database without schema qualification, so a
same-named relation earlier in search_path could be used instead of the
system catalogs. This could make psql offer misleading RESET candidates.

Commit dbf5a83d465 schema-qualified the unnest() call in this same query,
but the catalog references were still left unqualified. Fix that by
referring to pg_catalog.pg_db_role_setting and pg_catalog.pg_database
explicitly.

Backpatch to 18, where the tab-completion for ALTER DATABASE ... RESET
was introduced.

Bug: #19523
Reported-by: Zhou Digoal <digoal(at)126(dot)com>
Author: Vismay Tiwari <vismay(dot)t(at)gmail(dot)com>
Reviewed-by: Paul Kim <mok03127(at)gmail(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/19523-424457118202f570@postgresql.org
Discussion: https://postgr.es/m/CALHMmB84qkCgv3QAR78YawgfqQZCxSPkRhppxzU=e6fg8RA+AA@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/db5d375d9ab2f83d29789eabef6720e1d4446667

Modified Files
--------------
src/bin/psql/tab-complete.in.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2026-09-11 09:57:15 pgsql: Fix crash on UPDATE or DELETE of a partition pending detach.
Previous Message Fujii Masao 2026-09-11 09:17:05 pgsql: psql: Schema-qualify catalogs in ALTER DATABASE RESET completion