diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-01-28 17:08:40 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-01-28 17:08:40 -0300 |
commit | 95787e849b9c3cb047751400c8bc49a8bf0f4133 (patch) | |
tree | ae17618749815e69796d1ff4928276059702c229 | |
parent | 82331ed4dd60ce1f8db67e189f793f27cd1aac96 (diff) | |
download | postgresql-95787e849b9c3cb047751400c8bc49a8bf0f4133.tar.gz postgresql-95787e849b9c3cb047751400c8bc49a8bf0f4133.zip |
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
-rw-r--r-- | src/bin/psql/tab-complete.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 4c62e7b1b41..e09221d63db 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1692,6 +1692,12 @@ psql_completion(const char *text, int start, int end) /* ALTER PUBLICATION <name> ADD */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD")) COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); + else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") || + (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") && + ends_with(prev_wd, ','))) + COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL); + else if (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE")) + COMPLETE_WITH(","); /* ALTER PUBLICATION <name> DROP */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP")) COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); |