How to notice column changes in trigger

From: Andreas Pflug <Andreas(dot)Pflug(at)web(dot)de>
To: pgsql-performance(at)postgresql(dot)org
Subject: How to notice column changes in trigger
Date: 2003-03-06 15:00:58
Message-ID: 3E6762AA.8070206@web.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2003-03-06 15:25:36 Re: pgsql-server/ /configure /configure.in rc/incl ...
Previous Message Aspire Something 2003-03-06 14:48:13 Re: New Interface for Win