agora inbox for pgsql-bugs@postgresql.org
help / color / mirror / Atom feedFrom: Paul Kim <mok03127@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Cc: vismay.t@gmail.com
Subject: Re: [PATCH v1] psql: schema-qualify catalog references in a tab-completion query
Date: Sun, 19 Jul 2026 23:58:57 +0900
Message-ID: <178447313788.14559.321633735335861831@mail.gmail.com> (raw)
In-Reply-To: <20260709122307.3052-1-vismay.t@gmail.com>
References: <19523-424457118202f570@postgresql.org>
<20260709122307.3052-1-vismay.t@gmail.com>
Hi Vismay,
cfbot didn't pick up this entry (CF #7027) because the v1 patch was posted
inline rather than as an attachment. I'm re-sending your v1 verbatim as a
.patch attachment so the CI can build it; authorship is unchanged (the
attached patch keeps your From:). It still applies cleanly to current
master.
Regards,
Paul
Attachments:
[text/x-patch] v1-0001-psql-schema-qualify-catalog-references-in-a-tab-c.patch (1.5K, ../178447313788.14559.321633735335861831@mail.gmail.com/2-v1-0001-psql-schema-qualify-catalog-references-in-a-tab-c.patch)
download | inline diff:
From eafe6a4ed821a3be92f04a3e523999c78c83b4b5 Mon Sep 17 00:00:00 2001
From: Vismay Tiwari <vismay.t@gmail.com>
Date: Thu, 9 Jul 2026 12:23:07 +0530
Subject: [PATCH v1] psql: schema-qualify catalog references in a
tab-completion query
The tab-completion query behind Query_for_list_of_database_vars referenced
pg_db_role_setting and pg_database without schema qualification. A table of
the same name earlier in the user's search_path therefore shadows the catalog
and feeds arbitrary values into the completion suggestions for
"ALTER DATABASE ... RESET". Qualify both with pg_catalog, matching the
qualification already applied to unnest()/split_part() in this same query and
to the catalogs in the analogous subscription-variable completion query.
---
src/bin/psql/tab-complete.in.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index 1cacc8c3ea2..90c6f1293b1 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -1040,8 +1040,8 @@ static const SchemaQuery Query_for_trigger_of_table = {
#define Query_for_list_of_database_vars \
"SELECT conf FROM ("\
" SELECT setdatabase, pg_catalog.split_part(pg_catalog.unnest(setconfig),'=',1) conf"\
-" FROM pg_db_role_setting "\
-" ) s, pg_database d "\
+" FROM pg_catalog.pg_db_role_setting "\
+" ) s, pg_catalog.pg_database d "\
" WHERE s.setdatabase = d.oid "\
" AND conf LIKE '%s'"\
" AND d.datname LIKE '%s'"
--
2.50.1 (Apple Git-155)
view thread (2+ messages)
Message-ID: <178447313788.14559.321633735335861831@mail.gmail.com>
Permalink: ../178447313788.14559.321633735335861831@mail.gmail.com/
Also on: postgresql.org/message-id/178447313788.14559.321633735335861831@mail.gmail.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: mok03127@gmail.com, pgsql-bugs@lists.postgresql.org, vismay.t@gmail.com
Subject: Re: [PATCH v1] psql: schema-qualify catalog references in a tab-completion query
In-Reply-To: <178447313788.14559.321633735335861831@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox