summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2024-12-16 17:12:29 +0000
committerTomas Vondra2024-12-16 17:47:03 +0000
commit3429145d42e0aee0565328c8ca8378ed17b300dc (patch)
tree0b81c81ed44ca72e7ecf6c1756d0efad7ffa2c42
parenta01f6fa6ad5e232e1bd38c05d443875ae3ba7ee8 (diff)
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/[email protected]
-rw-r--r--src/bin/psql/tab-complete.in.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c
index e9af7b37ac..31c77214b4 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"))