Re: Add option --drop-cascade for pg_dump/restore

2021-12-01 Thread Daniel Gustafsson
> On 3 Nov 2021, at 20:03, Tom Lane wrote: > > Wu Haotian writes: >> here's the rebased patch. > > Looks like it needs rebasing again, probably as a result of our recent > renaming of our Perl test modules. As this patch hasn't been updated, I'm marking this entry Returned with Feedback.

Re: Add option --drop-cascade for pg_dump/restore

2021-11-03 Thread Tom Lane
Wu Haotian writes: > here's the rebased patch. Looks like it needs rebasing again, probably as a result of our recent renaming of our Perl test modules. FWIW, I'd strongly recommend that it's time to pull all that SQL code hacking out of RestoreArchive and put it in its own function.

Re: Add option --drop-cascade for pg_dump/restore

2021-09-08 Thread Wu Haotian
Hi, here's the rebased patch. 0005-pg_dump-restore-add-drop-cascade-option.patch Description: Binary data

Re: Add option --drop-cascade for pg_dump/restore

2021-09-01 Thread Daniel Gustafsson
> On 16 Aug 2021, at 08:35, Wu Haotian wrote: > > There are already documents for "--clean only works with plain text output", > so adding checks for --clean seems like a breaking change to me. > > I've updated the docs to indicate --drop-cascade and --if-exists only > works with plain text

Re: Add option --drop-cascade for pg_dump/restore

2021-08-16 Thread Wu Haotian
There are already documents for "--clean only works with plain text output", so adding checks for --clean seems like a breaking change to me. I've updated the docs to indicate --drop-cascade and --if-exists only works with plain text output. 0004-pg_dump-restore-add-drop-cascade-option.patch

Re: Add option --drop-cascade for pg_dump/restore

2021-08-12 Thread Greg Sabino Mullane
On Wed, Aug 11, 2021 at 10:53 PM Wu Haotian wrote: > Maybe we can add checks like "option --clean requires plain text format"? > If so, should I start a new mail thread for this? > Shrug. To me, that seems related enough it could go into the existing patch/thread. Cheers, Greg

Re: Add option --drop-cascade for pg_dump/restore

2021-08-11 Thread Wu Haotian
Hi, I've updated the patch to remove unnecessary changes and added tests. On Fri, Jul 16, 2021 at 9:09 PM vignesh C wrote: > pg_dump support plain, custom, tar and directory format, I think, > cascade option will be added by pg_dump only for plain format and for > the other format pg_restore

Re: Add option --drop-cascade for pg_dump/restore

2021-08-10 Thread Wu Haotian
On Tue, Aug 10, 2021 at 10:57 PM Greg Sabino Mullane wrote: > > On Fri, Jul 16, 2021 at 9:40 AM Tom Lane 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

Re: Add option --drop-cascade for pg_dump/restore

2021-08-10 Thread Greg Sabino Mullane
On Fri, Jul 16, 2021 at 9:40 AM Tom Lane 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

Re: Add option --drop-cascade for pg_dump/restore

2021-07-16 Thread Andrew Dunstan
On 7/16/21 9:40 AM, Tom Lane wrote: > vignesh C writes: >> On Tue, Jul 13, 2021 at 9:16 PM Wu Haotian wrote: >>> I may not understand it correctly, are you saying >>> pg_dump will include the cascade option only for plain format, or >>> pg_dump will enable the cascade option for plain by

Re: Add option --drop-cascade for pg_dump/restore

2021-07-16 Thread Tom Lane
vignesh C writes: > On Tue, Jul 13, 2021 at 9:16 PM Wu Haotian wrote: >> I may not understand it correctly, are you saying >> pg_dump will include the cascade option only for plain format, or >> pg_dump will enable the cascade option for plain by default? > pg_dump support plain, custom, tar

Re: Add option --drop-cascade for pg_dump/restore

2021-07-16 Thread vignesh C
On Tue, Jul 13, 2021 at 9:16 PM Wu Haotian wrote: > > > 2) I felt pg_dump will include the cascade option for plain format and > > pg_restore will include the cascade option from pg_restore for other > > formats. If my understanding is correct, should we document this? > > I may not understand it

Re: Add option --drop-cascade for pg_dump/restore

2021-07-13 Thread Wu Haotian
> 2) I felt pg_dump will include the cascade option for plain format and > pg_restore will include the cascade option from pg_restore for other > formats. If my understanding is correct, should we document this? I may not understand it correctly, are you saying pg_dump will include the cascade

Re: Add option --drop-cascade for pg_dump/restore

2021-07-13 Thread vignesh C
On Fri, Jul 2, 2021 at 12:11 PM Haotian Wu wrote: > > Hi, > > I agree that —drop-cascade does not make sense for pg_dumpall, so I removed > them. > > > are we expecting more things to appear after the semi-colon? > > No, I was just trying to “reuse” original statement as much as possible. >

Re: Add option --drop-cascade for pg_dump/restore

2021-07-02 Thread Haotian Wu
Hi, I agree that —drop-cascade does not make sense for pg_dumpall, so I removed them. > are we expecting more things to appear after the semi-colon? No, I was just trying to “reuse” original statement as much as possible. Append “\n” manually should also do the job, and I’ve updated the

Re: Add option --drop-cascade for pg_dump/restore

2021-05-28 Thread Greg Sabino Mullane
Overall the patch looks good, but I did notice a few small things: 1. In pg_dumpall.c, the section /* Add long options to the pg_dump argument list */, we are now passing along the --drop-cascade option. However, --clean is not passed in, so any call to pg_dumpall using --drop-cascade fails a

Add option --drop-cascade for pg_dump/restore

2021-04-08 Thread Haotian Wu
Hello, I'd like to propose adding `--drop-cascade` option for pg_dump/restore Usecase: I'd like to be able to restore an old custom format database dump as a single transaction ( so the current data won't lose if restore fails). The database has added some new constraints after backup so a