UPDATE keyword
Ian Harding <ianh@healthdept.co.pierce.wa.us>
From: "Ian Harding" <ianh@healthdept.co.pierce.wa.us>
To: <pgsql-general@postgresql.org>
Date: 2001-05-25T23:16:00Z
Lists: pgsql-general
Well, I am making progress in rewriting my MSSQL Server T-SQL triggers and stored procedures in Pl/Tcl. However, I have run into a bit of an issue and I wonder if anyone knows the best way to address it...
In T-SQL triggers, you can use the UPDATE keyword in conditional expressions as in
IF UPDATE(myfield)
BEGIN
do something
END
It detects the update of the field. I have been comparing $NEW(myfield) and $OLD(myfield) which works ok, except where I used the UPDATE() test as a crutch. I sometimes do an update like
UPDATE mytable SET myfield = myfield WHERE...
to fire an update trigger, and executing only the code in that trigger surrounded by UPDATE(myfield).
Is there an easy way to duplicate this, or should I work around it?
Ian A. Harding
Programmer/Analyst II
Tacoma-Pierce County Health Department
(253) 798-3549
mailto: ianh@tpchd.org