Re: copy data from one db into another via copy & psql

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: copy data from one db into another via copy & psql
Date: 2010-05-22 10:36:03
Message-ID: ht8c2j$8ik$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2010-05-21, Kevin Kempter <kevink(at)consistentstate(dot)com> wrote:
> Can I copy from one db (via COPY) and pipe the results to a psql/COPY stmt so
> I can load the data into a table in the second db 'inline' without writing to
> & reading from a flat file?

Yes.

COPY ... TO stdout;

at the source and

COPY ... FROM stdin;

at the destination.

I use this with the

COPY ( query ) TO STDOUT ;

syntax when I want to copy only a few rows.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Deepa Thulasidasan 2010-05-22 12:02:27 Help reqd on azimuth finction
Previous Message Craig Ringer 2010-05-22 09:38:53 Re: Is postgres installed?