Add force option to dropdb

From: salah jubeh <s_jubeh(at)yahoo(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Add force option to dropdb
Date: 2014-01-14 18:53:27
Message-ID: 1389725607.27627.YahooMailNeo@web122206.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

3. Should I write two patches one for pg_version>=9.2 and one for pg_version<9.2 

Regards

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-01-14 18:54:55 Re: shared memory message queues
Previous Message Jan Kara 2014-01-14 18:52:43 Re: [Lsf-pc] Linux kernel impact on PostgreSQL performance