Re: Old values in statement triggers?

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
Cc: Brian Hirt <bhirt(at)me(dot)com>, Postgresql Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Old values in statement triggers?
Date: 2010-10-21 13:49:35
Message-ID: AANLkTinxKgSx91a_xcrYCcVxfG-nvu03TrPxOq1H2dLY@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/10/21 Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>:
> OLD.column_name
> NEW.column_name ?

I believe OP is asking specifically about statement-level triggers. As
the docs <http://www.postgresql.org/docs/current/static/trigger-definition.html>
say:

| Statement-level triggers do not currently have any way to
| examine the individual row(s) modified by the statement.

What I've done is to have a row-level trigger that populates a
temporary table with "interesting" changes that need further
processing, and then a statement-level trigger which does bulk-updates
based on what's in that temporary table. This comes in quite handy
when bulk-loading data, e.g. with COPY.

Josh

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-10-21 14:04:41 Re: a query on stored procedures/functions in pgsql
Previous Message Bruce Momjian 2010-10-21 13:40:42 Re: 9.0 SSL renegotiation failure restoring data