Re: csv format for psql

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: David Fetter <david(at)fetter(dot)org>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: csv format for psql
Date: 2018-03-07 19:04:05
Message-ID: alpine.DEB.2.20.1803071958370.6645@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


>> psql --csv -c 'TABLE foo' > foo.csv
>>
>> With a -c to introduce the command.
>
> This seems pretty specialized. If we're adding something new, how about
>
> psql --format=csv -o foo.csv -c 'TABLE foo'
>
> Or we could stick with:
>
> psql -P format=csv -o foo.csv -c 'TABLE foo'

Currently "-P format=csv" uses the unaligned formating separators, i.e.
'|' is used. I was suggesting that a special long option could switch
several variables to some specific values, i.e.

--csv

Would be equivalent to something like:

-P format=csv -P fieldsep=, -P recordsep=\n (?) -P tuples_only=on ...

I.e. really generate some csv from the data in just one option, not many.

But this is obviously debatable.

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2018-03-07 19:13:17 Fix missing spaces in docs
Previous Message Robert Haas 2018-03-07 18:57:18 Re: parallel append vs. simple UNION ALL