Drop library cascade and drop schema cascade fail to drop UDFs
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trafodion |
Fix Released
|
High
|
Cliff Gray |
Bug Description
This bug report documents 2 problems that are somewhat related:
(1) Drop library cascade does not drop UDFs in the library automatically. It returns error 1366 complaining that dependent procedures exist.
(2) Drop schema cascade does not drop libraries or UDFs. It does not return any error, but both libraries and UDFs created in that schema remain in the _MD_ tables afterwards.
These 2 problems have made writing tests for UDF difficult as the tests have to keep track of the libraries and UDFs created during the testing and drop them individually afterwards. This is seen on the v1115_0830 build installed on a workstation.
To reproduce this problem, you need to install UDF first by following the instructions bellow:
(1) Download the attached tar file and untar it to get the 4 files in there. Put the 4 files in any directory <mydir>
(2) Run build.sh from <mydir> to build the UDF so file.
(3) Change the 2nd line ‘create library myudflib file '<mydir>'; in mytest.sql and fill in <mydir>
(4) From sqlci, obey mytest.sql
-------
Here is the execution output of mytest.sql showing that drop library cascade returns error 1366 and drop schema cascade has no effect. Queries to the _MD_ tables show both the library and the procedure after 'drop schema cascade'.
>>obey mytest.sql;
>>set schema MYUDFTEST;
--- SQL operation complete.
>>
>>create library myudflib file '<mydir>’;
--- SQL operation complete.
>>
>>create function MY_ENCRYPT_C
+>(INVAL varchar(32))
+>returns (OUTVAL varchar(32))
+>language c
+>parameter style sql
+>external name 'my_encrypt_c'
+>library myudflib
+>deterministic
+>state area size 1024
+>allow any parallelism
+>no sql;
--- SQL operation complete.
>>
>>drop library MYUDFTEST.myudflib cascade;
*** ERROR[1366] Request failed. One or more dependent procedures exist.
--- SQL operation failed with errors.
>>drop schema MYUDFTEST cascade;
--- SQL operation complete.
>>
>>create table my_tmp_schema.UID (object_uid largeint no default not null not droppable primary key);
--- SQL operation complete.
>>insert into my_tmp_schema.UID (select OBJECT_UID from "_MD_".OBJECTS where SCHEMA_
--- 2 row(s) inserted.
>>select LIBRARY_UID, CAST(LIBRARY_
LIBRARY_UID (EXPR)
-------
1233370001667
--- 1 row(s) selected.
>>select USING_LIBRARY_UID, USED_UDR_UID from "_MD_".
USING_LIBRARY_UID USED_UDR_UID
-------
1233370001667
--- 1 row(s) selected.
>>select UDR_UID, CAST(EXTERNAL_NAME as CHAR(40)), LIBRARY_UID from "_MD_".ROUTINES where UDR_UID in (select * from my_tmp_schema.UID) or LIBRARY_UID in (select * from my_tmp_schema.UID);
UDR_UID (EXPR) LIBRARY_UID
-------
1233370001667
--- 1 row(s) selected.
>>drop table my_tmp_schema.UID cascade;
--- SQL operation complete.
>>
>>drop function MYUDFTEST.
--- SQL operation complete.
>>drop library MYUDFTEST.myudflib cascade;
Changed in trafodion: | |
assignee: | nobody → Cliff Gray (cliff-gray) |
Changed in trafodion: | |
status: | New → In Progress |
Changed in trafodion: | |
milestone: | none → r1.0 |
Fix committed in 954.