Re: Bug fix for tab completion of ALTER TABLE ... VALIDATE CONSTRAINT ...

From: David Fetter <david(at)fetter(dot)org>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug fix for tab completion of ALTER TABLE ... VALIDATE CONSTRAINT ...
Date: 2021-09-15 06:06:04
Message-ID: 20210915060604.GG18391@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 03, 2021 at 08:27:55PM +0200, Daniel Gustafsson wrote:
> > On 19 May 2021, at 09:53, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >
> > On Tue, Apr 27, 2021 at 12:58:52PM +0300, Aleksander Alekseev wrote:
> >> I've noticed there is no tab completion for ALTER TABLE xxx ADD. Here
> >> is an alternative version of the patch that fixes this as well. Not
> >> sure if this should be in the same commit though.
> >
> > - /* If we have ALTER TABLE <sth> DROP, provide COLUMN or CONSTRAINT */
> > - else if (Matches("ALTER", "TABLE", MatchAny, "DROP"))
> > + /* If we have ALTER TABLE <sth> ADD|DROP, provide COLUMN or CONSTRAINT */
> > + else if (Matches("ALTER", "TABLE", MatchAny, "ADD|DROP"))
> > Seems to me that the behavior to not complete with COLUMN or
> > CONSTRAINT for ADD is intentional, as it is possible to specify a
> > constraint or column name without the object type first. This
> > introduces a inconsistent behavior with what we do for columns with
> > ADD, for one. So a more consistent approach would be to list columns,
> > constraints, COLUMN and CONSTRAINT in the list of options available
> > after ADD.
> >
> > + else if (Matches("ALTER", "TABLE", MatchAny, "VALIDATE", "CONSTRAINT"))
> > + {
> > + completion_info_charp = prev3_wd;
> > + COMPLETE_WITH_QUERY(Query_for_nonvalid_constraint_of_table);
> > + }
> > Specifying valid constraints is an authorized grammar, so it does not
> > seem that bad to keep things as they are, either. I would leave that
> > alone.
>
> This has stalled being marked Waiting on Author since May, and reading the
> above it sounds like marking it Returned with Feedback is the logical next step
> (patch also no longer applies).

Please find attached the next revision :)

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Attachment Content-Type Size
v4-0001-psql-Fix-tab-completion-for-ALTER-TABLE.patch text/x-diff 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Lepikhov 2021-09-15 06:31:15 Re: Asymmetric partition-wise JOIN
Previous Message Julien Rouhaud 2021-09-15 04:39:05 Re: parallelizing the archiver