Uninstall a PostgreSQL Extension

PostgreSQL extension functionality allows for bundling multiple SQL objects together in a single package that can be loaded or removed from your database.

Once you load it into your database, extensions can function as built-in features.

The ENABLE ORACLE’S COMPATIBILITY FUNCTIONS AND PACKAGES IN YSQL tip shows you how to add an extension to your YugabyteDB database, but how do we remove the extension if it is no longer required?

Use the DROP EXTENSION command.

Example:

				
					yugabyte=> \dx -- Display installed Extensions
                                                         List of installed extensions
        Name        |  Version   |   Schema   |                                          Description
--------------------+------------+------------+-----------------------------------------------------------------------------------------------
 orafce             | 3.14       | public     | Functions and operators that emulate a subset of functions and packages from the Oracle RDBMS
 pg_stat_statements | 1.6        | pg_catalog | track execution statistics of all SQL statements executed
 pg_trgm            | 1.4-yb-1.0 | public     | text similarity measurement and index searching based on trigrams
 plpgsql            | 1.0        | pg_catalog | PL/pgSQL procedural language
(4 rows)

yugabyte=> DROP EXTENSION orafce;
DROP EXTENSION

yugabyte=> \dx
                                           List of installed extensions
        Name        |  Version   |   Schema   |                            Description
--------------------+------------+------------+-------------------------------------------------------------------
 pg_stat_statements | 1.6        | pg_catalog | track execution statistics of all SQL statements executed
 pg_trgm            | 1.4-yb-1.0 | public     | text similarity measurement and index searching based on trigrams
 plpgsql            | 1.0        | pg_catalog | PL/pgSQL procedural language
(3 rows)
				
			

Have Fun!