Re: Dynamic triggers - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Dynamic triggers
Date
Msg-id 201006161514.12786.adrian.klaver@gmail.com
Whole thread Raw
In response to Dynamic triggers  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
List 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.klaver@gmail.com

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: consequent PQsendQueryPrepared() failed: another command is already in progress
Next
From: Felde Norbert
Date:
Subject: postgres crash SOS