Re: Strange locking choices in pg_shdepend.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Strange locking choices in pg_shdepend.c
Date
Msg-id 21626.1200956790@sss.pgh.pa.us
Whole thread Raw
In response to Re: Strange locking choices in pg_shdepend.c  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Strange locking choices in pg_shdepend.c
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane wrote:
>> Why does shdepDropOwned() take AccessExclusiveLock on pg_shdepend?

> Hmm, I can't recall nor deduce any reason for that.  Perhaps the
> intention was to protect against itself; but I think this should only
> matter if we're dropping the same role concurrently (otherwise the
> to-be-dropped objects would be disjoint sets, so it doesn't matter),
> which should be already protected by the lock on the role itself.

> Hmm, unless revoking privileges concurrently, for two different users on
> the same object could cause a problem?  I don't see us grabbing a lock
> on the object itself -- does this matter?

Well, if there is any such problem then it could be triggered by two
independent plain-ol-REVOKE commands, so I still don't see an argument
why shdepDropOwned is more at risk than anything else.  I think we
should just downgrade the lock.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] setof record "out" syntax and returning records
Next
From: Larry Rosenman
Date:
Subject: Makefile support for Mac OS X Fat Binaries?