pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Mello <alien@spaceship.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: "deadlock detected" documentation
Date: Fri, 16 May 2003 15:13:48 -0400
Message-ID: <28936.1053112428@sss.pgh.pa.us> (raw)
In-Reply-To: <3EC50CEB.9080202@spaceship.com>
References: <3EB82DA1.7020809@spaceship.com>
	<24809.1052282819@sss.pgh.pa.us>
	<3EC32935.5040005@spaceship.com>
	<7737.1053003625@sss.pgh.pa.us>
	<3EC3C239.7070708@spaceship.com>
	<10096.1053017383@sss.pgh.pa.us>
	<3EC3C77A.3010006@spaceship.com>
	<10286.1053018824@sss.pgh.pa.us>
	<3EC3E53C.9070800@spaceship.com>
	<3EC50CEB.9080202@spaceship.com>

Matt Mello <alien@spaceship.com> writes:
> The two situations I can think of are:
> 1) Two FK fields in a single row pointing to 2 different FK tables, for 
> which any 2 updates get locks in opposite order (seems like a deadlock).

I don't think this is possible, at least in 7.3.  All backends are
guaranteed to run the triggers of a given table in the same order,
so the foreign-row locks should be acquired in the same column order
in all cases.

> 2) Two FK fields pointing to only 1 FK table (both fields are references 
> to the same table), for which each update gets independent locks instead 
> of one lock for both fields, so there is a potential that #1 problem 
> could impact this as well.

Not clear what you mean by "independent locks"; there is only one row
lock on a row.

The cases that I'd be concerned about are not within-row conflicts, but
multi-row conflicts...

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <28936.1053112428@sss.pgh.pa.us>
Permalink:  ../28936.1053112428@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28936.1053112428@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alien@spaceship.com
  Subject: Re: "deadlock detected" documentation
  In-Reply-To: <28936.1053112428@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox