Michael Fuhr
2004-11-22 01:56:12 UTC
I am trying to find a way to stamp all of the rows affected by an update (or
insert) with a unique value.
[snip]insert) with a unique value.
At first I tried to do this as a trigger function. The problem with this
solution is that if I dont have the function called for each row, I cannot
modify those rows. if I DO have the function called for each row, how do
they get the "change_number" they cannot simply call nextval() as it will be
different for each row (they also couldn't call curval() because then who is
ever calling nextval()?)
Have you tried calling nextval() in a FOR EACH STATEMENT triggersolution is that if I dont have the function called for each row, I cannot
modify those rows. if I DO have the function called for each row, how do
they get the "change_number" they cannot simply call nextval() as it will be
different for each row (they also couldn't call curval() because then who is
ever calling nextval()?)
and currval() in a FOR EACH ROW trigger? This works for me in
simple tests. I don't know if statement triggers are guaranteed
to fire before row triggers, but they do appear to work that way.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
Michael Fuhr
http://www.fuhr.org/~mfuhr/
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings