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

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-15T13:12:47Z
Lists: pgsql-hackers

Attachments

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

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. psql: Fix incorrect tab completion after CREATE PUBLICATION ... EXCEPT (...)