Обсуждение: Linking Tables from 2 databases

Поиск
Список
Период
Сортировка

Linking Tables from 2 databases

От
"Pratik Shukla"
Дата:
Hello,
 
I have created a DB1 with several tables. Now i need to create another DB2 with a linked table from DB1. So if there is
atable_X in DB1, is there a way to import that table_X into DB2 so that any changes made to table_X in DB1 will also
applyto DB2? 
 
table_X has references to other tables in DB1 as well...will these references be maintained if table_X is imported to
DB2?
 
Any help is appreciated.

Re: Linking Tables from 2 databases

От
Richard Broersma Jr
Дата:
I have created a DB1 with several tables. Now i need to create another DB2 with a linked table
from DB1. So if there is a table_X in DB1, is there a way to import that table_X into DB2 so that
any changes made to table_X in DB1 will also apply to DB2?

table_X has references to other tables in DB1 as well...will these references be maintained if
table_X is imported to DB2?

Any help is appreciated.


maybe dblink will do what you want:
http://pgfoundry.org/projects/snapshot/

Regards,

Richard Broersma Jr.

Re: Linking Tables from 2 databases

От
"Merlin Moncure"
Дата:
On 7/19/06, Pratik Shukla <pratikshukla@hotmail.com> wrote:
> I have created a DB1 with several tables. Now i need to create another DB2
> with a linked table from DB1. So if there is a table_X in DB1, is there a
> way to import that table_X into DB2 so that any changes made to table_X in
> DB1 will also apply to DB2?

that sounds a lot like replication. check out slony.  for a slightly
slimper alternative you may consider not using two databases, make two
schemas inside your database.  now you can link your tables via simple
trigger.  open up the documentation and read up on schemas and make
sure this is not the right solution for you.

> table_X has references to other tables in DB1 as well...will these
> references be maintained if table_X is imported to DB2?

it's not quite clear what your are asking...I don't understand what
your concept of a reference is.  if you are replicating, generally you
always make changes to one table and the other is a slave.

merlin