Thread: Accessing tables from different databases

Accessing tables from different databases

From
"K. Deepa"
Date:
Hi all,
        I want to access a table-1 of database-1 from
        database-2. Is it possible in pgsql. If so,
        is it possible to define a foreign key constraint
        for a column in table-2 in database-2 which
        references to a column in table-1 in database-1.
TIA

regards,
Deepa K.



Re: Accessing tables from different databases

From
Shridhar Daithankar
Date:
K. Deepa wrote:
> Hi all,
>         I want to access a table-1 of database-1 from
>         database-2. Is it possible in pgsql. If so,

Yes. You need to use dblink contrib module for that.

>         is it possible to define a foreign key constraint
>         for a column in table-2 in database-2 which
>         references to a column in table-1 in database-1.

I am afraid that's not possible.

  Shridhar


Re: Accessing tables from different databases

From
Fernando Schapachnik
Date:
Look at contrib/dblink.

Regards.

Fernando.
En un mensaje anterior, K. Deepa escribió:
> Hi all,
>         I want to access a table-1 of database-1 from
>         database-2. Is it possible in pgsql. If so,
>         is it possible to define a foreign key constraint
>         for a column in table-2 in database-2 which
>         references to a column in table-1 in database-1.
> TIA

Re: Accessing tables from different databases

From
Tom Lane
Date:
Fernando Schapachnik <fernando@mecon.gov.ar> writes:
> En un mensaje anterior, K. Deepa escribi�:
>> I want to access a table-1 of database-1 from
>> database-2. Is it possible in pgsql. If so,

> Look at contrib/dblink.

Also consider the possibility of using multiple schemas in a single
database, rather than a multi-database installation.

            regards, tom lane

Re: Accessing tables from different databases

From
Pavel Stehule
Date:
Hello,

You can acces others db via dblink. You will find it in contrib.
You can't use dblink for define f.k. :-(

regars
Pavel


> Hi all,
>         I want to access a table-1 of database-1 from
>         database-2. Is it possible in pgsql. If so,
>         is it possible to define a foreign key constraint
>         for a column in table-2 in database-2 which
>         references to a column in table-1 in database-1.
> TIA
>
> regards,
> Deepa K.
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>