Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7307df1

Browse filesBrowse 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
Copy full SHA for 7307df1

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed

‎src/bin/psql/tab-complete.c

Copy file name to clipboardExpand all lines: src/bin/psql/tab-complete.c
+11Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.