public inbox for [email protected]
help / color / mirror / Atom feedFrom: Fujii Masao <[email protected]>
To: shveta malik <[email protected]>
Cc: vignesh C <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA
Date: Fri, 17 Apr 2026 02:09:32 +0900
Message-ID: <CAHGQGwGeg-JaD2s6TW7VpNJC_GyJRZ-cOkrp8uwnjN+=4mf=xw@mail.gmail.com> (raw)
In-Reply-To: <CAJpy0uAbEk55GCM1huYaZZWsPMDeLuOcUDTBP9ozdhjpV4ONxw@mail.gmail.com>
References: <CALDaNm1-Fx6Msw6zcRuSjgQdw6asdTyp2DwP-4TCKGYAT+ndsA@mail.gmail.com>
<CAJpy0uAbEk55GCM1huYaZZWsPMDeLuOcUDTBP9ozdhjpV4ONxw@mail.gmail.com>
On Thu, Apr 16, 2026 at 1:00 PM shveta malik <[email protected]> wrote:
>
> On Wed, Apr 15, 2026 at 8:45 PM vignesh C <[email protected]> wrote:
> >
> > 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.
Thanks for the patch!
- else if (TailMatches("LIMIT", "TO", "(*)") ||
+ else if (HeadMatches("IMPORT", "FOREIGN", "SCHEMA", MatchAny) &&
TailMatches("EXCEPT", "(*)"))
COMPLETE_WITH("FROM SERVER");
+ else if (TailMatches("LIMIT", "TO", "(*)"))
+ COMPLETE_WITH("FROM SERVER");
Do we really need to split this into two conditions? Wouldn't it be simpler
to keep a single condition?, for example:
-------------------
else if (TailMatches("LIMIT", "TO", "(*)") ||
- TailMatches("EXCEPT", "(*)"))
+ Matches("IMPORT", "FOREIGN", "SCHEMA", MatchAny, "EXCEPT", "(*)"))
COMPLETE_WITH("FROM SERVER");
-------------------
Regards,
--
Fujii Masao
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA
In-Reply-To: <CAHGQGwGeg-JaD2s6TW7VpNJC_GyJRZ-cOkrp8uwnjN+=4mf=xw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox