I work with two databases in PostgreSQL 9.1, say A and B, one per application. Database B needs to read (and not write into) one table in database A (say users), but at the same time some tables from database B need to reference some of their fields as foreign keys on table users.
So far I've tried:
Finding some kind of native table-level replication, so any change on users is automatically replicated to the clone table in database B. Didn't find anything.
TRIGGERon table users so after any change a function is called, but that doesn't solve anything since I can't insert values from database A into database B's tables.
FOREIGN TABLEs. Neither solves it, since no foreign keys may be applied to foreign tables.
DATABASEfor A, but application enforces it to be a database.
I've even thought about a CRON each minute which would dump and import the table from A to B, but that would break any foreign key relationship with other tables.
I can't combine the two databases in one (although technically both have uniquely named tables), because when upgrading one of them it checks the database and should anything weird be in it, it would fail.
Do I have any other chances here? Any hint is very appreciated.