Re: Re: csv format for psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Daniel Verite <daniel(at)manitou-mail(dot)org>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: csv format for psql
Date: 2018-03-26 13:45:01
Message-ID: CAFj8pRAUT51U93sUYKRUTLSP=M0YwP+XRxNifd46OFuZFsZuow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-03-26 14:44 GMT+02:00 Daniel Verite <daniel(at)manitou-mail(dot)org>:

> 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.
>

fixed

>
> 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.
>
>
I don't understand what is wrong there? There can be any message (short -
just "unset",...). I understand so default visual can look strange, because
aligned mode has not default field separator, but I don't see any other
possibility.

Can I do some recapitulation:

1. using CSV with default | as field separator is wrong - probably there is
a agreement

2. partial solution is fieldsep_X where X will be format name. It is better
than using | for csv, but it introduces new problems:

a) there are not new long, short options for this value

b) the list of pset options is bloating - every possible new format can
introduce fieldsep_X option

c) can be messy for people, because the setting fieldsep can has zero
effect on csv or some other formats that don't share default with unaligned
format.

So my position - I am very strong against to introduce CSV format with | as
field separator, and I am not happy if we introduce fieldsep_X like
options, because it is not too good too.

Regards

Pavel

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

Attachment Content-Type Size
default_format_fieldsep-7.patch text/x-patch 26.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2018-03-26 13:58:21 Re: [HACKERS] [PATCH] Vacuum: Update FSM more frequently
Previous Message Alvaro Hernandez 2018-03-26 13:42:39 Re: Proposal: http2 wire format