From: | salah jubeh <s_jubeh(at)yahoo(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(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 14:09:42 |
Message-ID: | 1391177382.72214.YahooMailNeo@web164806.mail.gq1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>$ 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.
Regards
On Wednesday, January 29, 2014 8:50 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
On Wed, Jan 29, 2014 at 4:56 AM, salah jubeh <s_jubeh(at)yahoo(dot)com> wrote:
>>I'm not particularly in favor of implementing this as client-side
>>functionality, because then it's only available to people who use that
>>particular client. Simon Riggs proposed a server-side option to the
>>DROP DATABASE command some time ago, and I think that might be the way
>>to go.
>
> Could you please direct me -if possible- to the thread. I think,implementing
> it on the client side gives the user the some visibility and control.
> Initially, I wanted to force drop the database, then I have changed it to
> kill connections. I think the change in the client tool, is simple and
> covers the main reason for not being able to drop a database. I think,
> killing client connection is one of the FAQs.
>
> OTOH, having an option like "DROP DATABASE [IF EXISTS, FORCE] database" is
> more crisp. However, what does "force" mean? many options exist such as
> killing the connections gently, waiting for connections to terminate,
> killing connections immediately. Also, as Alvaro Herrera mentioned, DROP
> OWNED BY and/or REASSIGNED OWNED BY might hinder the force option -an
> example here would be nice-. So, for quick wins, I prefer the kill option in
> the client side; but, for mature solution , certainly back-end is the way to
> proceed.
http://www.postgresql.org/message-id/1296552979.1779.8622.camel@ebony
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachment | Content-Type | Size |
---|---|---|
dropdb.patch | text/x-patch | 4.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-01-31 14:10:11 | Re: Prohibit row-security + inheritance in 9.4? |
Previous Message | Robert Haas | 2014-01-31 13:58:21 | Re: updated emacs configuration |