Re: Added tab completion for the missing options in copy statement

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ahsan Hadi <ahsan(dot)hadi(at)gmail(dot)com>
Subject: Re: Added tab completion for the missing options in copy statement
Date: 2020-07-17 11:58:51
Message-ID: CALDaNm0U2_TtAwto1W7UKdkS-oZ65OHu0m9mJaWDpB0SY5_W9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 17, 2020 at 11:15 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Jul 10, 2020 at 09:58:28AM +0530, vignesh C wrote:
> > Thanks for reviewing the patch.
> > This changes is already present in the document, no need to make any
> > changes as shown below:
> >
> > COPY table_name [ ( column_name [, ...] ) ]
> > FROM { 'filename' | PROGRAM 'command' | STDIN }
> > [ [ WITH ] ( option [, ...] ) ]
> > [ WHERE condition ]
>
> Not completely actually. The page of psql for \copy does not mention
> the optional where clause, and I think that it would be better to add
> that for consistency (perhaps that's the point raised by Ahsan?). I
> don't see much point in splitting the description of the meta-command
> into two lines as we already mix stdin and stdout for example which
> only apply to respectively "FROM" and "TO", so let's just append the
> conditional where clause at its end. Attached is a patch doing so
> that I intend to back-patch down to v12.

I would like to split into 2 lines similar to documentation of
sql-copy which gives better readability, attaching a new patch in
similar lines.

> Coming back to your proposal, another thing is that with your patch
> you recommend a syntax still present for compatibility reasons, but I
> don't think that we should recommend it to the users anymore, giving
> priority to the new grammar of the post-9.0 era. I would actually go
> as far as removing BINARY from the completion when specified just
> after COPY to simplify the code, and specify the list of available
> options after typing "COPY ... WITH (FORMAT ", with "text", "csv" and
> "binary". Adding completion for WHERE after COPY FROM is of course a
> good idea.

I agree with your comments, and have made a new patch accordingly.
Thoughts?

Regards,
Vignesh
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
0001-Corrected-copy-syntax.patch text/x-patch 1.9 KB
0002-Tab-completion-for-copy-statement.patch text/x-patch 1.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2020-07-17 12:02:37 Re: Retry Cached Remote Connections for postgres_fdw in case remote backend gets killed/goes away
Previous Message Bharath Rupireddy 2020-07-17 11:56:36 Re: [PATCH] Performance Improvement For Copy From Binary Files