Informix Error -9640: Cannot drop type (type_name): distinct type defined over the type.
Cause and resolution
Cannot drop type (type_name): distinct type defined over the type.
Before you can drop a type, you must first drop all distinct types based on the type.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9640 fires when DROP TYPE targets a type that a distinct type is still defined over — per the official guidance.
- A distinct type still based on the target type, per the official guidance — the direct, only cause.
Solutions / Resolution
- Drop all distinct types based on the type first, per the official guidance, before dropping the type itself.
Examples
Dropping a type with a dependent distinct type
CREATE DISTINCT TYPE di AS my_opaque_type;
DROP TYPE my_opaque_type RESTRICT; -- -9640: di still depends on it
Corrected
DROP TYPE di RESTRICT;
DROP TYPE my_opaque_type RESTRICT;
Diagnostic Checks
- Check the system catalog for distinct types based on the target type, and drop them first.
Related Errors / Related Topics
- -9630 — "Cannot drop type (type_name): still in use." The general in-use error this is a specific case of, naming a distinct type as the specific dependent.
The type is still in use as the base of a distinct type — drop the distinct type first.