Thread

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 (...)

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

    vignesh C <vignesh21@gmail.com> — 2026-04-15T13:12:47Z

    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
    
  2. Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA

    shveta malik <shveta.malik@gmail.com> — 2026-04-16T03:59:41Z

    On Wed, Apr 15, 2026 at 8:45 PM vignesh C <vignesh21@gmail.com> 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.
    >
    
    I can reproduce the problem without the patch. The patch looks good to me.
    
    thanks
    Shveta
    
    
    
    
  3. Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA

    Fujii Masao <masao.fujii@gmail.com> — 2026-04-16T17:09:32Z

    On Thu, Apr 16, 2026 at 1:00 PM shveta malik <shveta.malik@gmail.com> wrote:
    >
    > On Wed, Apr 15, 2026 at 8:45 PM vignesh C <vignesh21@gmail.com> 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
    
    
    
    
  4. Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA

    vignesh C <vignesh21@gmail.com> — 2026-04-17T04:32:04Z

    On Thu, 16 Apr 2026 at 22:39, Fujii Masao <masao.fujii@gmail.com> wrote:
    >
    > On Thu, Apr 16, 2026 at 1:00 PM shveta malik <shveta.malik@gmail.com> wrote:
    > >
    > > On Wed, Apr 15, 2026 at 8:45 PM vignesh C <vignesh21@gmail.com> 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");
    > -------------------
    
    Yes, this is better. The attached v2 version patch has the changes for the same.
    
    Regards,
    Vignesh
    
  5. Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA

    Fujii Masao <masao.fujii@gmail.com> — 2026-04-17T05:32:25Z

    On Fri, Apr 17, 2026 at 1:32 PM vignesh C <vignesh21@gmail.com> wrote:
    > Yes, this is better. The attached v2 version patch has the changes for the same.
    
    Thanks for updating the patch! I've pushed it.
    
    Regards,
    
    -- 
    Fujii Masao
    
    
    
    
  6. Re: Fix tab completion after EXCEPT (...) in IMPORT FOREIGN SCHEMA

    vignesh C <vignesh21@gmail.com> — 2026-04-17T13:55:42Z

    On Fri, 17 Apr 2026 at 11:02, Fujii Masao <masao.fujii@gmail.com> wrote:
    >
    > On Fri, Apr 17, 2026 at 1:32 PM vignesh C <vignesh21@gmail.com> wrote:
    > > Yes, this is better. The attached v2 version patch has the changes for the same.
    >
    > Thanks for updating the patch! I've pushed it.
    
    Thanks for committing this patch.
    
    Regards,
    Vignesh