Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 079299FA313 for ; Wed, 27 Dec 2006 12:17:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 24373-01 for ; Wed, 27 Dec 2006 12:17:14 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from presinet.com (mail.presinet.com [209.53.156.1]) by postgresql.org (Postfix) with ESMTP id 006F29F93A2 for ; Wed, 27 Dec 2006 12:17:13 -0400 (AST) Received: from [10.10.1.151] ([10.10.1.151]) by presinet.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 27 Dec 2006 08:16:03 -0800 Message-ID: <45929C88.6000808@presinet.com> Date: Wed, 27 Dec 2006 08:17:12 -0800 From: Bricklen Anderson User-Agent: Thunderbird 1.5.0.8 (X11/20061117) MIME-Version: 1.0 To: "Andy Shellam (Mailing Lists)" CC: pgsql-admin@postgresql.org Subject: Re: Dump and Query References: <20061227140530.094fc4d3.scotty@linuxtime.it> <459263C1.2040401@mailnetwork.co.uk> In-Reply-To: <459263C1.2040401@mailnetwork.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 27 Dec 2006 16:16:03.0187 (UTC) FILETIME=[4E006C30:01C729D2] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/335 X-Sequence-Number: 24127 Andy Shellam (Mailing Lists) wrote: > Hi Enrico, > > The following command will get you a text file of your result-set: > > # echo "SELECT customer_id, first_name, sur_name FROM > users;"|/usr/local/pgsql/bin/psql -U [username] -d [database] > myfile.txt > # cat myfile.txt Alternative version: psql -d -c "SELECT customer_id, first_name, sur_name FROM users" -o myfile.txt