Re: Delete rule does not prevent truncate

From: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Delete rule does not prevent truncate
Date: 2015-07-22 16:10:25
Message-ID: CAEzk6fdsWd4Vq7d_AH6e7UiK8pbrdhva4Uq4hwUSwodAxwgGZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 22 July 2015 at 16:55, Joshua D. Drake <jd(at)commandprompt(dot)com> wrote:

>
> On 07/22/2015 08:42 AM, Geoff Winkless wrote:
>
>> On 22 July 2015 at 16:32, Joshua D. Drake <jd(at)commandprompt(dot)com
>> <mailto:jd(at)commandprompt(dot)com>>wrote:
>>
>> This is actually wrong. The end result is the same but it does not
>> in any way have the same effect.
>>
>> ​
>> "in any way"? ​I'd say in the primary way it has the same effect: all
>> rows are removed
>> from the table.
>>
>
> Thus the end result is the same as I said but the in practice effect is
> quite different from a visibility, maintenance and programmability
> perspective.

But to say "it does not in any way have the same effect" explicitly
excludes that any effect of the two things might be the same. In actual
fact, in the simple case (no triggers) the effect *is *the same.

FWIW, the difference between "in practice effect" and "end result" is
pretty esoteric, frankly - I'm not really sure what you're driving at
there. The "end result" would surely include the behaviour of any triggers
that might be fired.

TRUNCATE is NOT DELETE.
>>
>>
>> ​I don't think anyone is suggesting that it is.​
>>
>
> Except Tim Smith who started this thread.
>
>
​I don't believe he suggested that at all: he made an assumption that his
DELETE triggers would fire on TRUNCATE, and when it was pointed out that he
was mistaken he posted *half* a sentence from the documentation that
supported his view, ignoring the second half of that sentence that makes it
clear that the behaviour of the two commands is different, and ignoring the
explicit statement *on the very same page *of the documentation viz:

"
TRUNCATE will not fire any ON DELETE triggers that might exist for the
tables
​"​.

​Geoff​

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Миша Тюрин 2015-07-22 16:34:56 Re: [GENERAL] Way to get timeline
Previous Message Joshua D. Drake 2015-07-22 15:55:22 Re: Delete rule does not prevent truncate