Re: two small tab-completion patches (ALTER CONSTRAINT, CHECK modifiers)

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: two small tab-completion patches (ALTER CONSTRAINT, CHECK modifiers)
Date: 2026-10-19 23:33:18
Message-ID: 176B6352-89DC-4898-8186-672389574DC4@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Oct 6, 2026, at 05:24, Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> wrote:
>
> Hello,
>
> Two small ones.
> 1/ after ALTER TABLE t ALTER CONSTRAINT c, psql offers
> nothing so add DEFERRABLE/ENFORCED/INHERIT and their NOT/NO forms.
>
> 2/ after ADD [CONSTRAINT c] CHECK (...), psql offers nothing so add NOT
> ENFORCED, NOT VALID, NO INHERIT.
>
> Thanks,
> Baji Shaik.
>
> <0001-psql-Add-tab-completion-for-ALTER-TABLE-ALTER-CONSTR.patch><0001-psql-Add-tab-completion-for-CHECK-constraint-modifie.patch>

Thanks for the patch.

I think both 0001 and 0002 share a common problem:
```
evantest=# alter table t alter constraint c not

```

After NOT or NO, tab completion doesn’t suggest any further keywords. Here is an example from the same file for reference:
```
/* ALTER STATISTICS <name> */
else if (Matches("ALTER", "STATISTICS", MatchAny))
COMPLETE_WITH("OWNER TO", "RENAME TO", "SET SCHEMA", "SET STATISTICS");
/* ALTER STATISTICS <name> SET */
else if (Matches("ALTER", "STATISTICS", MatchAny, "SET"))
COMPLETE_WITH("SCHEMA", "STATISTICS");
```

As you can see, besides suggesting SET SCHEMA and SET STATISTICS, there is a separate rule that matches SET and suggests SCHEMA and STATISTICS. I think we need similar rules for NOT and NO here. And 0001 has the same thing for INITIALLY.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2026-10-20 00:26:40 Re: Two more RI fast-path issues
Previous Message Baji Shaik 2026-10-19 22:48:59 Re: two small tab-completion patches (ALTER CONSTRAINT, CHECK modifiers)