Database Reference
In-Depth Information
The
DROP EXTENSION
command will remove the extension from the database.
Dropping an extension will cause its component objects to be dropped as well. Keep
in mind that for removing an extension, you must own the extension or you are
logged in with the superuser. Let us go through all the parameters used in the
DROP
extension command:
•
IF EXISTS
: The
DROP
extension command will not throw an error if the
extension does not exist; only a notice is issued in this case
•
extension_name
: This is the name of an installed extension
•
CASCADE
: Using
CASCADE
will automatically drop other objects which depend
on the extension as well
•
RESTRICT
: It refuses to drop the extension if any other object depends on it
To remove the
adminpack
extension , we can use the following command:
warehouse_db=# DROP EXTENSION adminpack;
The preceding command will fail if any of the
adminpack
objects are in use in the
database. Adding
CASCADE
in command will forcefully remove all dependent objects.
How to check available extensions
The PostgreSQL extension system provides a way to check all the available extensions
of current installed system. It does not matter whether or not you have created the
extension, it will list all the available extensions with its respective version numbers.
The
pg_available_extensions
view has all the information about the extensions.
To check for the available extension, we will use the following command:
warehouse_db=# SELECT name, version FROM
pg_available_extension_versions;
name | version
--------------------+---------
pageinspect | 1.2
tcn | 1.0
pg_stat_statements | 1.2
adminpack | 1.0
pgrowlocks | 1.1
dict_int | 1.0
isn | 1.0
mongo_fdw | 1.0
dict_xsyn | 1.0
fuzzystrmatch | 1.0
insert_username | 1.0
intagg | 1.0