Re: Exporting postgres query to CSV

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: John Purser <jmpurser(at)gmail(dot)com>
Cc: Ryan Suarez <ryan(dot)suarez(at)sheridanc(dot)on(dot)ca>, pgsql-general(at)postgresql(dot)org
Subject: Re: Exporting postgres query to CSV
Date: 2006-05-15 21:41:41
Message-ID: 20060515214140.GR26212@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 09, 2006 at 08:57:57AM -0700, John Purser wrote:
> > I am running postgres 7.4.7 on debian sarge.
> First:
> psql -U <PGSQL USER> -o <OUPUT FILE NAME> --pset format=unaligned
> --pset fieldsep=',' -c '<SQL COMMAND HERE>' -d <DATABASE NAME HERE>
>
> I think that will give you the output you were after assuming you're
> scripting psql and that you replace the values in <> with appropriate
> values. The syntax is slightly different from the psql command line.
>
> Second:
> man psql is your friend.

Third:
7.4.7 is ancient and suffers from a number of data loss bugs. If you
need to stick with 7.4 you should at least be running the most current
version.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2006-05-15 22:04:26 Re: Concatenate WAL contents
Previous Message Jim C. Nasby 2006-05-15 21:38:54 Re: Unify distant Postgres databases