Hello pgsql-general,
I'd like to set up a foreign key constraint to a foreign table from a local
table.
ie, I have a column in a local table that I'd like to ensure has a value in
the foreign table.
alter mytable
add column some_column_id uuid references myforeigntable(some_column_id)
;
Thanks Will!
I had been considering setting up replication (using SymmetricDS - which we
already use between other databases in our environment), but decided for
this one check it was too much trouble. I may change my mind on that point
again after all if I end up with a lot of dependencies like
Rick Otten rottenwindf...@gmail.com writes:
Hello pgsql-general,
I'd like to set up a foreign key constraint to a foreign table from a local
table.
ie, I have a column in a local table that I'd like to ensure has a value in
the foreign table.
alter mytable
add column some_column_id
Hello Rick,
As I understand it you are correct. Oracle/DB2/Postgres and I think the SQL
Standards to not implement constraints against tables on foreign servers.
Although it would be possible to develop the DBMS to handle such
constraints in a heterogeneous distributed environment it would be
Obviously the server will be able to delete those rows because it will be
completely unaware of this dependency.
So it is the implied reverse constraint (of sorts) that can't be enforced
which makes an FK based definition impossible.
For my particular use case, this shouldn't be a problem. The