Accessing tables from different databases

Started by Deepa Kover 22 years ago5 messagesgeneral
Jump to latest
#1Deepa K
kdeepa@midascomm.com

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.

#2Fernando Schapachnik
fernando@mecon.gov.ar
In reply to: Deepa K (#1)
Re: Accessing tables from different databases

Look at contrib/dblink.

Regards.

Fernando.
En un mensaje anterior, K. Deepa escribi�:

Show quoted text

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

#3Shridhar Daithankar
shridhar_daithankar@persistent.co.in
In reply to: Deepa K (#1)
Re: Accessing tables from different databases

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

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Fernando Schapachnik (#2)
Re: Accessing tables from different databases

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

#5Pavel Stehule
pavel.stehule@gmail.com
In reply to: Deepa K (#1)
Re: Accessing tables from different databases

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

Show quoted text

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