> It seems the truncate command deletes all rows from a table even it is
> referenced by another tables. TRUNCATE is not in the standard any way,
> so I would not claim this is a bug. However, sometimes it would be
> helpful for a user to let him notice that the table about to be
> truncated is referenced by some tables. So I would propose to add
> "RESTRICT" option to the command. I mean if RESTRICT is specified,
> TRUNCATE will fail if the table is referenced.
> 
> BTW, the keyword "RESTRICT" is inspired by the fact that DROP TABLE
> has the same option according to the standard. If a table is
> referenced by some tables and the drop table command has the RESTRICT
> option, it would fail. This seems to be a nice feature too.

Truncate should probably check if all referencing tables are empty
and fail if not. Truncate should imho not lead to a violated constraint
situation.
Strictly speaking the current situation is more or less a bug.

Andreas

Thu, 8 Jun 2000 16:29:24 +0200 
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
AW: Proposal: TRUNCATE TABLE table RESTRICT
Zeugswetter Andreas SB wrote:
>
> Truncate should probably check if all referencing tables are empty
> and fail if not. Truncate should imho not lead to a violated constraint
> situation.
> Strictly speaking the current situation is more or less a bug.
>

    Not  anything is possible with RI, so the DB schema might use
    regular triggers and/or rules as well.

    Why  not  reject  TRUNCATE  at  all  if  the   relation   has
    rules/triggers?  IMHO the only safe way.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



Fri, 9 Jun 2000 13:04:27 +0200 (MEST)
JanWieck@t-online.de (Jan Wieck)
Re: AW: Proposal: TRUNCATE TABLE table RESTRICT