aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-04-01 13:15:49 -0400
committerRobert Haas <rhaas@postgresql.org>2011-04-01 13:15:49 -0400
commite49ad77ff958b380ea6fa08c72e2dce97ac56c6b (patch)
tree25c324039e006087816a8b638ec8926ebeab2c54 /src
parentdd095b623ec4b41e8c5728f9c576375985554fd3 (diff)
downloadpostgresql-e49ad77ff958b380ea6fa08c72e2dce97ac56c6b.tar.gz
postgresql-e49ad77ff958b380ea6fa08c72e2dce97ac56c6b.zip
Tab completion for COMMENT ON FOREIGN DATA WRAPPER / SERVER.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/tab-complete.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index e72c5b9e994..994c05373f0 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -714,7 +714,8 @@ psql_completion(char *text, int start, int end)
*prev2_wd,
*prev3_wd,
*prev4_wd,
- *prev5_wd;
+ *prev5_wd,
+ *prev6_wd;
static const char *const sql_commands[] = {
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -762,6 +763,7 @@ psql_completion(char *text, int start, int end)
prev3_wd = previous_word(start, 2);
prev4_wd = previous_word(start, 3);
prev5_wd = previous_word(start, 4);
+ prev6_wd = previous_word(start, 5);
/* If a backslash command was started, continue */
if (text[0] == '\\')
@@ -1547,13 +1549,23 @@ psql_completion(char *text, int start, int end)
pg_strcasecmp(prev_wd, "ON") == 0)
{
static const char *const list_COMMENT[] =
- {"CAST", "COLLATION", "CONVERSION", "DATABASE", "FOREIGN TABLE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
+ {"CAST", "COLLATION", "CONVERSION", "DATABASE", "FOREIGN DATA WRAPPER",
+ "SERVER", "FOREIGN TABLE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
"SEQUENCE", "TABLE", "TYPE", "VIEW", "COLUMN", "AGGREGATE", "FUNCTION",
"OPERATOR", "TRIGGER", "CONSTRAINT", "DOMAIN", "LARGE OBJECT",
"TABLESPACE", "TEXT SEARCH", "ROLE", NULL};
COMPLETE_WITH_LIST(list_COMMENT);
}
+ else if (pg_strcasecmp(prev3_wd, "COMMENT") == 0 &&
+ pg_strcasecmp(prev2_wd, "ON") == 0 &&
+ pg_strcasecmp(prev_wd, "FOREIGN") == 0)
+ {
+ static const char *const list_TRANS2[] =
+ {"DATA WRAPPER", "TABLE", NULL};
+
+ COMPLETE_WITH_LIST(list_TRANS2);
+ }
else if (pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
pg_strcasecmp(prev3_wd, "ON") == 0 &&
pg_strcasecmp(prev2_wd, "TEXT") == 0 &&
@@ -1566,6 +1578,8 @@ psql_completion(char *text, int start, int end)
}
else if ((pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
pg_strcasecmp(prev3_wd, "ON") == 0) ||
+ (pg_strcasecmp(prev6_wd, "COMMENT") == 0 &&
+ pg_strcasecmp(prev5_wd, "ON") == 0) ||
(pg_strcasecmp(prev5_wd, "ON") == 0 &&
pg_strcasecmp(prev4_wd, "TEXT") == 0 &&
pg_strcasecmp(prev3_wd, "SEARCH") == 0))