]> granicus.if.org Git - postgresql/commitdiff
Tab completion for COMMENT ON FOREIGN DATA WRAPPER / SERVER.
authorRobert Haas <rhaas@postgresql.org>
Fri, 1 Apr 2011 17:15:49 +0000 (13:15 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 1 Apr 2011 17:15:49 +0000 (13:15 -0400)
src/bin/psql/tab-complete.c

index e72c5b9e994e2cb233c8d7166aaee7d827d28f0c..994c05373f0aa5b8863a8a94f1736470566b75b7 100644 (file)
@@ -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))