Re: Improve tab completion for COPY

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve tab completion for COPY
Date: 2025-05-07 23:53:35
Message-ID: 20250508085335.77b8c480e96f032b87c2d8c3@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 7 May 2025 14:36:35 -0700
Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:

> On Wed, May 7, 2025 at 6:23 AM Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
> >
> > On Wed, 7 May 2025 15:39:26 +0900
> > torikoshia <torikoshia(at)oss(dot)nttdata(dot)com> wrote:
> >
> > > Hi,
> > >
> > > I noticed that REJECT_LIMIT, an option available for COPY FROM, is not
> > > currently supported in psql's tab completion.
> > >
> > > Additionally, some options are only valid for COPY FROM or COPY TO, i.e.
> > > FREEZE, ON_ERROR, FORCE_QUOTE, but psql currently suggests them for both
> > > COPY FROM and COPY TO.
> > > As the number of COPY options continues to grow, I feel that having
> > > irrelevant suggestions makes tab completion noisier.
> >
> > Indeed eliminating irrelevant suggestions would improve user experience,
>
> +1
>
> > but I think there is a drawback that it increases code maintenance for
> > adding options used both in COPY FROM and TO. This might be trivial until
> > the number of common options are small as now, though.
> >
> > Perhaps, the redundant code could be reduced by preparing a list (an array
> > of const char*) containing common options part, then appending options
> > specific to each mode using some function like kind of append_variable_names,
> > and passing these lists to COMPLETE_WITH_LIST.
>
> Or we can simply #define the common option list and #define two lists
> for COPY TO and COPY FROM by concatenating the common option list,
> like we do for ALTER PROCEDURE/ROUTINE/FUNCTION options.

+1

I overlooked this although I looked for an existing solution in the tab
complement codes.

Regards,
Yugo Nagata

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

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-05-07 23:55:08 Re: Large expressions in indexes can't be stored (non-TOASTable)
Previous Message Nikhil Kumar Veldanda 2025-05-07 23:39:17 Re: ZStandard (with dictionaries) compression support for TOAST compression