Re: csv format for psql

From: David Fetter <david(at)fetter(dot)org>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
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 18:48:22
Message-ID: 20180307184822.GD7864@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 07, 2018 at 07:40:49PM +0100, Fabien COELHO wrote:
>
> Hello Pavel,
>
> >> psql --csv 'TABLE Stuff;' > stuff.csv
> >
> >There is commad -c and it should be used. The --csv options should not to
> >have a parameter. I don't like a idea to have more options for query
> >execution.
>
> Yes, I agree and that is indeed what I meant, sorry for the typo. The
> cleaner example would be something like:
>
> 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'

Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-03-07 18:56:02 Re: pgbench's expression parsing & negative numbers
Previous Message Pavel Stehule 2018-03-07 18:41:52 Re: csv format for psql