Re: csv format for psql - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: csv format for psql
Date
Msg-id 20181109121110.GB22720@paquier.xyz
Whole thread Raw
In response to Re: csv format for psql  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: csv format for psql  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-hackers
On Fri, Nov 09, 2018 at 11:40:44AM +0100, Daniel Verite wrote:
> The above is meant to accept a multibyte character as the separator,
> in which case strlen(value) would be greater than 1.

Still what's the point except complicating the code?  We don't care
about anything fancy in the backend-side ProcessCopyOptions() when
checking cstate->delim, and having some consistency looks like a good
thing to me.

I am also questioning a couple of things: it is possible to choose
freely how to represent a null value thanks to "\pset null", which gives
an equivalent to the COPY option.  Choosing if a header is present or
not can be done with tuples_only.  However there is no option to specify
an escape character, no option to specify a quote character, and it is
not possible to force quotes for all values.  Those are huge advantages
as any output can be made compatible with other CSV variants.  Isn't
what is presented too limited?  \copy has at least the advantage to push
down those responsibilities to the backend..
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Libpq support to connect to standby server as priority
Next
From: Evgeniy Efimkin
Date:
Subject: Re: Special role for subscriptions