Hi,
I have installed OpenACS 5.3.0 with PostgreSQL 8.2.4 and Aolserver 4.5.
I have created a CR type named "workfile" (with a table named "cr_workfiles"), and in the APM callback "before_uninstall" I'm trying to drop this CR type with the function:
*********
content::type::delete -content_type workfile \
-drop_children_p t \
-drop_table_p t \
-drop_objects_p t
*********
The problem is that the function "content::type::delete" gives the following error:
*********
ERROR:
Database operation "0or1row" failed
(exception ERROR, "ERROR: cannot drop view cr_workfilesi because other objects depend on it
HINT: Use DROP ... CASCADE to drop the dependent objects too.
CONTEXT: SQL statement "drop view cr_workfilesi"
PL/pgSQL function "content_type__drop_type" line 90 at execute statement
*********
A possible solution is run from the APM callback the following code (instead of the funtion "content::type::delete" from the TCL API):
*********
db_exec_plsql delete_content_type {
select content_type__drop_type('workfile', 'true', 'true', 'true');
}
*********
The reason why the previous code runs fine is that the function "content_type__drop_type(character varying, boolean, boolean, boolean)" from the PLSQL API drops the table "cr_workfiles" with a CASCADE ("execute 'drop table ' || v_table_name || ' cascade';").
From my point of view there are two problems:
(1) In the TCL API: I call the function "content::type::delete" with 4 parameters, but instead of being called the function "content_type__drop_type(character varying, boolean, boolean, boolean)", is called the function "content_type__drop_type(character varying, boolean, boolean)" (with three parameters).
(2) In the PLSQL API:The function "content_type__drop_type(character varying, boolean, boolean)" instead of perform: "execute 'drop table ' || v_table_name || ' cascade';", performs the following:
*********
execute 'drop view ' || v_table_name || 'x';
execute 'drop view ' || v_table_name || 'i';
execute 'drop table ' || v_table_name;
*********
But, trying to drop the view "i" without a cascade will give an error because the function "v_table_name_f(v_table_namei)" depends on the view "i".
Is there any hint in order to use the TCL API to delete a CR type (instead of use the PLSQL API directly)?.
Thanks a lot for the help.
Kind regards,
Jorge.