Skip to content

Commit 7307df1

Browse files
committed
Improve tab completion of IMPORT FOREIGN SCHEMA in psql
It is not possible to get a list of foreign schemas as the server is not known, so this provides instead a list of local schemas, which is more useful than nothing if using a loopback server or having schema names matching in the local and remote servers. Author: Jeff Janes Reviewed-by: Tom Lane, Michael Paquier Discussion: https://postgr.es/m/CAMkU=1wr7Roj41q-XiJs=Uyc2xCmHhcGGy7J-peJQK-e+w=ghw@mail.gmail.com
1 parent babef40 commit 7307df1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/bin/psql/tab-complete.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3293,6 +3293,17 @@ psql_completion(const char *text, int start, int end)
32933293
COMPLETE_WITH("FOREIGN SCHEMA");
32943294
else if (Matches("IMPORT", "FOREIGN"))
32953295
COMPLETE_WITH("SCHEMA");
3296+
else if (Matches("IMPORT", "FOREIGN", "SCHEMA", MatchAny))
3297+
COMPLETE_WITH("EXCEPT (", "FROM SERVER", "LIMIT TO (");
3298+
else if (TailMatches("LIMIT", "TO", "(*)") ||
3299+
TailMatches("EXCEPT", "(*)"))
3300+
COMPLETE_WITH("FROM SERVER");
3301+
else if (TailMatches("FROM", "SERVER", MatchAny))
3302+
COMPLETE_WITH("INTO");
3303+
else if (TailMatches("FROM", "SERVER", MatchAny, "INTO"))
3304+
COMPLETE_WITH_QUERY(Query_for_list_of_schemas);
3305+
else if (TailMatches("FROM", "SERVER", MatchAny, "INTO", MatchAny))
3306+
COMPLETE_WITH("OPTIONS (");
32963307

32973308
/* INSERT --- can be inside EXPLAIN, RULE, etc */
32983309
/* Complete INSERT with "INTO" */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy