pgsql: Add CSV table output mode in psql.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add CSV table output mode in psql.
Date: 2018-11-26 20:19:06
Message-ID: E1gRNLW-0001ZW-8C@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2018-11-26 20:26:17 pgsql: Fix sample output for hash_metapage_info query
Previous Message David Steele 2018-11-26 19:36:56 Re: pgsql: Integrate recovery.conf into postgresql.conf