Updated on 2024-06-03 GMT+08:00

DROP EXTENSION

The extended function is for internal use only. You are advised not to use it.

Description

Deletes an extension.

Precautions

  • The DROP EXTENSION command deletes an extension from the database. When you delete an extension, the components that make up the extension are also deleted.
  • The DROP EXTENSION command can be used only by the owner of the extension.

Syntax

DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ];

Parameters

  • IF EXISTS

    If the IF EXISTS parameter is used and the extension does not exist, no error is reported. Instead, a notice is generated.

  • name

    Specifies the name of an installed extension.

  • CASCADE

    Automatically deletes objects that depend on the extension.

  • RESTRICT

    If any object depends on an extension, the extension cannot be deleted (unless all its member objects and other extension objects are deleted at a time using the DROP command). This is a default processing.

Examples

Delete the PL/pgSQL extension from the current database. The PL/pgSQL extension is created by the database by default.

gaussdb=# DROP EXTENSION plpgsql;

In the current database, if an object that uses PL/pgSQL exists, this command will fail. For example, a column in any table is of the PL/pgSQL type. Adding the CASCADE option can forcibly delete the extension and objects that depend on it.

Helpful Links

ALTER EXTENSION and CREATE EXTENSION