Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: d(dot)koval(at)postgrespro(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
Date: 2024-06-07 08:58:43
Message-ID: CAApHDvqOkfS23ds1r_Sk3Za0TRGS8XYOy3rdyeZvarQ6=T6tMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, 7 Jun 2024 at 20:35, PG Bug reporting form
<noreply(at)postgresql(dot)org> wrote:
> The main question: is the "deadlock detected" error (1) correct?
> (I.e. is it necessary to look for the reason for this behavior?)

Looks like a fairly standard lock upgrade problem to me.

s1: create table t ();
s1: begin;
s2: begin;
s1: lock table t in access share mode;
s2: lock table t in access share mode;
s1: lock table t in access exclusive mode;
s2: lock table t in access exclusive mode; -- deadlock

Isn't this more or less the same as what's going on in your scenario?

David

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2024-06-07 09:02:47 Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
Previous Message Dmitry Koval 2024-06-07 08:47:02 Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?