I have two tables that i want to link with a FK where the child table record is "active".
some googling shows that i could use a function and a check constraint on the function, but that only works for inserts, not updates on table b.
create table a (int id, text name);
create table b (int id, boolean active);
alter table a add column b_id integer;
-- how to do this?
alter table a add foreign key (b_id) references b(id) where b.active == true
help :).