Re: Redundant psql tab-completion for CREATE PUBLICATION

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Edmund Horner <ejrh00(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Redundant psql tab-completion for CREATE PUBLICATION
Date: 2018-09-21 20:01:19
Message-ID: 5858.1537560079@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[ This seems to have slipped through the cracks, sorry about that ]

Edmund Horner <ejrh00(at)gmail(dot)com> writes:
> While looking at Justin's patch for VACUUM completions, I found an
> existing bit of code that tries to match on a word with a space:
> /* Complete "CREATE PUBLICATION <name> FOR TABLE <table>" */
> else if (Matches4("CREATE", "PUBLICATION", MatchAny, "FOR TABLE"))
> COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);

> I think the clause will never match the "FOR TABLE" word;

Yeah, that's certainly right.

> and can, in
> any case, be removed, as the the final check for completable "things"
> (at the end of psql_completion) will see "TABLE" and act
> appropriately.

But that only works for the table name immediately after TABLE, not
for a list of table names. I think we need to fix it like this,
instead:

- /* Complete "CREATE PUBLICATION <name> FOR TABLE <table>" */
- else if (Matches4("CREATE", "PUBLICATION", MatchAny, "FOR TABLE"))
+ /* Complete "CREATE PUBLICATION <name> FOR TABLE <table>, ..." */
+ else if (HeadMatches5("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLE"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);

Pushed like that.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-09-21 20:20:42 Re: Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE
Previous Message Arthur Zakirov 2018-09-21 19:46:18 Re: [HACKERS] proposal: schema variables