Re: dropdb --force

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Filip Rembiałkowski <filip.rembialkowski@gmail.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2018-12-18T15:19:41Z
Lists: pgsql-hackers

Attachments

Hi

út 18. 12. 2018 v 16:11 odesílatel Filip Rembiałkowski <
filip.rembialkowski@gmail.com> napsal:

> Hi,
>
> I propose a simple patch (works-for-me), which adds --force (-f)
> option to dropdb utility.
>
> Pros:  This seems to be a desired option for many sysadmins, as this
> thread proves:
> https://dba.stackexchange.com/questions/11893/force-drop-db-while-others-may-be-connected
> Cons: another possible foot-gun for the unwary.
>
> Obviously this patch needs some more work (see TODO note inside).
>
> Please share opinions if this makes sense at all, and has any chance
> going upstream.
>
> The regression tests is simplistic, please help with an example of
> multi-session test so I can follow.
>

Still one my customer use a patch that implement FORCE on SQL level. It is
necessary under higher load when is not easy to synchronize clients.

Regards

Pavel

>
>
> Thanks,
> Filip
>

Commits

  1. Add tests for '-f' option in dropdb utility.

  2. Move pump_until to TestLib.pm.

  3. Add the support for '-f' option in dropdb utility.

  4. Introduce the 'force' option for the Drop Database command.

  5. Improve CREATE/DROP/RENAME DATABASE so that when failing because the source