Re: NEW and OLD as ROWS

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Craig Servin <cservin(at)cromagnon(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: NEW and OLD as ROWS
Date: 2005-08-04 13:38:23
Message-ID: 20050804133823.GA87839@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Aug 03, 2005 at 12:52:24PM -0500, Craig Servin wrote:
> Is there a way to do:
>
> NEW IS DISTINCT FROM OLD
>
> in a trigger?
>
> This would help me not have to write a specific trigger for each table.

One way would be to write the trigger function in a language other
than PL/pgSQL (PL/Tcl, PL/Perl, PL/Python, etc., depending on whether
the language in question supports triggers in the version of
PostgreSQL you're using). Some languages' trigger functions receive
NEW and OLD in variables that can be inspected without knowing the
table structure in advance, so you can write generic functions that
will work on any table.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Boes 2005-08-04 13:42:28 Re: Breakdown results by month
Previous Message Craig Servin 2005-08-03 17:52:24 NEW and OLD as ROWS