From 43d6fcaab33121ddbb9261d5420b820c404a4a82 Mon Sep 17 00:00:00 2001 From: Miwa-Haruna Date: Thu, 1 Oct 2026 06:26:31 +0000 Subject: [PATCH] psql: avoid CREATE command completion after GRANT/REVOKE CREATE Prevent the generic CREATE command completion logic from being triggered when completing GRANT CREATE or REVOKE CREATE statements. --- src/bin/psql/tab-complete.in.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index 8e1a1d69740..c72dd9c2f0c 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -2185,7 +2185,9 @@ match_previous_words(int pattern_id, /* CREATE */ /* complete with something you can create */ - else if (TailMatches("CREATE")) + else if (TailMatches("CREATE") && + /* exclude cases of GRANT/REVOKE CREATE */ + !TailMatches("GRANT|REVOKE", "CREATE")) { /* only some object types can be created as part of CREATE SCHEMA */ if (HeadMatches("CREATE", "SCHEMA")) -- 2.47.3