Re: Please make it easy to drop a database that is in use

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: Evan Martin <postgresql(at)realityexists(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Please make it easy to drop a database that is in use
Date: 2012-06-21 12:20:54
Message-ID: CAL_0b1v7bUOZBXh0C1LTGyybGpMtydjjcfC+U0roZ_cw1LEp9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 21, 2012 at 2:03 PM, Evan Martin
<postgresql(at)realityexists(dot)net> wrote:
> 1) The workaround requires extra work for each developer (or at least each
> client application) using PostgreSQL, while a fix in PostgreSQL would solve
> this once and for all.

It is not clean what database you need to reconnect automatically
after the dropping. Moreover you may not have permissions to connect
other databases.

> 2) The workaround requires superuser privileges, which I don't think should
> be required to drop your own database.

It does not require it. You might also be an owner to drop the database.

>
> Regards,
>
> Evan
>
>
> On 20/06/2012 10:51 PM, Sergey Konoplev wrote:
>>
>> On Tue, Jun 19, 2012 at 1:40 PM, Evan Martin
>> <postgresql(at)realityexists(dot)net> wrote:
>>>
>>> When I'm developing against a PostgreSQL database I often drop and
>>> re-create
>>> it and I often find that the drop fails, because it's "in use by other
>>> users". This is really annoying, especially when I know full well there
>>> are
>>> no other users - it's just me.
>>
>> Just connect another (say postgres) database and disconnect the
>> database you are trying to delete. And keep it in mind.
>>
>>> hassle, for something that should be a very simple operation. (I'm not
>>> even
>>> writing SQL for it normally, just pressing Delete in pgAdmin.) Secondly,
>>
>> So I think this proposal/issue should be sent not to PG development
>> team but to pgAdmin's one. Clients software should make all this
>> re-connections accordingly to its own rules.
>>
>>> pg_terminate_backend requires superuser rights. If I'm not a superuser,
>>> but
>>> I am the owner of the database, it doesn't seem right that another user
>>> should be able to prevent me from dropping my database.
>>>
>>> I'd really like to see PostgreSQL directly support dropping a database,
>>> regardless of who is using it - something like "DROP DATABASE ...
>>> CASCADE".
>>> (Although "CASCADE" wouldn't be the appropriate word here. Maybe "DROP
>>> DATABASE ... TO_HELL_WITH_USERS"?)
>>>
>>> Evan
>>
>>
>>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

--
Sergey Konoplev

a database and software architect
http://www.linkedin.com/in/grayhemp

Jabber: gray(dot)ru(at)gmail(dot)com Skype: gray-hemp Phone: +79160686204

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2012-06-21 12:26:05 Re: Reading storage parameters
Previous Message Daniele Varrazzo 2012-06-21 12:12:58 Reading storage parameters