Re: [ADMIN] Dump and Query (fwd)

2007-01-04 Thread Ben K.
Is there any way to make a dump from a query? select field1,field2 from table Does it exist a shell command like pg_dump --QUERY myquery -f myfile? Belated, but it looks this is another way (equivalent to Andy Shellam's) cat >> query.txt select field1,field2 from table ^D 1. psql $database

Re: [ADMIN] Dump and Query

2006-12-27 Thread Bruno Wolff III
On Wed, Dec 27, 2006 at 14:05:30 +0100, Enrico <[EMAIL PROTECTED]> 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? In 8.2 you can use a query wi

Re: [ADMIN] Dump and Query

2006-12-27 Thread Bricklen Anderson
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

Re: [ADMIN] Dump and Query

2006-12-27 Thread Shoaib Mir
You can use the COPY ( http://www.postgresql.org/docs/current/static/sql-copy.html) command for doing so An example will be --> COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO '/usr1/proj/bray/sql/a_list_countries.copy'; - Shoaib Mir EnterpriseDB (www.enterp

Re: [ADMIN] Dump and Query

2006-12-27 Thread Andy Shellam (Mailing Lists)
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 -++--

[ADMIN] Dump and Query

2006-12-27 Thread Enrico
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 -- If Bill Gates had a penny for everytime Windows crashed,he'd be a multi-billionaire by now