DROP TYPE
Immediately and irreversibly removes a UDT (user-defined type).
Restriction: Dropping a user-defined type that is in use by a table or another type is not supported.
Synopsis
DROP TYPE [ IF EXISTS ] [<keyspace_name>.]<type_name> ;
Syntax legend
Syntax conventions | Description |
---|---|
UPPERCASE |
Literal keyword. |
Lowercase |
Not literal. |
|
Variable value. Replace with a user-defined value. |
|
Optional.
Square brackets ( |
|
Group.
Parentheses ( |
|
Or.
A vertical bar ( |
|
Repeatable.
An ellipsis ( |
|
Single quotation ( |
|
Map collection.
Braces ( |
Set, list, map, or tuple.
Angle brackets ( |
|
|
End CQL statement.
A semicolon ( |
|
Separate the command line options from the command arguments with two hyphens ( |
|
Search CQL only: Single quotation marks ( |
|
Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrConfig files. |
Examples
Attempting to drop a type that is in use by a table:
DROP TYPE IF EXISTS cycling.basic_info;
Error message with the table names that contain the type:
InvalidRequest: Error from server: code=2200 [Invalid query]
message="Cannot drop user type cycling.basic_info as it is still
used by table cycling.cyclist_stats"
Drop the table that uses the type:
DROP TABLE IF EXISTS cycling.cyclist_stats;
Drop the type:
DROP TYPE IF EXISTS cycling.basic_info;