Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean
Date: 2009-11-20 22:00:05
Message-ID: 603c8f070911201400k2bbf83d3j6fda4f072cdf72d5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Fri, Nov 20, 2009 at 3:38 PM, Tom Lane <tgl(at)postgresql(dot)org> wrote:
> Log Message:
> -----------
> Add a WHEN clause to CREATE TRIGGER, allowing a boolean expression to be
> checked to determine whether the trigger should be fired.
>
> For BEFORE triggers this is mostly a matter of spec compliance; but for AFTER
> triggers it can provide a noticeable performance improvement, since queuing of
> a deferred trigger event and re-fetching of the row(s) at end of statement can
> be short-circuited if the trigger does not need to be fired.
>
> Takahiro Itagaki, reviewed by KaiGai Kohei.

Random thought: would it be possible to use something like this to
optimize foreign key constraints, by not firing them if none of the
relevant columns have been updated?

...Robert

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2009-11-20 22:05:02 Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean
Previous Message User Achernow 2009-11-20 21:52:03 libpqtypes - libpqtypes: Fixed bug in pqt_allowsptr, it was returning

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-11-20 22:05:02 Re: [COMMITTERS] pgsql: Add a WHEN clause to CREATE TRIGGER, allowing a boolean
Previous Message Tom Lane 2009-11-20 21:39:17 Re: Why do OLD and NEW have special internal names?