Re: DELETING then INSERTING record with same PK in the same TRANSACTION - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: DELETING then INSERTING record with same PK in the same TRANSACTION
Date
Msg-id f4b2ad22-3b3c-e87c-a1d0-93643d0aaf3a@gmx.net
Whole thread Raw
In response to Re: DELETING then INSERTING record with same PK in the same TRANSACTION  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: DELETING then INSERTING record with same PK in the same TRANSACTION
List pgsql-general
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;




pgsql-general by date:

Previous
From: Bryn Llewellyn
Date:
Subject: Re: DELETING then INSERTING record with same PK in the same TRANSACTION
Next
From: "David G. Johnston"
Date:
Subject: Re: DELETING then INSERTING record with same PK in the same TRANSACTION