Re: TRUNCATE

From: "Rod Taylor" <rbt(at)zort(dot)ca>
To: "Joel Burton" <joel(at)joelburton(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TRUNCATE
Date: 2002-05-12 21:35:55
Message-ID: 032c01c1f9fd$0000a950$0f02000a@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From my limited understanding of truncate in Oracle is it requires the
user to first disable integrity constraints on the table before
truncate will run.

In SQL Server that truncate will not allow truncate if foreign key
constraints exist, but does not execute user delete triggers.

Can't remember nor confirm either of these now. But, for consistency
sake we should enforce the foreign key case. But I really think it
should apply to all constraints, system or user enforced (rules, user
written triggers).

Besides that, theres always Codds twelfth rule which I've always
liked:
The nonsubversion rule: If low-level access is permitted it should not
bypass security or integrity rules.

--
Rod
----- Original Message -----
From: "Joel Burton" <joel(at)joelburton(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>; "Rod Taylor" <rbt(at)zort(dot)ca>
Cc: "Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Sent: Sunday, May 12, 2002 3:48 PM
Subject: RE: [HACKERS] TRUNCATE

> > -----Original Message-----
> > From: pgsql-hackers-owner(at)postgresql(dot)org
> > [mailto:pgsql-hackers-owner(at)postgresql(dot)org]On Behalf Of Tom Lane
> > Sent: Sunday, May 12, 2002 12:30 PM
> > To: Rod Taylor
> > Cc: Hackers List
> > Subject: Re: [HACKERS] TRUNCATE
> >
> >
> > "Rod Taylor" <rbt(at)zort(dot)ca> writes:
> > > I'm thinking it should check for an on delete rule as well as
user
> > > triggers.
> >
> > Seems reasonable to me.
> >
> > Should there be a "FORCE" option to override these checks and do
it
> > anyway? Or is that just asking for trouble?
>
> I've relied on being able to TRUNCATE w/o having RI kick in to lots
of data
> clean ups, forced sorts, etc. I'd find it annoying if I couldn't do
this
> anymore (or had to do equally-annoying things, like manually drop
then
> recreate the triggers, etc.)
>
> I'm happy w/o the FORCE option (just let TRUNCATE do it), but if
enough
> people think that the FORCE keyword should be added to allow
overriding of
> triggers, that could be a good compromise.
>
> But, please, don't take away the ability to TRUNCATE. Doing it when
there
> are triggers is one the strengths of TRUNCATE, IMNSHO.
>
> - J.
>
> Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim:
wjoelburton
> Knowledge Management & Technology Consultant
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Doug Hughes 2002-05-12 22:03:49 Easy upgrade
Previous Message Dave Page 2002-05-12 21:03:07 Operator Comments