mirror of
https://github.com/postgres/postgres.git
synced 2025-05-31 03:21:24 +03:00
psql: Tab completion for JOIN ... ON/USING
Offer ON/USING clauses for join types that require join conditions (i.e. anything except for NATURAL/CROSS joins). Author: Andreas Karlsson Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/3a7e27bc-d6ed-4cb0-9b21-f21143fc1b37@proxel.se
This commit is contained in:
parent
5dd5786b94
commit
a01f6fa6ad
@ -5167,6 +5167,18 @@ match_previous_words(int pattern_id,
|
||||
/* ... JOIN ... */
|
||||
else if (TailMatches("JOIN"))
|
||||
COMPLETE_WITH_SCHEMA_QUERY_PLUS(Query_for_list_of_selectables, "LATERAL");
|
||||
else if (TailMatches("JOIN", MatchAny) && !TailMatches("CROSS|NATURAL", "JOIN", MatchAny))
|
||||
COMPLETE_WITH("ON", "USING (");
|
||||
else if (TailMatches("JOIN", MatchAny, MatchAny) &&
|
||||
!TailMatches("CROSS|NATURAL", "JOIN", MatchAny, MatchAny) && !TailMatches("ON|USING"))
|
||||
COMPLETE_WITH("ON", "USING (");
|
||||
else if (TailMatches("JOIN", "LATERAL", MatchAny, MatchAny) &&
|
||||
!TailMatches("CROSS|NATURAL", "JOIN", "LATERAL", MatchAny, MatchAny) && !TailMatches("ON|USING"))
|
||||
COMPLETE_WITH("ON", "USING (");
|
||||
else if (TailMatches("JOIN", MatchAny, "USING") ||
|
||||
TailMatches("JOIN", MatchAny, MatchAny, "USING") ||
|
||||
TailMatches("JOIN", "LATERAL", MatchAny, MatchAny, "USING"))
|
||||
COMPLETE_WITH("(");
|
||||
|
||||
/* ... AT [ LOCAL | TIME ZONE ] ... */
|
||||
else if (TailMatches("AT"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user