| From: | Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> |
|---|---|
| To: | surya poondla <suryapoondla4(at)gmail(dot)com> |
| Cc: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: two small tab-completion patches (ALTER CONSTRAINT, CHECK modifiers) |
| Date: | 2026-10-22 00:55:50 |
| Message-ID: | CA+fm-RNe=OXCXxoVtSwpV37GN91=cZ+EHv6iR2y7A7Aqbs1Xng@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Oct 21, 2026 at 6:30 PM surya poondla <suryapoondla4(at)gmail(dot)com>
wrote:
>
> I also ran every suggested form against the server, all are accepted. NOT
> VALID is correctly left out of the ALTER CONSTRAINT list, since
> the grammar rejects it there. src/bin/psql/t/010_tab_completion.pl passes.
>
Thank you so much for reviewing and testing.
>
> Two small, optional suggestions:
> 1. After "ALTER CONSTRAINT fk DEFERRABLE" (or NOT DEFERRABLE)
> nothing further is offered, although "DEFERRABLE INITIALLY DEFERRED" is
> probably the most common way to write it. A rule
> offering INITIALLY DEFERRED / INITIALLY IMMEDIATE there would
> be nice, but I'm fine leaving it out to keep the patch small.
>
I agree with point 1 and added it, after
DEFERRABLE (or NOT DEFERRABLE), tab now offers INITIALLY DEFERRED /
INITIALLY IMMEDIATE, found by looking at ConstraintAttributeElem in
gram.y. One adjustment while doing that: NOT DEFERRABLE only offers
INITIALLY IMMEDIATE, not INITIALLY DEFERRED, I don't think NOT
DEFERRABLE ... INITIALLY DEFERRED is valid (the grammar rejects it:
"constraint declared INITIALLY DEFERRED must be DEFERRABLE"), but
let me know if I'm missing something.
>
> 2. A couple of cases in 010_tab_completion.pl, e.g. for "alter table tab1
> alter constraint c not<tab>" and
> "... check (a > 0) no<tab>", would keep the new rules from silently
> regressing.
>
On point 2, honestly I'm not sure it's worth adding unless someone
else feels strongly about it, happy to add if so.
v3 of the ALTER CONSTRAINT patch attached, along with the CHECK
constraint patch again (unchanged) for convenience.
Thanks,
Baji Shaik.
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0001-psql-Add-tab-completion-for-CHECK-constraint-modifie.patch | application/octet-stream | 2.0 KB |
| v3-0001-psql-Add-tab-completion-for-ALTER-TABLE-ALTER-CONSTR.patch | application/octet-stream | 3.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Henson Choi | 2026-10-22 00:58:00 | Re: [DEPARSE] Operators on ROW() constructors read back as row comparisons |
| Previous Message | Fujii Masao | 2026-10-22 00:32:52 | Re: 035_standby_logical_decoding might fail due to FATAL message lost inside libpq |