Skip site navigation (1) Skip section navigation (2)

Re: dumping query results to a csv

From: David Durham <ddurham(at)vailsys(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: dumping query results to a csv
Date: 2005-08-26 18:22:09
Message-ID: (view raw or whole thread)
Lists: pgsql-admin
Adi Alurkar wrote:
> 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>]

I ended up using pgadmin3 -- which has a nice feature for writing the 
contents of a query to file.

Of course, I'm still going to follow this subject and look at other more 
scriptable ways of doing this.



In response to

pgsql-admin by date

Next:From: Bruno Wolff IIIDate: 2005-08-27 06:21:50
Subject: Re: Hash index
Previous:From: Marcelo A. CostaDate: 2005-08-26 18:04:26
Subject: Set pgAdminIII charset

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group