From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add CSV table output mode in psql.
Date: Mon, 26 Nov 2018 20:19:06 +0000
Message-ID: <E1gRNLW-0001ZW-8C@gemulon.postgresql.org> (raw)
Add CSV table output mode in psql.
"\pset format csv", or --csv, selects comma-separated values table format.
This is compliant with RFC 4180, except that we aren't too picky about
whether the record separator is LF or CRLF; also, the user may choose a
field separator other than comma.
This output format is directly compatible with the server's COPY CSV
format, and will also be useful as input to other programs. It's
considerably safer for that purpose than the old recommendation to
use "unaligned" format, since the latter couldn't handle data
containing the field separator character.
Daniel Vérité, reviewed by Fabien Coelho and David Fetter, some
tweaking by me
Discussion: https://postgr.es/m/a8de371e-006f-4f92-ab72-2bbe3ee78f03@manitou-mail.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/aa2ba50c2c13dd35a95a91638aa0a2b88c6df1eb
Modified Files
--------------
doc/src/sgml/ref/psql-ref.sgml | 98 +++++++++++++++++++++------
src/bin/psql/command.c | 39 ++++++++++-
src/bin/psql/help.c | 16 +++--
src/bin/psql/settings.h | 1 +
src/bin/psql/startup.c | 7 ++
src/bin/psql/tab-complete.c | 5 +-
src/fe_utils/print.c | 131 ++++++++++++++++++++++++++++++++++++-
src/include/fe_utils/print.h | 2 +
src/test/regress/expected/psql.out | 89 +++++++++++++++++++++++++
src/test/regress/sql/psql.sql | 48 ++++++++++++++
10 files changed, 402 insertions(+), 34 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Add CSV table output mode in psql.
In-Reply-To: <E1gRNLW-0001ZW-8C@gemulon.postgresql.org>
References: <E1gRNLW-0001ZW-8C@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox