I have a question about something I don't
quite understand in the permissions code for ACS 5.0.
Please excuse this if it is a really stupid question,
but I don't see how a certain part of one of the triggers will work.
I'm looking at acs-objects-create.sql,
inside the acs_objects_context_id_up_tr() trigger function.
Note that the trigger is set to go off after an update of acs_objects.
the code block is:
-- Remove my old ancestors from my descendants.
delete from acs_object_context_index
where object_id in (select object_id
from acs_object_contexts
where ancestor_id = old.object_id)
and ancestor_id in (select ancestor_id
from acs_object_contexts
where object_id = old.object_id);
-- Kill all my old ancestors.
delete from acs_object_context_index
where object_id = old.object_id;
Ok, so let's assume you update a row in acs_objects, changing the object_id. If this happens,won't the object_ids and ancestor_ids of the the corresponding rows in acs_objects_context_index also update via cascade? If this is so, when the above code is run after the updates have taken place, then deleting rows in acs_objects_context based on old.object_id won't actually delete any rows because the value of old.object_id no longer exists anywhere in acs_objects_context_index. Is that what is supposed to happen? It seems to me that this isn't correct and you actually want to delete rows based on new.object_id, but I'm sure I'm mixing something about when 'on update cascade' triggers actually fire.
If someone could clarify this for me I would much appreciate it.
-Ara Anjargolian