Re: feature proposal - triggers by semantics

From: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
To: Craig Ringer <craig(at)2ndQuadrant(dot)com>
Cc: Darren Duncan <darren(at)darrenduncan(dot)net>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: feature proposal - triggers by semantics
Date: 2012-11-15 10:25:06
Message-ID: 50A4C302.1000909@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2012-11-15 10:34:43 Re: Materialized views WIP patch
Previous Message Michael Paquier 2012-11-15 10:04:44 Re: feature proposal - triggers by semantics