Skip site navigation (1) Skip section navigation (2)

Truncate Triggers

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Truncate Triggers
Date: 2008-01-30 17:46:19
Message-ID: 1201715179.4453.131.camel@ebony.site (view raw or flat)
Thread:
Lists: pgsql-patches
Full implementation of truncate triggers on CVS HEAD, for Postgres 8.4

Includes various docs, regression tests for PL/pgSQL trigger support,
psql and pg_dump support.

Some further discussion on -hackers required around statement skipping.
Prototype code for that aspect included in this patch, #ifdef'd out. 

Most interesting discussion point is the handling of multiple truncate
triggers when we are performing a multi-table TRUNCATE. Please read docs
in patch for details, plus comments.

This includes changes to PL/tcl, PL/perl and PL/python but support in
those languages have not yet been tested, not even a little bit. This
will be performed after review.

Provisional Slony support patch will also be posted to appropriate list.

diffstat
 doc/src/sgml/ref/create_trigger.sgml   |   32 +++!
 doc/src/sgml/ref/truncate.sgml         |    4 
 doc/src/sgml/trigger.sgml              |   32 ++!!
 src/backend/commands/tablecmds.c       |  126 ++++++++++++++++++
 src/backend/commands/trigger.c         |  111 ++++++++++++++++
 src/backend/parser/gram.y              |    1 
 src/backend/utils/adt/ruleutils.c      |    7 +
 src/bin/pg_dump/pg_dump.c              |    7 +
 src/include/catalog/pg_trigger.h       |    3 
 src/include/commands/trigger.h         |   31 +!!!
 src/include/utils/rel.h                |    2 
 src/pl/plperl/plperl.c                 |    4 
 src/pl/plpgsql/src/pl_exec.c           |    6 
 src/pl/plpython/plpython.c             |    2 
 src/pl/tcl/pltcl.c                     |    2 
 src/test/regress/expected/truncate.out |  226 ++++++++++++++++++++...
 src/test/regress/sql/truncate.sql      |  127 ++++++++++++++++++
 17 files changed, 672 insertions(+), 51 modifications(!)

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

Attachment: truncate_trigger.v1.patch
Description: text/x-patch (40.5 KB)

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2008-01-30 18:07:50
Subject: Re: [PATCHES] Proposed patch: synchronized_scanning GUCvariable
Previous:From: Tom LaneDate: 2008-01-30 17:22:28
Subject: Re: [PATCHES] Proposed patch: synchronized_scanning GUC variable

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group