Thread: Cross database foreign keys

Cross database foreign keys

From
Morgan Curley
Date:
Does anyone know if it is possible to connect to a differernt db from within a plsql function.
I have multilple inter-related schemas and want to enforce some fk relationships.

Thanks,
Morgan 

Re: [GENERAL] Cross database foreign keys

From
Jan Wieck
Date:
Morgan Curley wrote:
> Does anyone know if it is possible to connect to a differernt db from
> within a plsql function.
> I have multilple inter-related schemas and want to enforce some fk
> relationships.

    PL/pgSQL  doesn't support external database connects. PL/TclU
    does.

    But keep in mind that with this kind of setup you don't  have
    two  phase  commits,  and  that  updates  done through such a
    trigger (e.g. cascades)  will  not  rollback  if  your  local
    update does so after it got fired, because you have to commit
    the remote transaction before you know if your local one ever
    will.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: Cross database foreign keys

From
"Josh Berkus"
Date:
Morgan,

> Does anyone know if it is possible to connect to a differernt db from
> within a plsql function.
> I have multilple inter-related schemas and want to enforce some fk
> relationships.

Currently Postgres does not support any SQL operations between
databases.  It may someday in the future, but then again it may not
(it's a design philosophy issue, I believe).

I don't know of *any* RDBMS that allows foriegn keys between databases!
If referential integrity is your goal, why on earth is the related data
in two different databases?

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco

Attachment

Re: Cross database foreign keys

From
Peter Eisentraut
Date:
Morgan Curley writes:

> Does anyone know if it is possible to connect to a differernt db from
> within a plsql function.
> I have multilple inter-related schemas and want to enforce some fk
> relationships.

Not possible

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter