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

Re: Command Triggers

From: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Command Triggers
Date: 2011-12-03 13:23:48
Message-ID: m2mxb9kcuz.fsf@2ndQuadrant.fr (view raw or flat)
Thread:
Lists: pgsql-hackers
Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> Those are especially important because in 9.2 DDL commands will cause
> additional locking overheads, so preventing DDL will be essential to
> keeping performance stable in high txn rate databases.

The patch now implements "any command" triggers, and you have the
command tag to branch in the function if you need to.

  CREATE TRIGGER noddl
      INSTEAD OF ANY COMMAND
         EXECUTE PROCEDURE cancel_any_ddl();
  
> So I'd like to see a few more triggers that work out of the box for
> those cases (perhaps wrapped by a function?). It would also allow a
> more useful man page example of how to use this.

We could solve that by providing an extension implementing command
triggers ready for use.  One that allows to easily switch on and off the
capability of running commands seems like a good candidate.

That said, with the current coding, you can't have both a instead of
trigger on "any command" and a before or after trigger on any given
command, so installing that extension would prevent you from any other
usage of command triggers.

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

In response to

pgsql-hackers by date

Next:From: Magnus HaganderDate: 2011-12-03 14:20:08
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Previous:From: Brar PieningDate: 2011-12-03 12:59:58
Subject: Re: Review of VS 2010 support patches

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