Re: Should this require CASCADE?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Should this require CASCADE?
Date: 2002-07-11 03:05:31
Message-ID: 200207110305.g6B35Vq27479@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck wrote:
> Tom Lane wrote:
> >
> > Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> > > On Wed, 10 Jul 2002, Tom Lane wrote:
> > >> DROP TABLE foo RESTRICT;
> > >>
> > >> Should this succeed? Or should it be necessary to say DROP CASCADE to
> > >> get rid of the foreign-key reference to foo?
> >
> > > I think the above should fail. If someone was adding restrict since it
> > > was optional, I'd guess they were doing so in advance for the days when
> > > we'd actually restrict the drop.
> >
> > Sorry if I wasn't clear: we never had the RESTRICT/CASCADE syntax at all
> > until now. What I'm intending though is that DROP with no option will
> > default to DROP RESTRICT, which means that a lot of cases that used to
> > be "gotchas" will now fail until you say CASCADE. I wrote RESTRICT in
> > my example just to emphasize that the intended behavior is RESTRICT.
>
> I think the idea was to have it default to CASCADE for this release, not
> to break existing code right away. Then 7.3 is transition time and
> RESTRICT will be the default from the next release on.

I am not in favor of changing thing 1/2 way for one release, then doing
the final job in the next release. If we need to change it, we document
it and move on. Two smalll changes are worse than one big change.

As far as this question, seems with no RESTRICT/CASCADE, it fails, with
RESTRICT it drops the trigger, and with CASCADE it drops the referencing
table. Is that accurate?

--
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bradley Baetz 2002-07-11 03:08:11 Re: [INTERFACES] [pgaccess-users] RE: bugzilla.pgaccess.org
Previous Message Tatsuo Ishii 2002-07-11 03:02:43 Re: Just added a second relay server ...