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

From: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Brent Wood <Brent(dot)Wood(at)niwa(dot)co(dot)nz>, Andrew Hardy <andrew(dot)hardy(at)sabstt(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: DELETING then INSERTING record with same PK in the same TRANSACTION
Date: 2022-02-09 21:20:49
Message-ID: 2001A55F-C2D4-4B82-A680-632ABC550019@yugabyte.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> david(dot)g(dot)johnston(at)gmail(dot)com wrote:
>
> The convention on these lists is to inline or bottom post (and to trim the reply to just the pertinent parts).

Just for completeness, I expected this test to run without error. (I tried it in PG Version 14.1).

create table t(k int primary key, v text not null);
insert into t(k, v) values (1, 'one'), (2, 'two');
select k, v from t order by k;

start transaction;
delete from t where k = 1;
insert into t(k, v) values(1, 'new one');
commit;

select k, v from t order by k;

Indeed it did run without error. And I saw the results that I expected.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2022-02-09 21:24:14 Re: DELETING then INSERTING record with same PK in the same TRANSACTION
Previous Message David G. Johnston 2022-02-09 20:47:26 Re: DELETING then INSERTING record with same PK in the same TRANSACTION