DROP EXTENSION

Synopsis

Use the DROP EXTENSION statement to remove an extension from the database.

Syntax

drop_extension ::= DROP EXTENSION [ IF EXISTS ] extension_name 
                   [ , ... ] [ CASCADE | RESTRICT ]

drop_extension

DROPEXTENSIONIFEXISTS,extension_nameCASCADERESTRICT

Semantics

  • An error is thrown if the extension does not exist unless IF EXISTS is used. Then, a notice is issued instead.
  • RESTRICT is the default, and it will not drop the extension if any objects depend on it.
  • CASCADE drops any objects that transitively depend on the extension.

Examples

DROP EXTENSION IF EXISTS cube;
NOTICE:  extension "cube" does not exist, skipping
CREATE EXTENSION cube;
CREATE EXTENSION earthdistance;
DROP EXTENSION IF EXISTS cube RESTRICT;
ERROR:  cannot drop extension cube because other objects depend on it
DETAIL:  extension earthdistance depends on function cube_out(cube)
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
DROP EXTENSION IF EXISTS cube CASCADE;
NOTICE:  drop cascades to extension earthdistance
DROP EXTENSION

See also