deadlock

From: Alexey Nalbat <nalbat(at)price(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Cc: developers(at)price(dot)ru
Subject: deadlock
Date: 2007-04-09 09:24:04
Message-ID: 200704091324.05033.nalbat@price.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello.

I've encountered deadlock on postgresql 8.1. Here is the simple example.

create table t1 (
id1 integer primary key,
val1 integer
);
create table t2 (
id2 integer primary key,
id1 integer references t1 on delete cascade,
val1 integer,
val2 integer,
val3 integer
);
insert into t1 select
generate_series(1,10) as id1;
insert into t2 select
generate_series(1,100) as id2,
generate_series(1,10) as id1;

Then three concurrent transaction start.

/*1*/ begin;
/*1*/ update t2 set val1=1 where id2=50;
/*1*/ update t2 set val2=2 where id2=50;
/*2*/ begin;
/*2*/ update t2 set val1=1 where id2=40;
/*2*/ update t2 set val2=2 where id2=40;
/*2*/ commit;
/*3*/ begin;
/*3*/ update t1 set val1=1 where id1=10;
/*1*/ update t2 set val3=3 where id2=50;

Here we have deadlock for transactions 1 and 3.

Is it bug? And if so, will it be fixed?

Or is it not a bug? What should I do then?

Thank you. Sorry for bad english.

--
Alexey A. Nalbat

Price Express
http://www.price.ru/
http://www.tyndex.ru/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message samı 2007-04-09 09:24:11 plperl "set-valued function" problem
Previous Message Poul Møller Hansen 2007-04-09 08:54:47 Unable to get a database connection while deleting rows