Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C11109FA249 for ; Wed, 27 Dec 2006 08:14:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 94387-04 for ; Wed, 27 Dec 2006 08:14:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from perth.mailnetwork.co.uk (perth.mailnetwork.co.uk [80.175.28.46]) by postgresql.org (Postfix) with ESMTP id 60C019F9F46 for ; Wed, 27 Dec 2006 08:14:00 -0400 (AST) Received: from [213.146.143.243] (port=19215 helo=[172.16.208.165]) by perth.mailnetwork.co.uk with esmtpa (Exim 4.63) (envelope-from ) id 1GzXfU-0005Bn-0m; Wed, 27 Dec 2006 12:14:00 +0000 Message-ID: <459263C1.2040401@mailnetwork.co.uk> Date: Wed, 27 Dec 2006 12:14:57 +0000 From: "Andy Shellam (Mailing Lists)" User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Enrico CC: pgsql-admin@postgresql.org Subject: Re: Dump and Query References: <20061227140530.094fc4d3.scotty@linuxtime.it> In-Reply-To: <20061227140530.094fc4d3.scotty@linuxtime.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/333 X-Sequence-Number: 24125 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 customer_id | first_name | sur_name -------------+------------+---------- CUS0000002 | Andy | Shellam Or you can dump a specific table: # /usr/local/pgsql/bin/pg_dump --table=[tablename] [database] Regards, Andy. Enrico wrote: > Is there any way to make a dump from a query? > > For example if my query is: > > select field1,field2 from table > > Does it exist a shell command like pg_dump --QUERY myquery -f myfile? > > Have a nice day > Enrico > > -- Andy Shellam NetServe Support Team the Mail Network "an alternative in a standardised world" p: +44 (0) 121 288 0832/0839 m: +44 (0) 7818 000834