]> granicus.if.org Git - postgresql/commitdiff
psql: Update tab completion for ALTER SUBSCRIPTION
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 9 Jun 2017 14:17:06 +0000 (10:17 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 9 Jun 2017 14:17:06 +0000 (10:17 -0400)
Author: Masahiko Sawada <sawada.mshk@gmail.com>

src/bin/psql/tab-complete.c

index d4b6976ad3bbeee7c21cb9bdbe4cb749674f6bf9..92cc8aa97a50bac76eefbee14f37dd74277c47b5 100644 (file)
@@ -1579,6 +1579,18 @@ psql_completion(const char *text, int start, int end)
        {
                /* complete with nothing here as this refers to remote publications */
        }
+       /* ALTER SUBSCRIPTION <name> SET PUBLICATION <name> */
+       else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) &&
+                        TailMatches3("SET", "PUBLICATION", MatchAny))
+       {
+               COMPLETE_WITH_CONST("WITH (");
+       }
+       /* ALTER SUBSCRIPTION <name> SET PUBLICATION <name> WITH ( */
+       else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) &&
+                        TailMatches5("SET", "PUBLICATION", MatchAny, "WITH", "("))
+       {
+               COMPLETE_WITH_LIST2("copy_data", "refresh");
+       }
        /* ALTER SCHEMA <name> */
        else if (Matches3("ALTER", "SCHEMA", MatchAny))
                COMPLETE_WITH_LIST2("OWNER TO", "RENAME TO");