Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitd0f2f53

Browse files
committed
psql: Add tab completion for COPY with query
From: Andreas Karlsson <andreas@proxel.se>
1 parent422a55a commitd0f2f53

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,11 +1934,18 @@ psql_completion(const char *text, int start, int end)
19341934
/* COPY */
19351935

19361936
/*
1937-
* If we have COPY [BINARY] (which you'd have to type yourself), offer
1938-
*list of tables (Also cover the analogousbackslash command)
1937+
* If we have COPY, offer list of tables or "(" (Also cover the analogous
1938+
* backslash command).
19391939
*/
1940-
elseif (Matches1("COPY|\\copy")||Matches2("COPY","BINARY"))
1940+
elseif (Matches1("COPY|\\copy"))
1941+
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,
1942+
" UNION ALL SELECT '('");
1943+
/* If we have COPY BINARY, complete with list of tables */
1944+
elseif (Matches2("COPY","BINARY"))
19411945
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables,NULL);
1946+
/* If we have COPY (, complete it with legal commands */
1947+
elseif (Matches2("COPY|\\copy","("))
1948+
COMPLETE_WITH_LIST7("SELECT","TABLE","VALUES","INSERT","UPDATE","DELETE","WITH");
19421949
/* If we have COPY [BINARY] <sth>, complete it with "TO" or "FROM" */
19431950
elseif (Matches2("COPY|\\copy",MatchAny)||
19441951
Matches3("COPY","BINARY",MatchAny))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp