Re: [SQL] Trigger to identify which column(s) updated

2004-01-19 Thread V i s h a l Kashyap @ [Sai Hertz And Control Systems]
Dear Jack , for each column in new: if (new.column(1) != old.column(1)) ... ...and then some snippet of code to determine the primary key column of new (or old) Check the following link http://gborg.postgresql.org/project/tablelog/projdisplay.php Hope this helps -- Regards, V

Re: [SQL] Trigger to identify which column(s) updated

2004-01-18 Thread Vishal Kashyap @ [Sai Hertz And Control Systems]
Dear Jack , I suspect that the function would look something like; CREATE FUNCTION FIND_CHANGED_COLUMNS() RETURNS OPAQUE AS ' BEGIN -- FOR EACH COLUMN IN THE RECORD: -- IF ( NEW COLUMNx <> OLD COLUMNx) -- LOG THE RECORD PRIMARY KEY, COLUMN NAME, OLD VALUE RETURN NEW; END; ' LANGU

[SQL] Trigger to identify which column(s) updated

2004-01-18 Thread Jack Kerkhof
Does anyone know how to write a trigger that would identify which columns have actually changed in an update (and then log them to an archive). I suspect that the function would look something like; CREATE FUNCTION FIND_CHANGED_COLUMNS() RETURNS OPAQUE AS ' BEGIN -- FOR EACH COLUMN IN THE RE