Vincent Veyron wrote: > use a trigger on each of the derived tables, that cancels any insert if > the same id already exists in the other table? Yes, that would work. > You don't say how your data gets inserted, but considering how > complicated your preferred option looks, I have to ask why you can't > use something as simple as : [...] > You'll have to build the queries according to the value of type, but > this should give you the features you mention? Sure, this is what I meant when I said that you could simply omit the type field. However, if you still want the guarantee about not having two derived rows for the same base row, you'll have to use a trigger function. The whole point of the exercise is to avoid that trigger function and replace it with a simple foreign key :-). It's ok, maybe it's not worth the trouble. Regards, -- Nils Gösche "Don't ask for whom the <CTRL-G> tolls." -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general