Mario Splivalo <mario.spliv...@megafon.hr> writes:
> I have two tables, tableA and tableB:
> CREATE TABLE tableA (idA integer primary key, email character varying
> unique);
> CREATE TABLE tableB (idB integer primary key, email character varying
> unique);

> Now, I want to create check constraint in both tables that would
> disallow records to either table where email is 'mentioned' in other table.

Have you considered refactoring so there's only one table?

Cross-table constraints are a really bad idea unless you can express
them as foreign keys.  There's a lot of "secret sauce" in the FK
mechanism that isn't available to user-written constraints.

                        regards, tom lane

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to