Re: Dynamic triggers

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: "Rob Richardson" <Rob(dot)Richardson(at)rad-con(dot)com>
Subject: Re: Dynamic triggers
Date: 2010-06-16 22:14:12
Message-ID: 201006161514.12786.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 16 June 2010 5:29:39 am Rob Richardson wrote:
> Sid posted a link to a Wiki example of a dynamic trigger:
> http://wiki.postgresql.org/wiki/PL/pgSQL_Dynamic_Triggers
> <http://wiki.postgresql.org/wiki/PL/pgSQL_Dynamic_Triggers> . The link
> shows a trigger, but it doesn't say anything about what its purpose is
> or what a dynamic trigger is supposed to be good for. What is it good
> for?
>
> Thank you!
>
> RobR

The dynamic part is the EXECUTE statement. It allows you to build a query on the
fly. More importantly it overrides the default behavior of caching the plan the
first time a function is run in a session. See below for more detail:

http://www.postgresql.org/docs/8.4/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
http://www.postgresql.org/docs/8.4/interactive/plpgsql-implementation.html#PLPGSQL-PLAN-CACHING

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Felde Norbert 2010-06-16 23:55:22 postgres crash SOS
Previous Message Tom Lane 2010-06-16 20:37:17 Re: Misunderstanding transactions and locks