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

From: Evan Martin <postgresql(at)realityexists(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Please make it easy to drop a database that is in use
Date: 2012-06-21 14:50:07
Message-ID: 4FE3349F.7040604@realityexists.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 22/06/2012 12:07 AM, Tom Lane wrote:
>> SELECT pg_terminate_backend(procpid)
>> FROM pg_stat_activity
>> WHERE datname = 'dropme';
>> ERROR: must be superuser to signal other server processes
> As far as that goes, there's a pending patch to reduce the privileges
> required to use pg_terminate_backend. I'm not in favor of having DROP
> DATABASE do it for you though --- that just seems like a very
> large-caliber foot gun.
>
Good to hear there's a patch coming for that. Just to be clear, I'm not
suggesting DROP DATABASE should do that by default. Basically, I'm
looking for the "--force" option here - a way to say "I know what I'm
doing, just drop this database if at all possible".

"rm -rf" is a foot gun, too, but if that -f wasn't there you would have
to write commands to set permissions on files when you couldn't care
less about the permissions and just want to delete them. Sure, a
competent Linux user could write such a command, but imagine how
annoying it would be to do that all the time! Not to mention the extra
room for errors in that command. To me, DROP DATABASE is a very similar
case.

Regards,

Evan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Pirotte 2012-06-21 15:10:28 Promoting sync slave to master without incrementing timeline counter?
Previous Message Marc Mamin 2012-06-21 14:17:01 (BUG ?) unprefixed oid -> ERROR: cache lookup failed for function