Re: feature proposal - triggers by semantics

Поиск
Список
Период
Сортировка
От Darren Duncan
Тема Re: feature proposal - triggers by semantics
Дата
Msg-id 50A54822.9020202@darrenduncan.net
обсуждение исходный текст
Ответ на Re: feature proposal - triggers by semantics  (Craig Ringer <craig@2ndQuadrant.com>)
Ответы Re: feature proposal - triggers by semantics  (Christopher Browne <cbbrowne@gmail.com>)
Список pgsql-hackers
Craig Ringer wrote:
> On 11/15/2012 06:25 PM, Hannu Krosing wrote:
>> 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 .
> That seems sensible to me, too.

To further explain ...

What I'm desiring here with respect to TRUNCATE is that users are allowed to use 
TRUNCATE syntax as an alternative to DELETE (they are GRANTed both) but that any 
triggers defined for DELETE can also be applied to TRUNCATE without too much 
difficulty.  So users can use different syntactic constructs that look similar 
without having to think about, is this going to be audited.

I understand that ROW level triggers don't exist yet for TRUNCATE (this is 
already clearly documented in the manual) and adding them would mean TRUNCATE 
would do a table scan in their presence.

I still think the syntax of TRUNCATE FOR EACH ROW would be useful, but if no one 
agrees, then I'll just make do with alternative solutions mentioned here.  That 
is, either a statement-level TRUNCATE trigger of some kind, or simply disallow 
TRUNCATE privileges.

Thank you.

-- Darren Duncan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: Enabling Checksums
Следующее
От: Greg Stark
Дата:
Сообщение: Re: tuplesort memory usage: grow_memtuples