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 <[email protected]>
Author: Vismay Tiwari <[email protected]>
Reviewed-by: Paul Kim <[email protected]>
Reviewed-by: Kirill Reshke <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Discussion: 
https://postgr.es/m/CALHMmB84qkCgv3QAR78YawgfqQZCxSPkRhppxzU=e6fg8ra...@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/043bc68b224e25578b1cc7e8ee7d54e0d03c762e

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

Reply via email to