Re: Truncate Triggers

From: Decibel! <decibel(at)decibel(dot)org>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Hannu Krosing <hannu(at)krosing(dot)net>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Truncate Triggers
Date: 2008-02-02 04:16:49
Message-ID: 20080202041648.GP1212@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)decibel(dot)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(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Omar Bettin 2008-02-02 11:26:50 Strange behavior on plpgsql trigger function in if comparison
Previous Message Gurjeet Singh 2008-02-02 00:49:17 Re: <IDLE> and waiting