PIGSTY

Remove

How to remove PostgreSQL extensions

Remove Extension

To uninstall an extension, you typically need to run the DROP EXTENSION SQL statement:

DROP EXTENSION "<extname>";

If other extensions or database objects depend on this extension, you’ll need to remove those dependencies first before uninstalling the extension. Or remove all of them with CASCADE option:

DROP EXTENSION "<extname>" CASCADE;

The CASCADE option will delete all objects that depend on this extension,
including database objects, functions, views, etc. Use with caution!

Some extensions don't have DDL, these extensions do not require the DROP EXTENSION statement to uninstall. Instead, you can simply remove the extension from the shared_preload_libraries (if configured) and uninstall the package. Refer to the Extensions Without DDL section for more details.


Remove Loading

If you’re using an extension that requires dynamic loading (which modifies the shared_preload_libraries parameter), you need to first re-confnigure the shared_preload_libraries parameter.

Remove the extension name from shared_preload_libraries and restart the database cluster for the changes to take effect.

For extensions that need dynamic loading, refer to the Extensions that Need Loading list.


Uninstall Package

After removing the extension (logical object) from all databases in the cluster, you can safely uninstall the extension’s software package. Ansible commands can help you do this conveniently:

ansible <cls> -m package -a "name=<extname> state=absent"

You can also use pig, or apt/yum commands directly to uninstall.

If you don’t know the extension package name, you can refer to the Extension List or check the extension package name mapping defined in roles/node_id/vars.