Re: Truncate Triggers - Mailing list pgsql-hackers

From Decibel!
Subject Re: Truncate Triggers
Date
Msg-id 20080202041648.GP1212@decibel.org
Whole thread Raw
In response to Re: Truncate Triggers  (Simon Riggs <simon@2ndquadrant.com>)
List pgsql-hackers
On Thu, Jan 31, 2008 at 11:45:55AM +0000, Simon Riggs wrote:
> On Thu, 2008-01-31 at 10:22 +0000, Gregory Stark wrote:
> > "Decibel!" <decibel@decibel.org> writes:
> >
> > > CLUSTER isn't DDL. Most forms of ALTER TABLE are. And CREATE blah, etc.
> >
> > Fwiw I would call CLUSTER DDL. Note that it does make a change that's visible
> > in the table definition afterwards.
> >
> > There are plenty of DDL commands which modify data (CREATE INDEX, ATLER TABLE
> > ALTER COLUMN TYPE). The defining characteristic of DDL is not that it doesn't
> > modify the data but that it does modify the table definition.
> >
> > By that definition CLUSTER is DDL and TRUNCATE is DDL if you look at the
> > implementation rather than the user-visible effects.
>
> Surely the question is more simple: do we want triggers on it?
>
> There's a clear case for TRUNCATE to have a triggers.
>
> Is there a clear case for any other statements (however you categorise
> them)? If so, lets hear it, please.

Having "triggers" on ALTER table means that replication systems can
replicate changes automatically.

Having triggers on CREATE, ALTER, DROP mean that you can audit DDL, or
if desired prevent it.

Searching the mailing lists for "ddl trigger" for the last year turns up
87 hits. This is something that a lot of people have been asking for.
--
Decibel!, aka Jim C. Nasby, Database Architect  decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828

pgsql-hackers by date:

Previous
From: "Gurjeet Singh"
Date:
Subject: Re: and waiting
Next
From: "Omar Bettin"
Date:
Subject: Strange behavior on plpgsql trigger function in if comparison