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

From Daniel Verite
Subject Re: Re: csv format for psql
Date
Msg-id 28bc49a8-99f4-4752-b45d-198b58f9ccf0@manitou-mail.org
Whole thread Raw
In response to Re: Re: csv format for psql  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Re: csv format for psql  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
    Pavel Stehule wrote:

> implemented in attached patch

Consider your initial output of \pset, when no option is specified
=================
$ ./psql
psql (11devel)
Type "help" for help.

postgres=# \pset
border             1
columns          0
expanded         off
fieldsep         not used
fieldsep_zero         ERROR
footer             on
format             aligned
linestyle         ascii
null             ''
numericlocale         off
pager             1
pager_min_lines      0
recordsep         '\n'
recordsep_zero         off
reset             ERROR
tableattr
title
tuples_only         off
unicode_border_linestyle single
unicode_column_linestyle single
unicode_header_linestyle single
================

These entries with ERROR correspond in fact to no error at all,
or we have to pretend that the default state of psql is erroneous,
which doesn't make sense.

Also "reset" is not a variable, it seems to be a command,
so it probably shouldn't be there in the first place.

More generally, I'd think the point of reusing "fieldsep" was to
reuse the concept, not reimplement it, let alone changing
bits of behavior of the unaligned mode along the way.

With this patch, again without specifying any option, just looking
at what fieldsep is leads to this:

postgres=# \pset fieldsep
User didn't specified field separator.
Current format doesn't specify default field separator.

If this is the way to "solve" the fact that a user has to do
 \pset fieldsep ','
to get commas in csv mode, then IMV the proposed solution
is clearly worse than the stated problem, and worse than
simply adding fieldsep_csv to be independant from the
unaligned mode.


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


pgsql-hackers by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types
Next
From: Damir Simunic
Date:
Subject: Re: Proposal: http2 wire format