X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 66A66D7978 for ; Fri, 26 Aug 2005 15:22:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 59436-02 for ; Fri, 26 Aug 2005 18:22:04 +0000 (GMT) Received: from chrobd01.vailsys.com (chrobd01.vailsys.com [63.210.102.138]) by svr1.postgresql.org (Postfix) with ESMTP id CFD51D7822 for ; Fri, 26 Aug 2005 15:22:02 -0300 (ADT) Received: from dfsfbd06.vail (dfsfbd06.vail [192.168.129.190]) by chrobd01.vailsys.com (Postfix) with ESMTP id 4E9824981 for ; Fri, 26 Aug 2005 13:22:03 -0500 (CDT) Received: from [192.168.129.86] (dfwddurham.vail [192.168.129.86]) by dfsfbd06.vail (Postfix) with ESMTP id 3E673571A for ; Fri, 26 Aug 2005 13:22:03 -0500 (CDT) Message-ID: <430F5DD1.5060203@vailsys.com> Date: Fri, 26 Aug 2005 13:22:09 -0500 From: David Durham User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: dumping query results to a csv References: <430E4536.3030203@vailsys.com> <8F4C1563-3FF3-419A-8156-41878BEEB890@sf.net> In-Reply-To: <8F4C1563-3FF3-419A-8156-41878BEEB890@sf.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200508/353 X-Sequence-Number: 18672 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|] > > HTH 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. Thanks, Dave