DROP EXTENSION
remove an extension
English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- anchor
- SQL-DROPEXTENSION
- file
- sql-dropextension.html
- lang
- en
- name
- DROP EXTENSION
- purpose
- remove an extension
- purpose zh
- 移除一个扩展
- sections same as
- Unknown
- slug
- 18
- synopsis html
- DROP EXTENSION [ IF EXISTS ] <em class="replaceable"><code>name</code></em> [, ...] [ CASCADE | RESTRICT ]
- synopsis text
- DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Syntax
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Definition PG 18
DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Description
DROP EXTENSION removes extensions from the database. Dropping an extension causes its member objects, and other explicitly dependent routines (see ALTER ROUTINE, the DEPENDS ON EXTENSION action), to be dropped as well.extension_name
You must own the extension to use DROP EXTENSION.
Parameters
IF EXISTSDo not throw an error if the extension does not exist. A notice is issued in this case.
nameThe name of an installed extension.
CASCADEAutomatically drop objects that depend on the extension, and in turn all objects that depend on those objects (see Section 5.15).
RESTRICTThis option prevents the specified extensions from being dropped if other objects, besides these extensions, their members, and their explicitly dependent routines, depend on them. This is the default.
Examples
To remove the extension hstore from the current database:
DROP EXTENSION hstore;
This command will fail if any of hstore's objects are in use in the database, for example if any tables have columns of the hstore type. Add the CASCADE option to forcibly remove those dependent objects as well.
Compatibility
DROP EXTENSION is a PostgreSQL extension.
See Also
CREATE EXTENSION, ALTER EXTENSIONCompare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:80a6d62869484ad161d5fb1d1c35180857fbf516554a7d5b33e8bcae9cc99c3f
Text language: en · wiki-repair-20261023:80a6d62869484ad161d5fb1d1c35180857fbf516554a7d5b33e8bcae9cc99c3f