public inbox for [email protected]help / color / mirror / Atom feed
Add tab completion for SERVER and CONNECTION keywords in psql 4+ messages / 2 participants [nested] [flat]
* Add tab completion for SERVER and CONNECTION keywords in psql @ 2026-03-22 20:30 Yamaguchi Atsuo <[email protected]> 2026-03-23 20:14 ` Re: Add tab completion for SERVER and CONNECTION keywords in psql Masahiko Sawada <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Yamaguchi Atsuo @ 2026-03-22 20:30 UTC (permalink / raw) To: [email protected] Hi, This patch adds missing tab completion support in psql for: - SERVER keyword after ALTER/CREATE SUBSCRIPTION <name> - CONNECTION keyword after ALTER/CREATE FOREIGN DATA WRAPPER <name> Currently, typing "ALTER SUBSCRIPTION sub1 SERVER" and pressing Tab does not complete server names, even though the SERVER keyword itself is already suggested. Similarly, CONNECTION is not suggested as a completion candidate for FOREIGN DATA WRAPPER commands, despite being a valid option. The patch is generated against the current master branch. Regards, Atsuo Yamaguchi Attachments: [application/octet-stream] 0001-Add-tab-completion-for-SERVER-and-CONNECTION-keyword.patch (2.7K, 3-0001-Add-tab-completion-for-SERVER-and-CONNECTION-keyword.patch) download | inline diff: From 544767dd4afddebcf053332373b1f0cd15a3acdf Mon Sep 17 00:00:00 2001 From: "Atsuo (Jorge) Yamaguchi" <[email protected]> Date: Sun, 22 Mar 2026 20:14:55 +0000 Subject: [PATCH] Add tab completion for SERVER and CONNECTION keywords in psql The SERVER keyword in ALTER/CREATE SUBSCRIPTION and the CONNECTION keyword in ALTER/CREATE FOREIGN DATA WRAPPER were missing from psql's tab completion support. This patch adds them. --- src/bin/psql/tab-complete.in.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index 5bdbf1530a2..74dc1c987cf 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -2342,6 +2342,8 @@ match_previous_words(int pattern_id, COMPLETE_WITH("CONNECTION", "ENABLE", "DISABLE", "OWNER TO", "RENAME TO", "REFRESH PUBLICATION", "REFRESH SEQUENCES", "SERVER", "SET", "SKIP (", "ADD PUBLICATION", "DROP PUBLICATION"); + else if (Matches("ALTER", "SUBSCRIPTION", MatchAny, "SERVER")) + COMPLETE_WITH_QUERY(Query_for_list_of_servers); /* ALTER SUBSCRIPTION <name> REFRESH */ else if (Matches("ALTER", "SUBSCRIPTION", MatchAny, MatchAnyN, "REFRESH")) COMPLETE_WITH("PUBLICATION", "SEQUENCES"); @@ -2459,9 +2461,9 @@ match_previous_words(int pattern_id, /* ALTER FOREIGN DATA WRAPPER <name> */ else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny)) COMPLETE_WITH("HANDLER", "VALIDATOR", "NO", - "OPTIONS", "OWNER TO", "RENAME TO"); + "OPTIONS", "OWNER TO", "RENAME TO", "CONNECTION"); else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny, "NO")) - COMPLETE_WITH("HANDLER", "VALIDATOR"); + COMPLETE_WITH("HANDLER", "VALIDATOR", "CONNECTION"); /* ALTER FOREIGN TABLE <name> */ else if (Matches("ALTER", "FOREIGN", "TABLE", MatchAny)) @@ -3548,7 +3550,7 @@ match_previous_words(int pattern_id, /* CREATE FOREIGN DATA WRAPPER */ else if (Matches("CREATE", "FOREIGN", "DATA", "WRAPPER", MatchAny)) - COMPLETE_WITH("HANDLER", "VALIDATOR", "OPTIONS"); + COMPLETE_WITH("HANDLER", "VALIDATOR", "OPTIONS", "CONNECTION"); /* CREATE FOREIGN TABLE */ else if (Matches("CREATE", "FOREIGN", "TABLE", MatchAny)) @@ -3915,6 +3917,8 @@ match_previous_words(int pattern_id, /* CREATE SUBSCRIPTION */ else if (Matches("CREATE", "SUBSCRIPTION", MatchAny)) COMPLETE_WITH("SERVER", "CONNECTION"); + else if (Matches("CREATE", "SUBSCRIPTION", MatchAny, "SERVER")) + COMPLETE_WITH_QUERY(Query_for_list_of_servers); else if (Matches("CREATE", "SUBSCRIPTION", MatchAny, "SERVER", MatchAny)) COMPLETE_WITH("PUBLICATION"); else if (Matches("CREATE", "SUBSCRIPTION", MatchAny, "CONNECTION", MatchAny)) -- 2.47.3 ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Add tab completion for SERVER and CONNECTION keywords in psql 2026-03-22 20:30 Add tab completion for SERVER and CONNECTION keywords in psql Yamaguchi Atsuo <[email protected]> @ 2026-03-23 20:14 ` Masahiko Sawada <[email protected]> 2026-03-25 15:43 ` Re: Add tab completion for SERVER and CONNECTION keywords in psql Yamaguchi Atsuo <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Masahiko Sawada @ 2026-03-23 20:14 UTC (permalink / raw) To: Yamaguchi Atsuo <[email protected]>; +Cc: [email protected] Hi, On Sun, Mar 22, 2026 at 1:30 PM Yamaguchi Atsuo <[email protected]> wrote: > > Hi, > > This patch adds missing tab completion support in psql for: > > - SERVER keyword after ALTER/CREATE SUBSCRIPTION <name> > - CONNECTION keyword after ALTER/CREATE FOREIGN DATA WRAPPER <name> > > Currently, typing "ALTER SUBSCRIPTION sub1 SERVER" and pressing Tab > does not complete server names, even though the SERVER keyword itself > is already suggested. Similarly, CONNECTION is not suggested as a > completion candidate for FOREIGN DATA WRAPPER commands, despite being > a valid option. > > The patch is generated against the current master branch. It's a fix for an oversight of commit 8185bb5347 rather than proposing a new tab-completion. Good catch. Regarding the patch, I have one comment: /* ALTER FOREIGN DATA WRAPPER <name> */ else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny)) COMPLETE_WITH("HANDLER", "VALIDATOR", "NO", - "OPTIONS", "OWNER TO", "RENAME TO"); + "OPTIONS", "OWNER TO", "RENAME TO", "CONNECTION"); I think it's better to maintain the keywords in the list in alphabetical order. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Add tab completion for SERVER and CONNECTION keywords in psql 2026-03-22 20:30 Add tab completion for SERVER and CONNECTION keywords in psql Yamaguchi Atsuo <[email protected]> 2026-03-23 20:14 ` Re: Add tab completion for SERVER and CONNECTION keywords in psql Masahiko Sawada <[email protected]> @ 2026-03-25 15:43 ` Yamaguchi Atsuo <[email protected]> 2026-03-25 16:33 ` Re: Add tab completion for SERVER and CONNECTION keywords in psql Masahiko Sawada <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Yamaguchi Atsuo @ 2026-03-25 15:43 UTC (permalink / raw) To: Masahiko Sawada <[email protected]>; +Cc: [email protected] Hi, On Mon, Mar 23, 2026 at 1:14 PM Masahiko Sawada <[email protected]> wrote: > Hi, > > On Sun, Mar 22, 2026 at 1:30 PM Yamaguchi Atsuo <[email protected]> > wrote: > > > > Hi, > > > > This patch adds missing tab completion support in psql for: > > > > - SERVER keyword after ALTER/CREATE SUBSCRIPTION <name> > > - CONNECTION keyword after ALTER/CREATE FOREIGN DATA WRAPPER <name> > > > > Currently, typing "ALTER SUBSCRIPTION sub1 SERVER" and pressing Tab > > does not complete server names, even though the SERVER keyword itself > > is already suggested. Similarly, CONNECTION is not suggested as a > > completion candidate for FOREIGN DATA WRAPPER commands, despite being > > a valid option. > > > > The patch is generated against the current master branch. > > It's a fix for an oversight of commit 8185bb5347 rather than proposing > a new tab-completion. Good catch. Regarding the patch, I have one > comment: > > /* ALTER FOREIGN DATA WRAPPER <name> */ > else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny)) > COMPLETE_WITH("HANDLER", "VALIDATOR", "NO", > - "OPTIONS", "OWNER TO", "RENAME TO"); > + "OPTIONS", "OWNER TO", "RENAME TO", "CONNECTION"); > > I think it's better to maintain the keywords in the list in alphabetical > order. > > Regards, > > -- > Masahiko Sawada > Amazon Web Services: https://aws.amazon.com Thank you for the review. I have updated the code to maintain the keywords in alphabetical order. Regards, Atsuo Yamaguchi Attachments: [application/octet-stream] 0001-Add-tab-completion-for-SERVER-and-CONNECTION-keyword.patch (2.8K, 3-0001-Add-tab-completion-for-SERVER-and-CONNECTION-keyword.patch) download | inline diff: From d882f806971f0feaa713803ded7f814d933628b3 Mon Sep 17 00:00:00 2001 From: "Atsuo (Jorge) Yamaguchi" <[email protected]> Date: Wed, 25 Mar 2026 05:30:11 +0000 Subject: [PATCH] Add tab completion for SERVER and CONNECTION keywords in psql The SERVER keyword in ALTER/CREATE SUBSCRIPTION and the CONNECTION keyword in ALTER/CREATE FOREIGN DATA WRAPPER were missing from psql's tab completion support. This patch adds them. --- src/bin/psql/tab-complete.in.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index 5bdbf1530a2..28aeb524baf 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -2342,6 +2342,8 @@ match_previous_words(int pattern_id, COMPLETE_WITH("CONNECTION", "ENABLE", "DISABLE", "OWNER TO", "RENAME TO", "REFRESH PUBLICATION", "REFRESH SEQUENCES", "SERVER", "SET", "SKIP (", "ADD PUBLICATION", "DROP PUBLICATION"); + else if (Matches("ALTER", "SUBSCRIPTION", MatchAny, "SERVER")) + COMPLETE_WITH_QUERY(Query_for_list_of_servers); /* ALTER SUBSCRIPTION <name> REFRESH */ else if (Matches("ALTER", "SUBSCRIPTION", MatchAny, MatchAnyN, "REFRESH")) COMPLETE_WITH("PUBLICATION", "SEQUENCES"); @@ -2458,10 +2460,10 @@ match_previous_words(int pattern_id, /* ALTER FOREIGN DATA WRAPPER <name> */ else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny)) - COMPLETE_WITH("HANDLER", "VALIDATOR", "NO", - "OPTIONS", "OWNER TO", "RENAME TO"); + COMPLETE_WITH("CONNECTION", "HANDLER", "NO", + "OPTIONS", "OWNER TO", "RENAME TO", "VALIDATOR"); else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny, "NO")) - COMPLETE_WITH("HANDLER", "VALIDATOR"); + COMPLETE_WITH("CONNECTION", "HANDLER", "VALIDATOR"); /* ALTER FOREIGN TABLE <name> */ else if (Matches("ALTER", "FOREIGN", "TABLE", MatchAny)) @@ -3548,7 +3550,7 @@ match_previous_words(int pattern_id, /* CREATE FOREIGN DATA WRAPPER */ else if (Matches("CREATE", "FOREIGN", "DATA", "WRAPPER", MatchAny)) - COMPLETE_WITH("HANDLER", "VALIDATOR", "OPTIONS"); + COMPLETE_WITH("CONNECTION", "HANDLER", "OPTIONS", "VALIDATOR"); /* CREATE FOREIGN TABLE */ else if (Matches("CREATE", "FOREIGN", "TABLE", MatchAny)) @@ -3914,7 +3916,9 @@ match_previous_words(int pattern_id, /* CREATE SUBSCRIPTION */ else if (Matches("CREATE", "SUBSCRIPTION", MatchAny)) - COMPLETE_WITH("SERVER", "CONNECTION"); + COMPLETE_WITH("CONNECTION", "SERVER"); + else if (Matches("CREATE", "SUBSCRIPTION", MatchAny, "SERVER")) + COMPLETE_WITH_QUERY(Query_for_list_of_servers); else if (Matches("CREATE", "SUBSCRIPTION", MatchAny, "SERVER", MatchAny)) COMPLETE_WITH("PUBLICATION"); else if (Matches("CREATE", "SUBSCRIPTION", MatchAny, "CONNECTION", MatchAny)) -- 2.47.3 ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Add tab completion for SERVER and CONNECTION keywords in psql 2026-03-22 20:30 Add tab completion for SERVER and CONNECTION keywords in psql Yamaguchi Atsuo <[email protected]> 2026-03-23 20:14 ` Re: Add tab completion for SERVER and CONNECTION keywords in psql Masahiko Sawada <[email protected]> 2026-03-25 15:43 ` Re: Add tab completion for SERVER and CONNECTION keywords in psql Yamaguchi Atsuo <[email protected]> @ 2026-03-25 16:33 ` Masahiko Sawada <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Masahiko Sawada @ 2026-03-25 16:33 UTC (permalink / raw) To: Yamaguchi Atsuo <[email protected]>; +Cc: [email protected] On Wed, Mar 25, 2026 at 8:44 AM Yamaguchi Atsuo <[email protected]> wrote: > > Hi, > > On Mon, Mar 23, 2026 at 1:14 PM Masahiko Sawada <[email protected]> wrote: >> >> Hi, >> >> On Sun, Mar 22, 2026 at 1:30 PM Yamaguchi Atsuo <[email protected]> wrote: >> > >> > Hi, >> > >> > This patch adds missing tab completion support in psql for: >> > >> > - SERVER keyword after ALTER/CREATE SUBSCRIPTION <name> >> > - CONNECTION keyword after ALTER/CREATE FOREIGN DATA WRAPPER <name> >> > >> > Currently, typing "ALTER SUBSCRIPTION sub1 SERVER" and pressing Tab >> > does not complete server names, even though the SERVER keyword itself >> > is already suggested. Similarly, CONNECTION is not suggested as a >> > completion candidate for FOREIGN DATA WRAPPER commands, despite being >> > a valid option. >> > >> > The patch is generated against the current master branch. >> >> It's a fix for an oversight of commit 8185bb5347 rather than proposing >> a new tab-completion. Good catch. Regarding the patch, I have one >> comment: >> >> /* ALTER FOREIGN DATA WRAPPER <name> */ >> else if (Matches("ALTER", "FOREIGN", "DATA", "WRAPPER", MatchAny)) >> COMPLETE_WITH("HANDLER", "VALIDATOR", "NO", >> - "OPTIONS", "OWNER TO", "RENAME TO"); >> + "OPTIONS", "OWNER TO", "RENAME TO", "CONNECTION"); >> >> I think it's better to maintain the keywords in the list in alphabetical order. >> >> Regards, >> >> -- >> Masahiko Sawada >> Amazon Web Services: https://aws.amazon.com > > > Thank you for the review. I have updated the code to maintain the keywords in alphabetical order. Thank you for updating the patch! Pushed. Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-03-25 16:33 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-03-22 20:30 Add tab completion for SERVER and CONNECTION keywords in psql Yamaguchi Atsuo <[email protected]> 2026-03-23 20:14 ` Masahiko Sawada <[email protected]> 2026-03-25 15:43 ` Yamaguchi Atsuo <[email protected]> 2026-03-25 16:33 ` Masahiko Sawada <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox