On Tue, Jan 28, 2014 at 11:01 PM, salah jubeh <s_ju...@yahoo.com> wrote: > Hello Sawada, > >>- This patch is not patched to master branch > Sorry, My mistake >>//new connections are not allowed > Corrected. > > I hope now the patch in better state, if somthing left, I will be glad to > fix it > Regards > > > On Tuesday, January 28, 2014 4:17 AM, Sawada Masahiko > <sawada.m...@gmail.com> wrote: > On 2014年1月17日 0:56, salah jubeh <s_ju...@yahoo.com> wrote: >> >>>If the user owns objects, that will prevent this from working also. I >>>have the feeling that adding DROP OWNED BY and/or REASSIGNED OWNED BY >>>calls to this utility would be a bit excessive, but who knows. >> >> Please find attached the first attempt to drop drop the client >> connections. >> I have added an option -k, --kill instead of force since killing client >> connection does not guarantee -drop force-. >> Regards >> >> >> On Tuesday, January 14, 2014 8:06 PM, Alvaro Herrera >> <alvhe...@2ndquadrant.com> wrote: >> salah jubeh wrote: >> >>> For the sake of completeness: >>> 1. I think also, I need also to temporary disallow conecting to the >>> database, is that right? >>> 2. Is there other factors can hinder dropping database? >> >> If the user owns objects, that will prevent this from working also. I >> have the feeling that adding DROP OWNED BY and/or REASSIGNED OWNED BY >> calls to this utility would be a bit excessive, but who knows. >> >> >>> 3. Should I write two patches one for pg_version>=9.2 and one for >>> pg_version<9.2 >> >> >> No point -- nothing gets applied to branches older than current >> development anyway. >> > > Thank you for the patch. > And sorry for delay in reviewing. > > I started to look this patch, So the following is first review comment. > > - This patch is not patched to master branch > I tried to patch this patch file to master branch, but I got following > error. > $ cd postgresql > $ patch -d. -p1 < ../dropdb.patch > can't find fiel to patch at input line 3 > Perhaps you used the wrong -p or --strip option? > the text leading up to this was: > ------------------------------ > |--- dropdb_org.c 2014-01-16 > |+++ dropdb.c 2014-01-16 > ------------------------------ > > There is not dropdb_org.c. I think that you made mistake when the > patch is created. > > - This patch is not according the coding rule > For example, line 71 of the patch: > //new connections are not allowed > It should be: > /* new connections are not allowed */ > (Comment blocks that need specific line breaks should be formatted as > block comments, where the comment starts as /*------.) > Please refer to coding rule. > <http://wiki.postgresql.org/wiki/Developer_FAQ#What.27s_the_formatting_style_used_in_PostgreSQL_source_code.3F> > >
Thank you for updating patch! It did not works fine with following case. --- $ 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? Regards, ------- Sawada Masahiko -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers