Re: patch: option --if-exists for pg_dump

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Subject: Re: patch: option --if-exists for pg_dump
Date: 2014-02-28 22:35:01
Message-ID: CAFj8pRChqDDCkJdNNJmPSDez=mo2jFwhK6XBByWWUfuA7-UTAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This patch has redesigned implementation --if-exists for pg_dumpall. Now it
is not propagated to pg_dump, but used on pg_dumpall level.

Regards

Pavel

2014-02-28 23:18 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
>
> 2014-02-28 23:13 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
>
> Hi
>>
>>
>>> However, I don't think this is behaving sanely in pg_dumpall. AFAICT,
>>> pg_dumpall does not pass --clean to pg_dump (in other words it only
>>> emits DROP for the global objects, not the objects contained inside
>>> databases), so passing --if-exists results in failures. Therefore I
>>> think the solution is to not pass --if-exists to pg_dump at all, i.e.
>>> keep it internal to pg_dumpall. But maybe I'm missing something.
>>>
>>
>> I am looking to pg_dumpall code, and I am inclined to don't pass
>> --if-exists to pg_dump too.
>>
>> -c, --clean for pg_dumpall means "drop databases"
>>
>> <<<<<
>> Usage:
>> pg_dumpall [OPTION]...
>>
>> General options:
>> -f, --file=FILENAME output file name
>> -V, --version output version information, then exit
>> --lock-wait-timeout=TIMEOUT fail after waiting TIMEOUT for a table lock
>> -?, --help show this help, then exit
>>
>> Options controlling the output content:
>> -a, --data-only dump only the data, not the schema
>> -c, --clean clean (drop) databases before recreating
>> >>>>>
>>
>> so --if-exists should to mean
>>
>> DROP DATABASE IF EXISTS dbname
>>
>
> + DROP ROLE and DROP TABLESPACE
>
>
>>
>> do you agree?
>>
>> Pavel
>>
>
>

Attachment Content-Type Size
dump-restore-if-exists-opt-2014-02-28-2.patch text/x-patch 12.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christophe Pettus 2014-02-28 22:40:27 Re: jsonb and nested hstore
Previous Message Pavel Stehule 2014-02-28 22:18:51 Re: patch: option --if-exists for pg_dump