Dear Peter,
> Here is a new thread/patch to improve the tab-completion of
> publication/subscription options.
Thanks for the proposal. Few comments:
01.
```
--- a/src/bin/psql/tab-complete.in.c
+++ b/src/bin/psql/tab-complete.in.c
@@ -2341,9 +2341,20 @@ match_previous_words(int pattern_id,
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
" AND nspname
NOT LIKE E'pg\\\\_%%'",
"CURRENT_SCHEMA");
- /* ALTER PUBLICATION <name> SET ( */
- else if (Matches("ALTER", "PUBLICATION", MatchAny, MatchAnyN, "SET",
"("))
- COMPLETE_WITH("publish", "publish_generated_columns",
"publish_via_partition_root");
+ /* ALTER PUBLICATION <name> SET ( <opt> */
+ else if (HeadMatches("ALTER", "PUBLICATION", MatchAny, "SET", "("))
+ {
+ if (ends_with(prev_wd, '(') || ends_with(prev_wd, ','))
```
According to others, the else-if statement should be slightly changed like:
```
else if (HeadMatches("ALTER", "PUBLICATION", MatchAny, "SET", "(*") &&
!HeadMatches("ALTER", "PUBLICATION", MatchAny, "SET", "(*)"))
```
02.
```
+ COMPLETE_WITH("publish", "publish_generated_columns =",
+ "publish_via_partition_root");
```
Let me confirm the policy here: the parameter "publish" won't be accepted alone,
but " =" is not completed for it. Is there a reason?
03.
```
COMPLETE_WITH("binary", "conflict_log_destination =",
+ "disable_on_error", "failover",
"max_retention_duration",
+ "origin =", "password_required",
"retain_dead_tuples",
+ "run_as_owner", "slot_name",
"streaming =",
+ "synchronous_commit =", "two_phase",
```
Same as 02. max_retention_duration and slot_name cannot be alone.
04.
While testing, I recognized that the word "PUBLICATION" cannot be suggested
if users input till below. Can you also fix?
```
postgres=# CREATE SUBSCRIPTION sub CONNECTION 'dbname=tmp'
```
Best regards,
Hayato Kuroda
FUJITSU LIMITED