From: Michael Fuhr <mike@fuhr.org>
To: Craig Servin <cservin@cromagnon.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: NEW and OLD as ROWS
Date: Thu, 4 Aug 2005 07:38:23 -0600
Message-ID: <20050804133823.GA87839@winnie.fuhr.org> (raw)
In-Reply-To: <200508031252.24844.cservin@cromagnon.com>
References: <200508031252.24844.cservin@cromagnon.com>
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/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mike@fuhr.org, cservin@cromagnon.com
Subject: Re: NEW and OLD as ROWS
In-Reply-To: <20050804133823.GA87839@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox