Skip site navigation (1) Skip section navigation (2)

Re: Deadlock on the same object?

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Deadlock on the same object?
Date: 2009-11-12 00:10:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> I think this is an artifact of the fact that SQL functions parse the
> whole querystring before executing any of it.  Parsing of "DELETE FROM
> a" will result in acquiring ROW EXCLUSIVE lock on a, and then when the
> LOCK commands are executed, you have a lock-upgrade scenario and the
> deadlock is unsurprising.

Thanks. It's a surprise for me :-).

> There was some discussion of changing that awhile ago, but I forget
> what the conclusion was.  In any case nothing's been done about it.

We cannot make a package of locking controls in a function under
the current behavior. It would be good to improve this area.

ITAGAKI Takahiro
NTT Open Source Software Center

In response to

pgsql-hackers by date

Next:From: Joachim WielandDate: 2009-11-12 00:25:00
Subject: Re: Listen / Notify rewrite
Previous:From: Andrew ChernowDate: 2009-11-12 00:04:28
Subject: Re: Listen / Notify rewrite

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group