summaryrefslogtreecommitdiff
path: root/src/include/fe_utils/print.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-11-26 15:18:55 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-11-26 15:18:55 -0500
commitaa2ba50c2c13dd35a95a91638aa0a2b88c6df1eb (patch)
tree70dfa44c60d6697895151a176345c98c682a2df5 /src/include/fe_utils/print.h
parent9a98984f4999b80435bcdcddf90bf9f3e5fc9df0 (diff)
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
Diffstat (limited to 'src/include/fe_utils/print.h')
-rw-r--r--src/include/fe_utils/print.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/fe_utils/print.h b/src/include/fe_utils/print.h
index b761349bc72..4f7987e5cbb 100644
--- a/src/include/fe_utils/print.h
+++ b/src/include/fe_utils/print.h
@@ -28,6 +28,7 @@ enum printFormat
PRINT_NOTHING = 0, /* to make sure someone initializes this */
PRINT_ALIGNED,
PRINT_ASCIIDOC,
+ PRINT_CSV,
PRINT_HTML,
PRINT_LATEX,
PRINT_LATEX_LONGTABLE,
@@ -112,6 +113,7 @@ typedef struct printTableOpt
const printTextFormat *line_style; /* line style (NULL for default) */
struct separator fieldSep; /* field separator for unaligned text mode */
struct separator recordSep; /* record separator for unaligned text mode */
+ char csvFieldSep[2]; /* field separator for csv format */
bool numericLocale; /* locale-aware numeric units separator and
* decimal marker */
char *tableAttr; /* attributes for HTML <table ...> */