Re: TAB completion for ALTER TABLE ... ALTER CONSTRAINT ... ENFORCED

From: Kirill Reshke <reshkekirill(at)gmail(dot)com>
To: Roman Khapov <rkhapov(at)yandex-team(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: TAB completion for ALTER TABLE ... ALTER CONSTRAINT ... ENFORCED
Date: 2025-12-29 20:40:27
Message-ID: CALdSSPh5vYRNnt8M4px=n8vcua1YsPkJzTTxd8pC61JTFceLqg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 29 Dec 2025 at 20:13, Roman Khapov <rkhapov(at)yandex-team(dot)ru> wrote:
>
>
>
> > On 11 Aug 2025, at 18:20, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
> >
> > Hi hackers!
> >
> > While looking at [0] I noticed that current psql tab-complete lacks support for
> >
> > ALTER TABLE ... ALTER CONSTRAINT ... [NOT] ENFORCED and
> >
> > ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT
> >
> > patterns.
>
> Hi!
>
> > COMPLETE_WITH("ENFORCED", "NOT ENFORCED", "NO INHERIT", "INHERIT");
>
> According to gram.y there might be DEFERRABLE and NOT DEFERRABLE, INITIALLY IMMEDIATE and INITIALLY DEFERRED (NOT VALID is acceptable by rules but not by the action)
>
> Maybe we can add them too? If so, i attached v2 patch with this options added.
>
> --
> Best regards,
> Roman Khapov
>
>
>

Thanks. PFA v3 with commit msg polishing, and added support for NOT -
statement patterns.

}
+ /* if we have ALTER TABLE <sth> ALTER|DROP|RENAME CONSTRAINT
<constraint> NOT, provide DEFERRABLE or ENFORCED */
+ else if (Matches("ALTER", "TABLE", MatchAny,
"ALTER|DROP|RENAME", "CONSTRAINT", MatchAny, "NOT"))
+ {
+ COMPLETE_WITH("DEFERRABLE", "ENFORCED");
+ }
/* ALTER TABLE <sth> VALIDATE CONSTRAINT <non-validated constraint> */
else if (Matches("ALTER", "TABLE", MatchAny, "VALIDATE", "CONSTRAINT"))
{

--
Best regards,
Kirill Reshke

Attachment Content-Type Size
v3-0001-Add-tab-completion-for-ALTER-TABLE-xxx-ALTER-CONT.patch application/octet-stream 1.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2025-12-29 20:56:00 Re: Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
Previous Message Ilia Evdokimov 2025-12-29 20:35:43 Hash-based MCV matching for large IN-lists