Deferrable check constraint in PostgreSQL
问题 I have function checking mandatory participation as follows: CREATE FUNCTION member_in_has_address() RETURNS BOOLEAN AS $$ BEGIN RETURN EXISTS (SELECT * FROM address a, member_details b WHERE b.member_id = a.member_id); END; $$ LANGUAGE plpgsql; Then called from CHECK constraint ALTER TABLE member_details ADD CONSTRAINT member_in_has_address_check CHECK (member_in_has_address()); To create deferable constraint in Standard SQL it would be: ALTER TABLE member_details ADD CONSTRAINT member_in