Re: [GENERAL] PG 9.1 - FK + Check constraint

2017-07-18 Thread David G. Johnston
On Tue, Jul 18, 2017 at 6:56 PM, Patrick B wrote: > Another solution would be to create an IMMUTABLE functiondoing the check > and use that in a CHECK constraint [1]. > Why do you need an FK constraint? Why can you not use a data modification trigger? Placing the subquery within a mis-defined i

[GENERAL] PG 9.1 - FK + Check constraint

2017-07-18 Thread Patrick B
Hi guys! The column ent_id bigint on table table1 refers to other tables. if ent_id = 1 then = table2.idif ent_id = 2 then = table3.idelse = no checks I need a FK Constraint on table table1 checking if records on table2.id and table3.idexists. I know that currently, CHECK expressions cannot con