On 5/24/14, 8:14 AM, Tom Lane wrote:
Vik Fearing<vik.fear...@dalibo.com>  writes:
>On 05/24/2014 12:03 AM, Jaime Casanova wrote:
>>Which lead us to the question: you need to connect to the database to
>>modify it, don't you? then, how do you change ALLOW CONNECTIONS to
>>true?
>You can ALTER DATABASE from anywhere.
Perhaps it'd be wise to have a safety check to disallow turning off
datallowconn for the last connectable database?  Although it couldn't be
bulletproof due to race conditions, so maybe that'd just be nannyism.
(If you do shoot yourself in the foot that way, I think we ignore
datallowconn in standalone mode.)

I think this is nannyism that would be well placed. Most people don't know 
about standalone, and I don't think we want to change that.

BTW, I think the race condition could be eliminated if we did something like 
(forgive the user-space semantics):

SELECT datallowconn FROM pg_database WHERE datallowconn AND datname <> 
$$database we're disallowing connections on$$ LIMIT 1 FOR UPDATE;

If you don't get a record back from that you abort; meanwhile no one else can 
disallow connections on that database until you commit or rollback.
--
Jim C. Nasby, Data Architect                       j...@nasby.net
512.569.9461 (cell)                         http://jim.nasby.net


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to