Re: Improve tab completion for COPY
Yugo Nagata <nagata@sraoss.co.jp>
From: Yugo Nagata <nagata@sraoss.co.jp>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: <sawada.mshk@gmail.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2025-06-03T08:58:01Z
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 →
-
Fix tab-completion for COPY and \copy options.
- f5a987c0e5f6 19 (unreleased) landed
- 765a4c94ccc8 18.0 landed
- c1c6169eb4f4 17.6 landed
- d69836b13c46 16.10 landed
- e3584e457db2 15.14 landed
- 0514616f0e28 14.19 landed
-
Add tab completion for REJECT_LIMIT option.
- b774ad493367 18.0 landed
-
Allow "COPY table TO" command to copy rows from materialized views.
- 534874fac0b3 18.0 cited
-
Add REJECT_LIMIT option to the COPY command.
- 4ac2a9beceb1 18.0 cited
On Thu, 8 May 2025 21:39:10 +0900 torikoshia <torikoshia@oss.nttdata.com> wrote: > Thanks for your comments! > > On 2025-05-08 08:53, Yugo Nagata wrote: > > On Wed, 7 May 2025 14:36:35 -0700 > > Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > >> On Wed, May 7, 2025 at 6:23 AM Yugo Nagata <nagata@sraoss.co.jp> > >> wrote: > >> > > >> > On Wed, 7 May 2025 15:39:26 +0900 > >> > torikoshia <torikoshia@oss.nttdata.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 > > Agreed. > I think attached patch implemented the suggested way. Thank you for updating the patch. It looks good and I confirmed that this works as expected. Regards, Yugo Nagata > > -- > Regards, > > -- > Atsushi Torikoshi > Seconded from NTT DATA GROUP CORPORATION to SRA OSS K.K. -- Yugo Nagata <nagata@sraoss.co.jp>