Dependency checks before you drop UDXs
Dependencies on UDXs are tracked. That is, if a table, view, or other UDX references a UDX that you want to drop, you cannot drop it until the dependency is removed.
SELECT * FROM _v_depend;
REFERENCING | REFERENCED | ...| SCHEMA | SCHEMAID
-----------------------------+------------------------------+----+--------+--------
table PROD..CUSTOMERS col(1) | function FILEUPDATE(INTEGER) | | TEST1 | 581383
view TOTAL_VW | aggregate MYSUM(INTEGER) | | TEST1 | 581383
function MYFUNC(INTEGER) | library MYMATHLIB | | MATH2 | 581356
(3 rows)fileupdate that
is used in a table named CUSTOMERS, an error similar
to the following is returned:DEV(USER1)=> DROP FUNCTION fileupdate(int4);
ERROR: Can't delete function FILEUPDATE - table CUSTOMERS (col 1)
depends on itThe error reports the table and specific column that refers to the function that you wanted to drop. For objects in different databases and schemas, the error message provides a fully qualified name to identify the object.
TOTAL_VW,
an error similar to the following is returned:DEV(MYUSER)=> DROP AGGREGATE mysum(int4); ERROR: Can't delete aggregate MYSUM - view TOTAL_VW depends on it
To resolve these error messages and drop the UDX, you must change the default value of each table row that references the UDFs by modifying the default value clause by using the ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT } commands. For views, you need to use the CREATE OR REPLACE VIEW command to remove the UDX from the view definition.
DEV(MYUSER)=> DROP LIBRARY mymathlib;
ERROR: Can't delete library mymathlib - function MYFUNC(integer)
depends on it
If you try to drop a database that contains objects that are referenced by objects in other databases, the DROP DATABASE command displays errors and exits. This check and error can also occur if you attempt to drop a schema on a system that supports multiple schemas. The error messages display up to 5 object dependencies, plus the total number of dependencies which must be resolved. You must resolve all the dependency issues before you can drop the database or schema.