From: | "Josh Tolley" <eggyknap(at)gmail(dot)com> |
---|---|
To: | Dani Castaños <danitao(dot)mailists(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Foreign Key inter databases |
Date: | 2007-08-02 19:23:36 |
Message-ID: | e7e0a2570708021223n1e6e234dtbd6f04f6e9089189@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 8/2/07, Dani Castaños <danitao(dot)mailists(at)gmail(dot)com> wrote:
> Hi all!
>
> Is it possible to have a foreign key where referenced table is in
> another database?
>
> Thank you in advance
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
Unless you use things like dblink to make two separate databases think
they're one database, you really can't do anything where one database
depends on another. Your best bet, if you can have both data sets on
the same machine, is to stick them in two separate schemas, and then
you can have foreign keys on a table in one schema referencing a table
in another schema. That's (in part) what schemas are for in the first
place -- to separate logically distinct data sets while allowing
accesses between the two when necessary.
If for whatever reason having all the data on one machine isn't
possible, you can try using dbi-link or dblink to create links between
the two databases and do foreign keys that way, but I've never used
either, so that might not work/make sense/be possible, etc.
-Josh
From | Date | Subject | |
---|---|---|---|
Next Message | Kenneth Gonsalves | 2007-08-03 01:15:06 | Re: Authentification failed |
Previous Message | Dani Castaños | 2007-08-02 16:18:05 | Foreign Key inter databases |