Re: Improve tab completion for COPY

Masahiko Sawada <sawada.mshk@gmail.com>

From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Yugo Nagata <nagata@sraoss.co.jp>, torikoshia <torikoshia@oss.nttdata.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>, rmt@lists.postgresql.org
Date: 2025-07-01T05:20:45Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix tab-completion for COPY and \copy options.

  2. Add tab completion for REJECT_LIMIT option.

  3. Allow "COPY table TO" command to copy rows from materialized views.

  4. Add REJECT_LIMIT option to the COPY command.

On Thu, Jun 12, 2025 at 3:47 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
>
> On Tue, Jun 10, 2025 at 1:33 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
> >
> > On Tue, Jun 10, 2025 at 12:37:48PM -0700, Masahiko Sawada wrote:
> > >> > (1) adds tab completion support for the REJECT_LIMIT option, which was
> > >> > introduced in v18
> > >> > (2) splits the tab completion logic between COPY FROM and COPY TO to
> > >> > reflect their different options.
> > >
> > > [...]
> > >
> > > Given REJECT_LIMIT is a new v18 feature, it seems to me that (1) is an
> > > oversight of this feature, but I also agree that it's not a bug and
> > > doesn't block the release.
> > >
> > > How does the RMT feel about the change (1)?  Nathan, would you be OK with that?
> >
> > 0001 sure seems like an oversight in commit 4ac2a9b to me.  In any case, I
> > argued that we should fix tab completion for unlogged partitioned tables in
> > v18 [0], and this seems pretty similar.
> >
> >
> > TBH I'd even say that 0002 is fixing a bug and could be back-patched.  I've
> > added rmt@ here in case Tomas or Heikki feel differently.
>
> Thank you for your confirmation. I've just pushed the change (1) and
> am waiting for more comments on the change (2).
>

Thinking of the 0002 patch, I'm also inclined to agree that this fixes
a bogus tab completion behavior for COPY command and can be
back-patched to v14. In v14, c273d9d8ce reworked the tab completion
for COPY command and supports the completion for the options of FORMAT
within a WITH clause so we cannot back-patch it to v13.

Torikoshi-san, could you please prepare the patch for other branches
too if you agree with this direction?

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com