Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA

From: vignesh C <vignesh21(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA
Date: 2026-04-15 13:12:47
Message-ID: CALDaNm1-Fx6Msw6zcRuSjgQdw6asdTyp2DwP-4TCKGYAT+ndsA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

While reviewing tab completion behavior, I noticed an issue after
EXCEPT (...) support was added to CREATE PUBLICATION.
Currently, after typing:
IMPORT FOREIGN SCHEMA public EXCEPT (t1)

psql correctly suggests FROM SERVER. However, the existing completion
rule uses a generic:
TailMatches("EXCEPT", "(*)")

Previously this was safe because no other command used EXCEPT (...).
Now that CREATE PUBLICATION also supports EXCEPT (...), the same rule
can incorrectly match publication commands and suggest FROM SERVER
there as well.

The attached patch fixes this by restricting the EXCEPT (...) path to
IMPORT FOREIGN SCHEMA using HeadMatches(), while preserving the
existing LIMIT TO (...) behavior.

Regards,
Vignesh

Attachment Content-Type Size
0001-Fix-tab-completion-after-EXCEPT-in-IMPORT-FOREIGN-SC.patch application/octet-stream 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2026-04-15 13:43:26 Experimenting with wider Unicode storage
Previous Message vignesh C 2026-04-15 13:08:01 Re: Support EXCEPT for TABLES IN SCHEMA publications