Bug #539: Unexpected DeadLock on REFERENCES - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject Bug #539: Unexpected DeadLock on REFERENCES
Date
Msg-id 200112141000.fBEA0iu72479@postgresql.org
Whole thread Raw
Responses Re: Bug #539: Unexpected DeadLock on REFERENCES  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-bugs
Eugene Fokin (elf@solvo.ru) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Unexpected DeadLock on REFERENCES

Long Description
DeadLock happens when we're trying to concurrent update different
tables which chained with one table through REFERENCE.
See Example Code. Just perform the script and follow instructions
on the header.
This case have been checked on 7.1.3 version.


Sample Code
--
-- At first you should execute this script.
-- In two different sessions for one DB perform:
-- (1) begin transaction;
-- (2) begin transaction;
-- (1) update ref1 set d='R11110';
-- (2) update ref2 set d='R22220';
-- (1) update ref3 set d='R33330';
-- (2) update ref4 set d='R44440';
-- !!! Didn't you get DeadLock ?
--

create table prim(
        a1 char(1) default '1' unique,
        a2 char(1) default '2' unique,
        a3 char(1) default '3' unique
);

create table ref1(
        t1 char(1) references prim(a1),
        t3 char(1) references prim(a3),
        d varchar(10)
);

create table ref2(
        t2 char(1) references prim(a2),
        d varchar(10)
);

create table ref3(
        t1 char(1) references prim(a1),
        t2 char(1) references prim(a2),
        d varchar(10)
);

create table ref4(
        t1 char(1) references prim(a1),
        t3 char(1) references prim(a3),
        d varchar(10)
);

insert into prim (a1,a2,a3) values ('1','2','3');
insert into prim (a1,a2,a3) values ('4','5','6');

insert into ref1(t1,t3,d)values('1','3','R111');
insert into ref2(t2,d)values('5','R222');
insert into ref3(t1,t2,d)values('4','5','R333');
insert into ref4(t1,t3,d)values('1','3','R111');


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #538: Backend crasches
Next
From: "Roger"
Date:
Subject: Red Hat 7.2 Bug