| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Peter Smith' <smithpb2250(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | RE: PSQL - improve tab completion for pub/sub options |
| Date: | 2026-07-28 06:46:53 |
| Message-ID: | OS9PR01MB121493EC5F804CBF8BC5E47F7F5CB2@OS9PR01MB12149.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-07-28 06:47:18 | Re: [PATCH] Harden two-phase GID handling and fork-number validation in WAL replay/decode paths |
| Previous Message | Jacob Brazeal | 2026-07-28 06:45:59 | lost lock during toasting allows fk violation |