Forum OpenACS Q&A: Re: Dropping a package

Collapse
4: Re: Dropping a package (response to 1)
Posted by Geoff King on
If this helps when i create an acs_object I do the following as is suggested by the notes package;

(this is postgres function)

v_ad_id := acs_object__new (
p_ad_id,
p_object_type,
p_creation_date,
p_creation_user,
p_creation_ip,
p_context_id
);

So the package id is written to the acs_objects table, and this causes the violates foreign key constraint "acs_objects_context_id_fk" on "acs_objects" on the drop because it tried to delete the context id (package id) from the system first instead of deleteing the objects first and then the package.

Now through testing if I change my create scripts to do this instead;

v_ad_id := acs_object__new (
p_ad_id,
p_object_type,
p_creation_date,
p_creation_user,
p_creation_ip,
null
);

the package removes properlly with NO ERRORS.

Should I just not ever write the context_id tp the acs_objects table?