Re: Add force option to dropdb - Mailing list pgsql-hackers

From salah jubeh
Subject Re: Add force option to dropdb
Date
Msg-id 1391187501.46507.YahooMailNeo@web164805.mail.gq1.yahoo.com
Whole thread Raw
In response to Re: Add force option to dropdb  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hello Robert,
>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.

I think, you have a  good point here.
Regards


On Friday, January 31, 2014 4:47 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Fri, Jan 31, 2014 at 9:09 AM, salah jubeh <s_jubeh@yahoo.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: updated emacs configuration
Next
From: Bruce Momjian
Date:
Subject: Re: [bug fix] PITR corrupts the database cluster