Re: LOCK DATABASE - Mailing list pgsql-hackers

From Robert Haas
Subject Re: LOCK DATABASE
Date
Msg-id BANLkTimxJnboQjMQw=c-+D0aNswEDFXgQA@mail.gmail.com
Whole thread Raw
In response to Re: LOCK DATABASE  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: LOCK DATABASE  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
On Thu, May 19, 2011 at 1:48 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
>> I can't see getting rid of that lock, since we'd simply have to invent
>> some other interlock for new connections vs. DROP DATABASE.  However,
>> I do think that we might sometime need to convert it to a session lock
>> that's held for the life of the backend.  If this feature can't cope
>> with that, that'd be a potential problem.
>
> The following things acquire a lock on database:
>
>  ALTER DATABASE SET
>  ALTER DATABASE OWNER
>  COMMENT ON DATABASE
>
> So as far as features that would cause a problem if we ever decide to
> take a lock on database for the duration of the whole session, this
> isn't the first one.  We'd have to invent a fix for those other things
> anyway.

That's a bit of a self-defeating argument though, since it implies
that the effect of taking an exclusive lock via LockSharedObject()
will not simply prevent new backends from connecting, but rather will
also block any backends already in the database that try to perform
one of those operations.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: switch UNLOGGED to LOGGED
Next
From: Robert Haas
Date:
Subject: Re: switch UNLOGGED to LOGGED