What is the best way to represent mandatory participation in Postgres? I used to do it with CHECK constraint or with INSERT and DELETE TRIGGER in Sybase. Postgres does not support subqueries in CHECK constraint and I cannot get triggers right.
I would like to find alternative to the following:
ALTER TABLE member
ADD CONSTRAINT member_in_has_address
CHECK (EXISTS (SELECT *
FROM address a
WHERE member_id = a.member_id));