Re: deadlock detected during insert

From: "A(dot)Bhuvaneswaran" <bhuvansql(at)myrealbox(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: deadlock detected during insert
Date: 2003-03-08 04:59:00
Message-ID: Pine.LNX.4.44.0303081027200.1045-100000@Bhuvan.bksys.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


> > Can you able to give some test cases? Here i have tried, but unable to
> > detect deadlock.
>
> Not a complete or tested example, but:
> create table a (a int primary key);
> create table b ( b int references a);
> insert into a values (1);
> insert into a values (2);
> Transaction 1: begin;
> Transaction 2: begin;
> Transaction 1: insert into b values (1);
> Transaction 2: insert into b values (2);
> Transaction 1: insert into b values (2);
> Transaction 2: insert into b values (1);
>
> - This really shouldn't be a deadlock, but given the locking level the
> foreign keys currently use I'm pretty sure it'd cause one.

It shouldn't be, but it is detected. But i am able to eliminate it using
the lock in share row exclusive mode. Am i right using this lock?

regards,
bhuvaneswaran

> > BTW, do we have any link about deadlock detection during insert command as
> > we have for update command?
>
> Not sure really.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message SBSD PgAdmin 2003-03-08 14:27:39 dump / restore problem with large objects
Previous Message Bruce Momjian 2003-03-07 20:25:19 Re: Querying multiple databases...