Re: User-friendliness for DROP RESTRICT/CASCADE

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: pgsql-hackers(at)postgresql(dot)org, Rod Taylor <rbt(at)zort(dot)ca>
Subject: Re: User-friendliness for DROP RESTRICT/CASCADE
Date: 2002-06-26 18:06:33
Message-ID: 200206261806.g5QI6Xr20769@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
>
> DROP TYPE widget RESTRICT; -- fail
> NOTICE: operator <% depends on type widget
> NOTICE: operator >% depends on type widget
> NOTICE: operator >=% depends on type widget
> ERROR: Cannot drop type widget because other objects depend on it
> Use DROP ... CASCADE to drop the dependent objects too
>
> Any objections?
>
> Also, would it be a good idea to make it *recursively* report all
> the indirect as well as direct dependencies? The output might get
> a little bulky, but if you really want to know what DROP CASCADE
> will get you into, seems like that is the only way to know.
>
> To work recursively without getting into an infinite loop in the case of
> circular dependencies, we'd need to make DROP actually drop each object
> and CommandCounterIncrement, even in the RESTRICT case; it would rely on
> rolling back the entire transaction when we finally elog(ERROR). This
> might make things a tad slow, too, for something with many dependencies
> ... but I don't think we need to worry about making an error case fast.
>
> Comments?

It would be nice if it is easy to do.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2002-06-26 18:08:31 Re: Postgres idea list
Previous Message Dave Cramer 2002-06-26 18:00:58 Re: Postgres idea list