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

From David Rowley
Subject Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
Date
Msg-id CAApHDvqOkfS23ds1r_Sk3Za0TRGS8XYOy3rdyeZvarQ6=T6tMQ@mail.gmail.com
Whole thread Raw
In response to BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
List pgsql-bugs
On Fri, 7 Jun 2024 at 20:35, PG Bug reporting form
<noreply@postgresql.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



pgsql-bugs by date:

Previous
From: Dmitry Koval
Date:
Subject: Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?
Next
From: David Rowley
Date:
Subject: Re: BUG #18498: Locking a table from a trigger (with using two sessions) causes a deadlock: the bug or the feature?