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

Commit e49ad77

Browse files
committed
Tab completion for COMMENT ON FOREIGN DATA WRAPPER / SERVER.
1 parent dd095b6 commit e49ad77

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/bin/psql/tab-complete.c

+16-2
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,8 @@ psql_completion(char *text, int start, int end)
714714
*prev2_wd,
715715
*prev3_wd,
716716
*prev4_wd,
717-
*prev5_wd;
717+
*prev5_wd,
718+
*prev6_wd;
718719

719720
static const char *const sql_commands[] = {
720721
"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER",
@@ -762,6 +763,7 @@ psql_completion(char *text, int start, int end)
762763
prev3_wd = previous_word(start, 2);
763764
prev4_wd = previous_word(start, 3);
764765
prev5_wd = previous_word(start, 4);
766+
prev6_wd = previous_word(start, 5);
765767

766768
/* If a backslash command was started, continue */
767769
if (text[0] == '\\')
@@ -1547,13 +1549,23 @@ psql_completion(char *text, int start, int end)
15471549
pg_strcasecmp(prev_wd, "ON") == 0)
15481550
{
15491551
static const char *const list_COMMENT[] =
1550-
{"CAST", "COLLATION", "CONVERSION", "DATABASE", "FOREIGN TABLE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
1552+
{"CAST", "COLLATION", "CONVERSION", "DATABASE", "FOREIGN DATA WRAPPER",
1553+
"SERVER", "FOREIGN TABLE", "INDEX", "LANGUAGE", "RULE", "SCHEMA",
15511554
"SEQUENCE", "TABLE", "TYPE", "VIEW", "COLUMN", "AGGREGATE", "FUNCTION",
15521555
"OPERATOR", "TRIGGER", "CONSTRAINT", "DOMAIN", "LARGE OBJECT",
15531556
"TABLESPACE", "TEXT SEARCH", "ROLE", NULL};
15541557

15551558
COMPLETE_WITH_LIST(list_COMMENT);
15561559
}
1560+
else if (pg_strcasecmp(prev3_wd, "COMMENT") == 0 &&
1561+
pg_strcasecmp(prev2_wd, "ON") == 0 &&
1562+
pg_strcasecmp(prev_wd, "FOREIGN") == 0)
1563+
{
1564+
static const char *const list_TRANS2[] =
1565+
{"DATA WRAPPER", "TABLE", NULL};
1566+
1567+
COMPLETE_WITH_LIST(list_TRANS2);
1568+
}
15571569
else if (pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
15581570
pg_strcasecmp(prev3_wd, "ON") == 0 &&
15591571
pg_strcasecmp(prev2_wd, "TEXT") == 0 &&
@@ -1566,6 +1578,8 @@ psql_completion(char *text, int start, int end)
15661578
}
15671579
else if ((pg_strcasecmp(prev4_wd, "COMMENT") == 0 &&
15681580
pg_strcasecmp(prev3_wd, "ON") == 0) ||
1581+
(pg_strcasecmp(prev6_wd, "COMMENT") == 0 &&
1582+
pg_strcasecmp(prev5_wd, "ON") == 0) ||
15691583
(pg_strcasecmp(prev5_wd, "ON") == 0 &&
15701584
pg_strcasecmp(prev4_wd, "TEXT") == 0 &&
15711585
pg_strcasecmp(prev3_wd, "SEARCH") == 0))

0 commit comments

Comments
 (0)