Updated on 2024-05-07 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

  • DROP EXTENSION 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

    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 extension plpgsql from the current database.

DROP EXTENSION plpgsql;

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