From: Andreas Pflug <Andreas.Pflug@web.de>
To: pgsql-performance@postgresql.org
Subject: How to notice column changes in trigger
Date: Thu, 06 Mar 2003 16:00:58 +0100
Message-ID: <3E6762AA.8070206@web.de> (raw)
How can I detect whether a column was changed by an update command
inside a trigger?
create table test(a int, b int, c int, primary key(a))
b and c should be updated inside an update trigger if not modified by
the statement itself
1) update test set a=0 -> trigger does its work
2) update test set a=0, b=1, c=2 -> trigger does nothing
3) update test set a=0, b=b, c=c -> trigger does nothing, but content of
a and b dont change either although touched
What I'm looking for is something like
IF NOT COLUMN_TOUCHED(b) THEN ...
For MSSQL, this would be coded as IF NOT UPDATE(b) ..
Any hints?
Andreas
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: Andreas.Pflug@web.de
Subject: Re: How to notice column changes in trigger
In-Reply-To: <3E6762AA.8070206@web.de>
References: <3E6762AA.8070206@web.de>
* 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