Re: feature proposal - triggers by semantics - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: feature proposal - triggers by semantics
Date
Msg-id 50A4C302.1000909@2ndQuadrant.com
Whole thread Raw
In response to Re: feature proposal - triggers by semantics  (Craig Ringer <craig@2ndQuadrant.com>)
Responses Re: feature proposal - triggers by semantics  (Craig Ringer <craig@2ndQuadrant.com>)
Re: feature proposal - triggers by semantics  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On 11/15/2012 09:48 AM, Craig Ringer wrote:
> If you want to prevent TRUNCATE, deny the privilege or add a trigger
> that aborts the command.
You can abort the transaction but not skip action as currently it is only
possible to skip in ROW level triggers.

So I'd modify this request to allow BEFORE EACH STATEMENT triggers
to also be able to silently skip current action like BEFORE EACH ROW 
triggers can.

Then this request would simply be satisfied by a simple trigger which
rewrites TRUNCATE into DELETE .

Hannu

>
> TRUNCATE should do what it says, not magically be changed to do
> something else by a GUC.
>> Or alternately/also provide extra syntax to TRUNCATE itself where one
>> can specify which behavior to have, and both options can be given
>> explicitly to override any config option.
> What advantage would that have over using DELETE when you want DELETE,
> and TRUNCATE when you want TRUNCATE?
>




pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: feature proposal - triggers by semantics
Next
From: Greg Smith
Date:
Subject: Re: Materialized views WIP patch