9.3 reference constraint regression - Mailing list pgsql-hackers

From Daniel Wood
Subject 9.3 reference constraint regression
Date
Msg-id CAPweHKe5QQ1747X2c0tA=5zf4YnS2xcvGf13Opd-1Mq24rF1cQ@mail.gmail.com
Whole thread Raw
Responses Re: 9.3 reference constraint regression
List pgsql-hackers
In 9.3 I can delete the parent of a parent-child relation if the child row is an uncommitted insert and I first update the parent.

USER1:
drop table child;
drop table parent;
create table parent (i int, c char(3));
create unique index parent_idx on parent (i);
insert into parent values (1, 'AAA');
create table child (i int references parent(i));


USER2:
BEGIN;
insert into child values (1);


USER1:
BEGIN;
update parent set c=lower(c);
delete from parent;
COMMIT;

USER2:
COMMIT;

Note that the problem also happens if the update is "set i=i".  I was expecting this update to block as the UPDATE is on a "unique index" "that can be used in a foreign key".  The "i=i" update should get a UPDATE lock and not a "NO KEY UPDATE" lock as I believe the c=... update does.

pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: ANALYZE sampling is too good
Next
From: Peter Geoghegan
Date:
Subject: Re: autovacuum_work_mem