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

From Daniel Verite
Subject Re: csv format for psql
Date
Msg-id 3a0621c7-307d-4e15-b8a3-118f09f710c5@manitou-mail.org
Whole thread Raw
In response to Re: csv format for psql  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: csv format for psql  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: csv format for psql  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: csv format for psql  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-hackers
    Fabien COELHO wrote:

> Maybe some \csv command could set the format to csv, fieldsep to ",",
> tuples_only to on, recordsep to '\n'? Not sure whether it would be
> acceptable, though, and how to turn it off once turned on... Probably an
> average (aka not good) idea:-)

Thanks for reviewing this patch!

Attached is a v2 fixing the bugs you mentioned, and adding ---csv/-C
as discussed upthread. I'll add some regression tests shortly.

About the default separator, the approach taken by this patch is that
the csv output is equivalent to unaligned with csv quoting, so it has
the same behavior and follows the options of the unaligned mode
as much as possible.

That seemed like a good idea to me when I wrote it, but maybe
a better idea would to have a new \pset fieldsep_csv
parameter with its own command-line option, and ignore {fieldsep,
fieldsep_zero, recordsep, recordsep_zero} for this format, just like
they are being ignored for HTML, or latex, or asciidoc...
Does anyone who think that csv should be added care
about this "alignment" with unaligned? :)


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

Attachment

pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: row filtering for logical replication
Next
From: Nikita Glukhov
Date:
Subject: Re: [PATCH][PROPOSAL] Add enum releation option type