Add force option to dropdb
От
salah jubeh
Тема
Add force option to dropdb
Дата
Msg-id
1389725607.27627.YahooMailNeo@web122206.mail.ne1.yahoo.com
Список
Дерево обсуждения
Add force option to dropdb salah jubeh <s_jubeh@yahoo.com>
Re: Add force option to dropdb Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Add force option to dropdb salah jubeh <s_jubeh@yahoo.com>
Re: Add force option to dropdb Sawada Masahiko <sawada.mshk@gmail.com>
Re: Add force option to dropdb salah jubeh <s_jubeh@yahoo.com>
Re: Add force option to dropdb Robert Haas <robertmhaas@gmail.com>
Re: Add force option to dropdb salah jubeh <s_jubeh@yahoo.com>
Re: Add force option to dropdb Robert Haas <robertmhaas@gmail.com>
Re: Add force option to dropdb salah jubeh <s_jubeh@yahoo.com>
Re: Add force option to dropdb Robert Haas <robertmhaas@gmail.com>
Re: Add force option to dropdb salah jubeh <s_jubeh@yahoo.com>
Re: Add force option to dropdb Sawada Masahiko <sawada.mshk@gmail.com>
Hello,
I think adding a force option to dropdb is usefull for many purposes, mainly; scripting. For example, in a test enviroment, I restore a daily backup of production databases. The newly created databases are used as templates for development and also for reading, thus replacing them is completly safe.
I uses dropdb and pg_terminate_backend for this purpose, since some users might forget to close connections.
I have had a look on dropdb.c and I have amended the code to also terminate client connections using pg_terminate_backend
So the functionallity of the dropdb if force option is used is as follows:
1. Terminate client connections using pg_terminate_backend
2. Drop the database
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?
I think adding a force option to dropdb is usefull for many purposes, mainly; scripting. For example, in a test enviroment, I restore a daily backup of production databases. The newly created databases are used as templates for development and also for reading, thus replacing them is completly safe.
I uses dropdb and pg_terminate_backend for this purpose, since some users might forget to close connections.
I have had a look on dropdb.c and I have amended the code to also terminate client connections using pg_terminate_backend
So the functionallity of the dropdb if force option is used is as follows:
1. Terminate client connections using pg_terminate_backend
2. Drop the database
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?
3. Should I write two patches one for pg_version>=9.2 and one for pg_version<9.2
Regards
В списке pgsql-hackers по дате отправления