Обсуждение: RESTRICT / CASCADE

Поиск
Список
Период
Сортировка

RESTRICT / CASCADE

От
Rod Taylor
Дата:
This note is currently in the 'Dependency Tracking (2.8)' section:

Note:  According to the SQL standard, specifying either RESTRICT or
CASCADE is required. No database system actually implements it that way,
but the defaults might be different.


If the defaults are different, perhaps the documentation should show
it's examples using RESTRICT or CASCADE explicitly?



Re: RESTRICT / CASCADE

От
Peter Eisentraut
Дата:
Rod Taylor writes:

> If the defaults are different, perhaps the documentation should show
> it's examples using RESTRICT or CASCADE explicitly?

Well, we're describing PostgreSQL, not other database systems that might
act differently.

I believe most SQL guides/books/courses/etc. simply use DROP TABLE name;
and this has also been historical practice in PostgreSQL, so we would
confuse users pretty heavily by adding RESTRICT or CASCADE everywhere.

Also, in most examples the choice between RESTRICT and CASCADE would have
to be arbitrarily made by the documentation writer and might not be what
the user really wanted to do.

--
Peter Eisentraut   peter_e@gmx.net


Re: RESTRICT / CASCADE

От
Tom Lane
Дата:
Rod Taylor <rbt@zort.ca> writes:
> This note is currently in the 'Dependency Tracking (2.8)' section:
> Note:  According to the SQL standard, specifying either RESTRICT or
> CASCADE is required. No database system actually implements it that way,
> but the defaults might be different.

The note is perhaps not very well worded.  No one actually requires you
to say RESTRICT or CASCADE, but there are some systems where the default
assumption is CASCADE.  I think everyone here agrees that that's a
ridiculously dangerous default, so it's quite unlikely that PG's
behavior would ever vary from what it is now.

> If the defaults are different, perhaps the documentation should show
> it's examples using RESTRICT or CASCADE explicitly?

No, that's just pointless pedantry.

            regards, tom lane

Re: RESTRICT / CASCADE

От
Rod Taylor
Дата:
On Mon, 2002-09-09 at 14:40, Peter Eisentraut wrote:
> Rod Taylor writes:
>
> > If the defaults are different, perhaps the documentation should show
> > it's examples using RESTRICT or CASCADE explicitly?

> Also, in most examples the choice between RESTRICT and CASCADE would have
> to be arbitrarily made by the documentation writer and might not be what
> the user really wanted to do.

Good points.  I suppose anyone paying enough attention to notice that
our behaviour restricts where others casacade will quickly realize what
they need to do.

--
  Rod Taylor