Re: Extracting data into .csv format

From: Ziggy Skalski <zskalski(at)afilias(dot)info>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: Extracting data into .csv format
Date: 2016-02-17 17:00:00
Message-ID: 56C4A710.6050309@afilias.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 2016-02-17 11:49 AM, Ferrell, Denise D CTR NSWCDD, H11 wrote:
> Using PostgreSQL 9.3 on Linux
>
> I'm trying to extract data into a comma delimited format and not having much success...seems to act totally different from Oracle. Does anyone have any suggestions?
>
> Thank you in advance.
> Denise
Have you tried something like i.e.:

psql -c "COPY ( QUERY ) TO STDOUT WITH CSV HEADER " > CSV_FILE.csv

Should do the trick (assuming it's basic output you're after).

Regards,

Ziggy

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Dave Johansen 2016-02-17 17:49:18 Re: Setting up streaming replication with new server as master?
Previous Message David G. Johnston 2016-02-17 16:55:25 Re: Extracting data into .csv format