Re: bug report: pg_dump does not use CASCADE in DROP

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Preston Landers <planders(at)journyx(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug report: pg_dump does not use CASCADE in DROP
Date: 2003-08-30 17:28:40
Message-ID: 200308301728.h7UHSeX17260@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Once pg_dump starts using the dependency information, it seems it could
> > do the drops in the proper order, and when it detects
> > mutually-dependent tables, it can use a single DROP CASCADE to remove
> > them all --- seems like that is a TODO.
>
> You missed my point entirely. What if DROP CASCADE causes a drop of a
> table that did not even exist in the source database, but was added in
> the target after the initial data load? It seems unlikely that that is
> desirable behavior for pg_restore.
>
> The correct use of dependency information would be to sort the DROPs
> into an order that should succeed *without* CASCADE. (This will
> actually happen for free AIUI, once pg_dump uses dependency info fully.
> DROPping in the reverse of a safe creation order should work.)

Right, but how do you drop two tables that REFERENCE each other? Seems
you have to use CASCADE in that case.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-08-30 21:28:38 Re: bug report: pg_dump does not use CASCADE in DROP
Previous Message Tom Lane 2003-08-30 16:54:17 Re: bug report: pg_dump does not use CASCADE in DROP