Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c81c956

Browse files
committed
Add tab-completion for psql meta-commands.
Based on the original code from David Christensen, modified by me.
1 parent 4af04f9 commit c81c956

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/bin/psql/tab-complete.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,16 @@ psql_completion(const char *text, int start, int end)
897897

898898
static const char *const backslash_commands[] = {
899899
"\\a", "\\connect", "\\conninfo", "\\C", "\\cd", "\\copy", "\\copyright",
900-
"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\dD", "\\des", "\\det", "\\deu", "\\dew", "\\df",
900+
"\\d", "\\da", "\\db", "\\dc", "\\dC", "\\dd", "\\ddp", "\\dD",
901+
"\\des", "\\det", "\\deu", "\\dew", "\\dE", "\\df",
901902
"\\dF", "\\dFd", "\\dFp", "\\dFt", "\\dg", "\\di", "\\dl", "\\dL",
902-
"\\dn", "\\do", "\\dp", "\\drds", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv", "\\du", "\\dx",
903+
"\\dm", "\\dn", "\\do", "\\dO", "\\dp", "\\drds", "\\ds", "\\dS",
904+
"\\dt", "\\dT", "\\dv", "\\du", "\\dx", "\\dy",
903905
"\\e", "\\echo", "\\ef", "\\encoding", "\\ev",
904906
"\\f", "\\g", "\\gset", "\\h", "\\help", "\\H", "\\i", "\\ir", "\\l",
905907
"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
906908
"\\o", "\\p", "\\password", "\\prompt", "\\pset", "\\q", "\\qecho", "\\r",
907-
"\\set", "\\sf", "\\sv", "\\t", "\\T",
909+
"\\s", "\\set", "\\setenv", "\\sf", "\\sv", "\\t", "\\T",
908910
"\\timing", "\\unset", "\\x", "\\w", "\\watch", "\\z", "\\!", NULL
909911
};
910912

@@ -3791,6 +3793,10 @@ psql_completion(const char *text, int start, int end)
37913793
COMPLETE_WITH_QUERY(Query_for_list_of_extensions);
37923794
else if (strncmp(prev_wd, "\\dm", strlen("\\dm")) == 0)
37933795
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_matviews, NULL);
3796+
else if (strncmp(prev_wd, "\\dE", strlen("\\dE")) == 0)
3797+
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_foreign_tables, NULL);
3798+
else if (strncmp(prev_wd, "\\dy", strlen("\\dy")) == 0)
3799+
COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers);
37943800

37953801
/* must be at end of \d list */
37963802
else if (strncmp(prev_wd, "\\d", strlen("\\d")) == 0)

0 commit comments

Comments
 (0)