Re: Truncate Triggers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Truncate Triggers
Date
Msg-id 9031.1201980220@sss.pgh.pa.us
Whole thread Raw
In response to Re: Truncate Triggers  (David Fetter <david@fetter.org>)
Responses Re: Truncate Triggers  (David Fetter <david@fetter.org>)
List pgsql-hackers
David Fetter <david@fetter.org> writes:
> On Thu, Jan 31, 2008 at 10:22:42AM +0000, Gregory Stark wrote:
>> There are plenty of DDL commands which modify data (CREATE INDEX,
>> ATLER TABLE ALTER COLUMN TYPE). The defining characteristic of DDL
>> is not that it doesn't modify the data but that it does modify the
>> table definition.

> Counter-example: ALTER TABLE ALTER COLUMN USING will almost certainly
> modify data, but it's DDL nonetheless.

Uh, how is that a counter-example to what Greg said?


I think the real question here is whether there is a defensible use-case
for a trigger.  In the case of TRUNCATE it's pretty obvious what you
might want the trigger for: to do the same thing your per-row ON DELETE
trigger does, but across all rows.  It's much less easy to envision a
scriptable-in-advance response to arbitrary ALTER TABLE operations.

Looked at in this light, TRUNCATE is clearly more nearly DML than DDL,
in the sense that its effects are predictable and involve only the data
not the schema (at least in the user's view).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: configurability of OOM killer
Next
From: "Florian G. Pflug"
Date:
Subject: Re: configurability of OOM killer