Re: User-friendliness for DROP RESTRICT/CASCADE - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: User-friendliness for DROP RESTRICT/CASCADE
Date
Msg-id 200206261806.g5QI6Xr20769@candle.pha.pa.us
Whole thread Raw
In response to User-friendliness for DROP RESTRICT/CASCADE  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Nextgres?
Next
From: Bruce Momjian
Date:
Subject: Why I like partial solutions