Re: dumping query results to a csv - Mailing list pgsql-admin

From Adi Alurkar
Subject Re: dumping query results to a csv
Date
Msg-id 8F4C1563-3FF3-419A-8156-41878BEEB890@sf.net
Whole thread Raw
In response to dumping query results to a csv  (David Durham <ddurham@vailsys.com>)
Responses Re: dumping query results to a csv  ("Jim C. Nasby" <jnasby@pervasive.com>)
Re: dumping query results to a csv  (David Durham <ddurham@vailsys.com>)
List pgsql-admin
Greetings,

There is no direct way to achieve what you want, the easiest hack is
to create a temp table with you query i.e.

create table tmp_foo as select col1, col4, col7 from table1, table2
where  ....;
copy table tmp_foo to [stdout|<file_name>]

HTH

Adi Alurkar
adi@sf.net


On Aug 25, 2005, at 3:24 PM, David Durham wrote:

> This is kind of a pg-admin newbie question, so apologies in advance.
>
> Anyway, I'd like to issue a command that dumps the results of a
> query to
> a txt file in comma delimited format.  Does PostgreSQL ship with
> something to do this?  I searched the web, but found what appeared
> to be
> non-free solutions.
>
> Thanks,
>
> Dave
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>


pgsql-admin by date:

Previous
From: Jeff Frost
Date:
Subject: Re: dumping query results to a csv
Next
From: Jeff Frost
Date:
Subject: Re: dumping query results to a csv