Re: Add force option to dropdb

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add force option to dropdb
Date: 2014-01-31 15:47:09
Message-ID: CA+Tgmob2_t3o1=sD36YP414tpKWoqyE2HVHp-gC7nzWUiFxLdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 31, 2014 at 9:09 AM, salah jubeh <s_jubeh(at)yahoo(dot)com> wrote:
>>$ createdb -U postgres hoge
>>$ psql -d hoge -U postgres
>>hoge=# create table test (col text);
>>hoge=# insert into test select repeat(chr(code),10000) from
>>generate_series(1,100000) code;
>
>><Execute dropdb -k while the client is inserting many tuples into database>
>>$ dropdb -k hoge
>>2014-01-29 23:10:49 JST FATAL: terminating connection due to
>>administrator command
>>2014-01-29 23:10:49 JST STATEMENT: insert into test select
>>repeat(chr(code),10000) from generate_series(1,2000000) code;
>>2014-01-29 23:10:54 JST ERROR: database "hoge" is being accessed by other
>> users
>>2014-01-29 23:10:54 JST DETAIL: There is 1 other session using the
>> database.
>>2014-01-29 23:10:54 JST STATEMENT: DROP DATABASE hoge;
>
>>2014-01-29 23:10:54 JST ERROR: syntax error at or near ""hoge"" at
>> character 41
>>2014-01-29 23:10:54 JST STATEMENT: UPDATE pg_database SET
>>datconnlimit = e "hoge" is being accessed by other users WHERE
>>datname= 'hoge';
>>dropdb: database removal failed: ERROR: syntax error at or near ""hoge""
>>LINE 1: UPDATE pg_database SET datconnlimit = e "hoge" is being acce...
> ^
>>hoge=# \l
>> List of databases
>> Name | Owner | Encoding | Collate | Ctype | Access privileges
>>-----------+----------+----------+---------+-------+-----------------------
>>hoge | postgres | UTF8 | C | C |
>>postgres | postgres | UTF8 | C | C |
>>template0 | postgres | UTF8 | C | C | =c/postgres +
>> | | | | | postgres=CTc/postgres
>>template1 | postgres | UTF8 | C | C | =c/postgres +
>> | | | | | postgres=CTc/postgres
>
>>hoge database is not dropped yet.
>>Is this the bug? or not?
>
> It is a bug, sorry for doubling your work. I have updated the patch.

In case it wasn't clear before, I think that a client-side hack like
this has zero chance of being acceptable to the community, and we
should mark this patch rejected. I'm not saying it couldn't be useful
to someone, but the scripts are intended to be thin wrappers around
the underlying database functionality, and I think this is straying
too far from that core mission.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2014-01-31 15:47:12 Re: Recovery inconsistencies, standby much larger than primary
Previous Message Tom Lane 2014-01-31 15:47:06 Re: Recovery inconsistencies, standby much larger than primary