Re: lock level for DETACH PARTITION looks sketchy - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: lock level for DETACH PARTITION looks sketchy
Date
Msg-id 20181220210710.276yp67wqb5gf5zt@alvherre.pgsql
Whole thread Raw
In response to Re: lock level for DETACH PARTITION looks sketchy  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: lock level for DETACH PARTITION looks sketchy  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
List pgsql-hackers
On 2018-Dec-20, Robert Haas wrote:

> On Thu, Dec 20, 2018 at 3:58 PM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> > I think what prompted the lock to be AccessShareLock for the child rel
> > in the first place is the fact that ATExecDropInherit() (ALTER TABLE NO
> > INHERIT) uses AccessShare for the *parent* relation.
> 
> Seems like apples and oranges, 

Yes, but I can understand someone looking at ATExecDropInherit while
writing ATExecDetachRelation and thinking "ah, I have to grab
AccessShareLock on the other relation" without stopping to think in what
direction the parenthood between the rels goes.

> and also maybe not that safe.

I think it's strange, but I'm not interested in analyzing that at this
time.  Its comment do say that DROP TABLE (of the child, I surmise) does
not acquire *any* lock on the parent, which is also strange.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: ATTACH/DETACH PARTITION CONCURRENTLY
Next
From: Alvaro Herrera
Date:
Subject: Re: ATTACH/DETACH PARTITION CONCURRENTLY