Thread: Re: Dump and Query (fwd)

Re: Dump and Query (fwd)

From
"Ben K."
Date:
> 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 > dumpfile < query.txt

or

2. Same, on the fly

psql $database > dumpfile <<_eof_
select field1,field2 from table
_eof_




Regards,

Ben K.
Developer
http://benix.tamu.edu