Re: Statement level triggers

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Statement level triggers
Date: 2010-01-20 13:18:49
Message-ID: 4B5702B9.50706@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vincenzo Romano wrote:
> Hi all.
>
> What'd be the behavior of a (plpgsql) trigger function when called as
> a statement level trigger?
> Let's say that a statement will involve more than one row.
> The documentation (v8.4.2, "35.1. Overview of Trigger Behavior") says:
>
> "Statement-level triggers do not currently have any way to examine the
> individual row(s) modified by the statement."

It means you don't have NEW or OLD record-variables. You can still
perform any queries you need to on the table affected and any other
tables of interest.

I find statement-level triggers to be useful mostly for sanity-checking.
I'll have an AFTER statement level trigger verify a certain invariant on
a table - like a table-level CHECK (as opposed to row-level CHECK).

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2010-01-20 13:29:23 Re: Statement level triggers
Previous Message Ivan Sergio Borgonovo 2010-01-20 11:18:02 Re: C: extending text search: from where to start