Re: COPY TO '|gzip > /my/cool/file.gz' - Mailing list pgsql-general

From Willy-Bas Loos
Subject Re: COPY TO '|gzip > /my/cool/file.gz'
Date
Msg-id CAHnozTgDmYethXH57uKgmMR2juK8mHxTO3cg0uryvDQC_T7MEw@mail.gmail.com
Whole thread Raw
In response to Re: COPY TO '|gzip > /my/cool/file.gz'  (Vibhor Kumar <vibhor.kumar@enterprisedb.com>)
List pgsql-general
On Wed, Jul 20, 2011 at 8:53 PM, Vibhor Kumar
<vibhor.kumar@enterprisedb.com> wrote:
> You can use STDOUT to pipe output to a shell command and STDIN to read input from shell command.
> Something like given below:
> psql -c "COPY mytable to STDOUT"|gzip >/home/tgl/mytable.dump.gz
>
> cat filename|psql -c "COPY mytable from STDIN;"
>
> OR psql -c "COPY mytable from STDIN;" < filename

nice one, that works great!
(zcat instead of cat, though)

--
"Patriotism is the conviction that your country is superior to all
others because you were born in it." -- George Bernard Shaw

pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: Choosing primary key type: 64 or 52 bit primary keys?
Next
From: Craig Ringer
Date:
Subject: Re: Tracing in Postgres