drop table if exists pt, c1, c2; create table pt (id int primary key); create table c1 (id int primary key, ref int references pt deferrable initially deferred); create table c2 (id int primary key, ref int references pt deferrable initially deferred); insert into pt values(11); insert into c1 values(1, 11); insert into c2 values(2, 11); update pt set id = 12 where id = 11; -- fails with u1 as ( update c1 set ref = 12 where ref = 11 ) update pt set id = 12 where id = 11; -- fails with u1 as ( update c1 set ref = 12 where ref = 11 ), u2 as ( update c2 set ref = 12 where ref = 11 ) update pt set id = 12 where id = 11; -- ok