I saw your thread and I think you guys can help me with this apm callback problem.
I was trying to uninstall the news package, but when I run the drop script I got this error:
Database operation "0or1row" failed (exception NSDB, "Query was not a statement
returning rows.")
ERROR: update or delete on "acs_objects" violates foreign key constraint
"acs_objects_context_id_fk" on "acs_objects" DETAIL: Key (object_id)=(559) is
still referenced from table "acs_objects".
SQL:
select apm_package__delete('559');
It was because there were news items in the DB, so I drop them using this funtion:
create function inline_b0 ()
returns integer as '
declare
v_item_cursor2 RECORD;
begin
RAISE NOTICE ''Entro a la funcion inline_b0()'';
FOR v_item_cursor2 IN
select item_id
from news_item_revisions
LOOP
PERFORM news__delete(v_item_cursor2.item_id);
END LOOP;
end;
' language 'plpgsql';
When I run this from PSQL it deletes all the items.
So I run the drop script and it worked very well, so I decided to make an Tcl
Callback, I call the function this way in the before-uninstall callback:
db_exec_plsql news_f {
select inline_b0();
}
Then I run the "Uninstall this package from your system" option in the APM, and postgresql stalled in the funtion content_type__drop_type()
-- drop CR content_type
select content_type__drop_type(
'news', -- content_type
't', -- drop_children_p
't' -- drop_table_p
);
I don't know really why is this going on.
I also made a .tcl page that calls the inline_b0() function, and then I run the drop script and It went perfect.
Am I doing something wrong in the apm callback?
Thanks,
Paolo