Обсуждение: pgsql: Fix pg_dump's handling of DROP DATABASE commands in --clean mode

Поиск
Список
Период
Сортировка

pgsql: Fix pg_dump's handling of DROP DATABASE commands in --clean mode

От
Tom Lane
Дата:
Fix pg_dump's handling of DROP DATABASE commands in --clean mode.

In commit 4317e0246c645f60c39e6572644cff1cb03b4c65, I accidentally broke
this behavior while rearranging code to ensure that --create wouldn't
affect whether a DATABASE entry gets put into archive-format output.
Thus, 9.2 would issue a DROP DATABASE command in --clean mode, which is
either useless or dangerous depending on the usage scenario.
It should not do that, and no longer does.

A bright spot is that this refactoring makes it easy to allow the
combination of --clean and --create to work sensibly, ie, emit DROP
DATABASE then CREATE DATABASE before reconnecting.  Ordinarily we'd
consider that a feature addition and not back-patch it, but it seems
silly to not include the extra couple of lines required in the 9.2
version of the code.

Per report from Guillaume Lelarge, though this is slightly more extensive
than his proposed patch.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/edef20f6e1e7a02c65163f1054ce71db4d719aad

Modified Files
--------------
doc/src/sgml/ref/pg_dump.sgml        |    9 ++++++---
doc/src/sgml/ref/pg_restore.sgml     |   17 ++++++++++++-----
src/bin/pg_dump/pg_backup_archiver.c |   32 +++++++++++++++++++-------------
3 files changed, 37 insertions(+), 21 deletions(-)