Thread: Select from another database ´....best Way!

Select from another database ´....best Way!

From
"Miguel Carvalho"
Date:
Hello,

As far as i know, PostgreSQL doesn't support this feature, so i must do it
by another way.

I need to make a query that will verify if a given element exists in a
table from another database, to implement a foreign key like validation.
The query will be run througth an external script ( PHP ).

A graphical view of the problem:
---------------------------------

    ( database 1 )         ( database 2 )
  ---------------         ----------------
  |              |        |              |
  | TABLE A      |<------>| TABLE B      |
  |              |        |              |
  ---------------         ----------------


I'd like to hear your opinion on the following solutions:

   - Have all the tables( from the 2 databases ) in a unique database, and
     use a foreign key constraint.

   - Have 2 independent databases. When an insert has to be done, i will
     verify if the element exists( other database ). If so i will continue
     and commit the transaction. If not i will report the error and
     roolback the transaction.

Does PostgreSQL will support this feature soon?

Miguel Carvalho