UPDATE keyword

From: "Ian Harding" <ianh(at)healthdept(dot)co(dot)pierce(dot)wa(dot)us>
To: <pgsql-general(at)postgresql(dot)org>
Subject: UPDATE keyword
Date: 2001-05-25 23:16:00
Message-ID: sb0e855f.087@mail.tpchd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)tpchd(dot)org

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Reina 2001-05-25 23:18:47 Windows SQL query interface
Previous Message Feite Brekeveld 2001-05-25 21:26:17 Re: pl-perl setup?