Re: trigger for TRUNCATE? - Mailing list pgsql-sql

From Simon Riggs
Subject Re: trigger for TRUNCATE?
Date
Msg-id 1199994824.4266.851.camel@ebony.site
Whole thread Raw
In response to trigger for TRUNCATE?  (Gerardo Herzig <gherzig@fmed.uba.ar>)
List pgsql-sql
Alvaro Herrera wrote: 
> My thinking is that a TRUNCATE trigger is a per-statement trigger which
> doesn't have access to the set of deleted rows.

> In that way it would be different from a per-statement trigger for
> DELETE.

Completely agree.

A truncate trigger should run a different function to a delete trigger. 

This is an important feature for trigger-based replication systems. Not
just slony, but bucardo and others too. It's an embarrassing hole in our
high availability capabilities and we really need to fill the gap. We
can't always control whether an application will issue truncates or
not. 

Rather spookily that's what I've been working on this afternoon, though
I didn't realise this thread was in progress until now, nor did I
realise there might be possible objections. I do hope the importance of
it is enough to overcome objections.

Yes, it does look fairly straightforward. Should be ready for when 8.4
opens, assuming we agree.

--  Simon Riggs 2ndQuadrant  http://www.2ndQuadrant.com



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: trigger for TRUNCATE?
Next
From: James Cloos
Date:
Subject: Escape sequence for UTF-8 Character Literals?