postgres.git / summary / log / commit / refs
commit 3429145d42e0aee0565328c8ca8378ed17b300dc
Author: Tomas Vondra <tomas.vondra@postgresql.org>
Date: Mon Dec 16 17:12:29 2024 +0000
First released in: 18.0
psql: Tab completion for JOIN ... USING column list
For JOIN ... USING, offer attribute names for the first member of the
column list.
Author: Andreas Karlsson
Reviewed-By: Tomas Vondra
Discussion: https://postgr.es/m/3a7e27bc-d6ed-4cb0-9b21-f21143fc1b37@proxel.se
src/bin/psql/tab-complete.in.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index e9af7b37ac8..31c77214b4f 100644
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -5179,6 +5179,10 @@ match_previous_words(int pattern_id,
TailMatches("JOIN", MatchAny, MatchAny, "USING") ||
TailMatches("JOIN", "LATERAL", MatchAny, MatchAny, "USING"))
COMPLETE_WITH("(");
+ else if (TailMatches("JOIN", MatchAny, "USING", "("))
+ COMPLETE_WITH_ATTR(prev3_wd);
+ else if (TailMatches("JOIN", MatchAny, MatchAny, "USING", "("))
+ COMPLETE_WITH_ATTR(prev4_wd);
/* ... AT [ LOCAL | TIME ZONE ] ... */
else if (TailMatches("AT"))
[parent: a01f6fa6ad5e]