Re: Copying data from one table of one database to other table f other database

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Copying data from one table of one database to other table f other database
Date: 2009-04-29 12:27:39
Message-ID: gt9h3r$ud3$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 2009-04-28, Preetam Palwe <preetamp(at)aftek(dot)com> wrote:
> Thanks folks!
> Following command worked for me
>
>
> psql -h x.x.x.x -U postgres -d securez -c " copy alerts to stdout " |
> psql -h x.x.x.x -U postgres -d p -c " copy alerts from stdin "
>
> but
> psql -h x.x.x.x -U postgres -d securez -c " copy (select * from alerts)
> to stdout " | psql -h x.x.x.x -U postgres -d p -c " copy alerts from
> stdin "
>
> is giving me syntax error as
>
> ERROR: syntax error at or near "("
> LINE 1: copy (select * from alerts) to stdout
>
> Any idea ?

That syntax needs version 8.3, I usually do it that way, but with a where
clause in the select as most times I don't want the whole table.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Marcin Krol 2009-04-29 12:37:50 retrieving primary key for row with MIN function
Previous Message Neil Saunders 2009-04-28 16:55:30 Re: Query appears not to recognise index (enable_seqscan=off)