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-28 13:05:12
Message-ID: gt6uu8$lr4$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 2009-04-27, Preetam Palwe <preetamp(at)aftek(dot)com> wrote:
> This is a multi-part message in MIME format.

> Hello all
>
> I want to copy the data from one table to other table.
> These tables reside in two different databases.
>
> I am thinking of using following query=20
>
>
> insert into table2 (select * from table1)
>
>
> but the problem is how can I specify the database name?

you can't

you can do this however:

psql -c " copy (select * from table1) to stdout " database1 | psql -c " copy table2 from stdin " database2

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Preetam Palwe 2009-04-28 13:55:58 Re: Re: Copying data from one table of one database to other table f other database
Previous Message Dickson S. Guedes 2009-04-27 22:56:38 Re: [NOVICE] Workaround for bug #4608?