Re: Should this require CASCADE? - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: Should this require CASCADE?
Date
Msg-id 1026343668.62546.30.camel@jester
Whole thread Raw
In response to Should this require CASCADE?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, 2002-07-10 at 18:33, Tom Lane wrote:
> Consider
> 
>     CREATE TABLE foo (f1 int primary key);
> 
>     CREATE TABLE bar (f1 int references foo);
> 
>     DROP TABLE foo RESTRICT;

> Our historical behavior is to allow the drop, while issuing a notice
> about implicit deletion of triggers.  But I think SQL92 intends that
> CASCADE should be required.

I think you know my answer (Fail).

- As stated, spec intends it to be required
- Number of automated scripts doing drop table is small
- Users will quickly learn the ropes.  They would be surprised if it
cascaded by default.

The question I suppose is:

DROP TABLE foo;

Does it default to restrict or cascade?  Currently it is restrict.  I
don't believe the spec allows those statements to be without the
qualifier.


Or, how about ALTER TABLE bar DROP CONSTRAINT <fkey_cons> RESTRICT;

I forget what happens here -- does bar depend on foo via the fkey?


ALTER TABLE foo DROP CONSTRAINT <primary key> RESTRICT; should
definitely fail (bar depends on fkey which depends on foo.pkey).







pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Should this require CASCADE?
Next
From: Jan Wieck
Date:
Subject: Re: Should this require CASCADE?