Re: DELETING then INSERTING record with same PK in the same TRANSACTION

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: DELETING then INSERTING record with same PK in the same TRANSACTION
Дата
Msg-id f4b2ad22-3b3c-e87c-a1d0-93643d0aaf3a@gmx.net
обсуждение исходный текст
Ответ на Re: DELETING then INSERTING record with same PK in the same TRANSACTION  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: DELETING then INSERTING record with same PK in the same TRANSACTION  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: Re: DELETING then INSERTING record with same PK in the same TRANSACTION
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: DELETING then INSERTING record with same PK in the same TRANSACTION