Forum OpenACS Q&A: Response to Using math with CONNECT BY

Collapse
Posted by Jonathan Ellis on
yes, updates performed by triggers will fire other (including "recursive") triggers just as any other update would.

since you're dealing with a tree structure (no cycles) this means your job is pretty simple.  doing something like

update table set weight = weight + (new.weight - old.weight) where id = new.parent_id

should cover you (allowing reparenting of nodes would complicate things some, but you could check for and handle that if you needed to).  top-level nodes should have parent_id = null so an update there will result in zero rows updated (by the trigger) and no subsequent triggers firing.  similarly for your ingredients/mix tables, your "top level" incredients will not exist as components in the mix table.