Re: proposal \gcsv

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal \gcsv
Date: 2020-03-27 20:27:19
Message-ID: CAFj8pRBEx7JsRWmzZFszMt=p8LZUddBwfgS6vditce17O-iEjg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

čt 26. 3. 2020 v 19:41 odesílatel Erik Rijkers <er(at)xs4all(dot)nl> napsal:

> On 2020-03-26 18:49, Pavel Stehule wrote:
> > Hi
> >
> > [psql-gfmt.patch]
>
> This seems useful and works well; I haven't found any errors. Well done.
>
> However, I have a suggestion that is perhaps slightly outside of this
> patch but functionally so close that maybe we can discuss it here.
>
> When you try to get a tab-separated output via this new \gfmt in a
> one-liner
> you're still forced to use
> \pset csv_fieldsep '\t'
>
> Would it be possible to do one of the following to enable a more compact
> one-liner syntax:
>
> 1. add an option:
> \gfmt tsv --> use a TAB instead of a comma in the csv
>
> or
>
> 2. let the psql command-line option '--csv' honour the value given by
> psql -F/--field-separator (it does not do so now)
>
> or
>
> 3. add an psql -commandline option:
> --csv-field-separator
>
> Any of these three (I'd prefer the first) would make producing a tsv in
> shell one-liners with psql easier/more compact.
>

I understand to your proposal, but it's hard to do inside \gfmt command

1. a syntax of psql backslash commands doesn't support named parameters,
and \gfmt (like some others \gx) statements has optional parameter already.
There was a long discussion (without success) about possible
parametrizations of psql commands.

2. if I understand to tsv format, then it is not CSV format with different
separator.

the most correct design is introduction new output format "tsv".This format
can produce 100% valid tsv.

Regards

Pavel

>
> Thanks,
>
>
> Erik Rijkers
>
>
>
>
>
>
>
>
>
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Palmiotto 2020-03-27 20:30:47 Re: some AppVeyor files
Previous Message David Steele 2020-03-27 20:16:11 Re: backup manifests