Re: Truncate Triggers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Truncate Triggers
Date
Msg-id 24984.1201991920@sss.pgh.pa.us
Whole thread Raw
In response to Re: Truncate Triggers  (David Fetter <david@fetter.org>)
Responses Re: Truncate Triggers  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
David Fetter <david@fetter.org> writes:
> On Sat, Feb 02, 2008 at 05:23:39PM -0500, Christopher Browne wrote:
>> I think it would be nice to be able to have more "trigger hooks"
>> relating to DDL changes, but I also think that will represent some
>> fundamentally more difficult problems being raised than is the case
>> for a TRUNCATE trigger.

> Are they really?

One fairly obvious difficulty is how to pass the trigger any meaningful
information about what happened (or is about to happen).  In the case of
TRUNCATE, pretty much everything you need to know is implicit in the
event type.

I suspect that triggers on DDL will also share some of the problems
we've identified in past discussions about supporting triggers on system
catalogs --- in fact, to a first approximation these might be the same
thing.  It's not clear that we want to be firing random user-defined
code during the process of a catalog update, nor that it can be
guaranteed a consistent view of the system state.  TRUNCATE triggers
are a narrow enough case to dodge that complexity, or much of it anyway
(in a multi-table TRUNCATE there'd still be some interesting questions
about just when the triggers fire).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: and waiting
Next
From: "Gurjeet Singh"
Date:
Subject: Re: and waiting