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

From Michael Paquier
Subject Re: csv format for psql
Date
Msg-id 20181107082355.GG1677@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
Re: csv format for psql
List pgsql-hackers
On Tue, Nov 06, 2018 at 02:57:15PM +0100, Daniel Verite wrote:
> Here's a rebased version following these changes.

Thanks for doing a rebase.

First, it seems to me that it is necessary to overcomplicate the
interface of psql for that.  Most of the other formats don't have their
own switch, and it is perfectly possible to use CSV format with just
--pset=format=csv.  -C could also be useful for other things, say
compression.

Not reusing fieldsep and creating a new variable looks like the correct
way to go, as there is no need to bother about cross-option checks if
the format is moved from unaligned to csv and the other way around,
especially as the delimiter of CSV needs cannot be larger than
one-byte.

+   pset.popt.topt.fieldSepCsv = pg_strdup(",");
Let's store that in a variable instead of hardcoding it.

In the regression tests, "col 9" is wanted with a newline?

I am still digging into the details of this patch, and I am
unfortunately running out of fuel for the day.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "Higuchi, Daisuke"
Date:
Subject: RE: [Bug Fix]ECPG: cancellation of significant digits on ECPG
Next
From: "Kato, Sho"
Date:
Subject: RE: Performance improvements of INSERTs to a partitioned table