Re: Deadlock bug

Kevin Grittner <kevin.grittner@wicourts.gov>

From: "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
To: "Joel Jacobson" <joel@gluefinance.com>, "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: "Magnus Hagander" <magnus@hagander.net>,<glue@pgexperts.com>, <pgsql-hackers@postgresql.org>
Date: 2010-08-20T14:29:18Z
Lists: pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
> You didn't tell us exactly what the FK relationship is
 
The original post has an attachment with a self-contained example,
starting with table creation.
 
> I suspect the reason for the deadlock is that one process is
> trying to update a row that references some row already updated by
> the other.
 
The surprising thing is that a particular row is (using the
identifiers from the attachment):
 
Process 2 updates a particular row without blocking.
Process 1 updates the same row, which blocks.
Process 2 updates the same row again (with *exactly* the same UPDATE
statement), which fails with a deadlock.
 
I'm not sure I consider that a bug, but it moves the needle on the
astonishment meter.
 
-Kevin