Reputation: 4815
I have created a datatype in PostgreSQL using folloing line:
CREATE TYPE ABC AS (A CHARACTER(1), B CHARACTER(2), C BIGINT);
I didn't define this datatype. Now I want to delete this prototype. What is the way or command to delete this?
Upvotes: 8
Views: 16172
Reputation: 46
Note:
Ensure to put quotes in type name to correctly search on database, otherwise it will throw that doesn't exist.
Example:
DROP TYPE "NameOfType" CASCADE;
Upvotes: 0
Reputation: 106
You can provide the schema name first
DROP TYPE schema_name.type_name;
Upvotes: 0
Reputation: 17157
You can remove a data type using
DROP TYPE type_name;
Click here for manual reference for DROP TYPE
Remember, that if you have other objects that depend on the type you are trying to delete, it would yield an error
ERROR: cannot drop type type_name because other objects depend on it
with list of dependencies.
If you would also like to DROP
those objects type
DROP TYPE type_name CASCADE;
Upvotes: 22