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

From: Wu Haotian <whtsky(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Greg Sabino Mullane <htamfids(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add option --drop-cascade for pg_dump/restore
Date: 2021-07-13 15:45:49
Message-ID: CADHB_-BTn1Q8QhVcJt+Omk0SKK=-rRzhgZUMS8pdD+hF84UH8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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 option only for plain format, or
pg_dump will enable the cascade option for plain by default?

> 4) Is it possible to add a few tests for this?

Looks like tests should be added to
`src/bin/pg_dump/t/002_pg_dump.pl`, I'll try to add some.

vignesh C <vignesh21(at)gmail(dot)com> 于2021年7月13日周二 下午10:23写道:
>
> On Fri, Jul 2, 2021 at 12:11 PM Haotian Wu <whtsky(at)gmail(dot)com> 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. Append “\n” manually should also do the job, and I’ve updated the patch as you suggests.
>
> 1) This change is not required as it is not supported for pg_dumpall
> +++ b/doc/src/sgml/ref/pg_dumpall.sgml
> @@ -289,6 +289,16 @@ PostgreSQL documentation
> </listitem>
> </varlistentry>
>
> + <varlistentry>
> + <term><option>--drop-cascade</option></term>
> + <listitem>
> + <para>
> + Use <literal>CASCADE</literal> to drop database objects.
> + This option is not valid unless <option>--clean</option> is
> also specified.
> + </para>
> + </listitem>
> + </varlistentry>
> +
>
> 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?
>
> 3) This change is not required
>
> destroyPQExpBuffer(ftStmt);
> pg_free(dropStmtOrig);
> }
> +
> }
>
> 4) Is it possible to add a few tests for this?
>
> Regards,
> Vignesh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-07-13 15:52:06 Re: printf %s with NULL pointer (was Re: BUG #17098: Assert failed on composing an error message when adding a type to an extension being dropped)
Previous Message Jeff Davis 2021-07-13 15:44:43 Re: row filtering for logical replication