Skip site navigation (1) Skip section navigation (2)

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

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Preetam Palwe <preetamp(at)aftek(dot)com>
Cc: 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-27 10:47:19
Message-ID: 264855a00904270347t7d678c5brdd0c335f0a6ab980@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Mon, Apr 27, 2009 at 6:30 AM, Preetam Palwe <preetamp(at)aftek(dot)com> wrote:

>  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
>
>
>
> insert into table2 (select * from table1)
>
>
>
> but the problem is how can I specify the database name?
>

You'll need to look at the dblink contrib module.  Postgres does not include
the ability to use cross-database queries out-of-the-box.  The better way of
doing what you are talking about is to use separate schemas within the same
database.

Sean

In response to

pgsql-novice by date

Next:From: Bryan EmrysDate: 2009-04-27 20:09:26
Subject: Question on collapsing a sparse matrix
Previous:From: Preetam PalweDate: 2009-04-27 10:30:29
Subject: Copying data from one table of one database to other table f other database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group