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

Commit 95787e8

Browse files
committed
Tab-complete ALTER PUBLICATION ADD TABLE with list of tables
This has been posted as part of the column-list feature for logical replication since [1], but it's not really related to that. [1] https://postgr.es/m/202112131747.cmlstdewm4kh@alvherre.pgsql
1 parent 82331ed commit 95787e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bin/psql/tab-complete.c

+6
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,12 @@ psql_completion(const char *text, int start, int end)
16921692
/* ALTER PUBLICATION <name> ADD */
16931693
else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD"))
16941694
COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE");
1695+
else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") ||
1696+
(HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") &&
1697+
ends_with(prev_wd, ',')))
1698+
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
1699+
else if (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE"))
1700+
COMPLETE_WITH(",");
16951701
/* ALTER PUBLICATION <name> DROP */
16961702
else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP"))
16971703
COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE");

0 commit comments

Comments
 (0)