David G. Johnston schrieb am 09.02.2022 um 21:47:
You cannot defer uniqueness checks to transaction commit so either it is going to fail on the insert or it will not fail at all.
You can defer unique constraints, but not primary key constraints. create table t ( id integer ); alter table t add constraint unique_id unique (id) deferrable initially deferred;