Re: Add option --drop-cascade for pg_dump/restore - Mailing list pgsql-hackers

From Wu Haotian
Subject Re: Add option --drop-cascade for pg_dump/restore
Date
Msg-id CADHB_-BURg8XXZ_XvO5UzN2WMBPpDcQ0QdJaMaXb_Mx8DO3Xag@mail.gmail.com
Whole thread Raw
In response to Re: Add option --drop-cascade for pg_dump/restore  (Greg Sabino Mullane <htamfids@gmail.com>)
List pgsql-hackers
On Tue, Aug 10, 2021 at 10:57 PM Greg Sabino Mullane <htamfids@gmail.com> wrote:
>
> On Fri, Jul 16, 2021 at 9:40 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>> That would require pg_restore to try to edit the DROP commands during
>> restore, which sounds horribly fragile.  I'm inclined to think that
>> supporting this option only during initial dump is safer.
>
>
> Safer, but not nearly as useful. Maybe see what the OP (Wu Haotian) can come up with as a first implementation?
>
> Cheers,
> Greg
>

pg_restore already tries to edit the DROP commands during restore in
order to support `--if-exists`.

> supporting this option only during initial dump is safer.

pg_dump & pg_restores use the same function to inject `IF EXISTS` (
and `DROP .. CASCADE` in this patch`).
Supporting this option only during pg_dump may not make it safer, as
the logic is the same.



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Postgres perl module namespace
Next
From: "孙诗浩(思才)"
Date:
Subject: use-regular-expressions-to-simplify-less_greater-and-not_equals.patch