Run custom commands when an extension is dropped. By default, DROP EXTENSION simply drops all the objects the extension owns; this lets you
register additional SQL to run when a given extension is dropped.
Requires cat_tools >= 0.2.1.
None of these are granted to PUBLIC except where noted, since
extension_drop__add/extension_drop__update let the caller register
arbitrary SQL to run later. Grant them to specific roles as needed.
-
extension_drop__add(extension_name name, sql text) RETURNS voidRegistersqlto run whenextension_nameis dropped. -
extension_drop__update(extension_name name, sql text) RETURNS voidReplace the SQL registered forextension_name. -
extension_drop__remove(extension_name name) RETURNS voidRemove the SQL registered forextension_name. -
extension_drop__get(extension_name name) RETURNS extension_drop__commandsLook up the row (extension_name,sql) registered forextension_name. Granted toPUBLICby default. -
extension_drop__sanity_check(ignore name DEFAULT NULL) RETURNS name[]Returns the names of extensions that have registered drop commands but no longer exist. Should always return an empty array; pass an extension name viaignoreto exclude it from the check (useful while dropping that extension). Granted toPUBLICby default. -
extension_drop__sanity_assert(ignore name DEFAULT NULL) RETURNS voidRaises an error ifextension_drop__sanity_check()(called with the sameignoreargument) isn't empty. Granted toPUBLICby default. -
extension_drop__repair() RETURNS voidDeletes any stale rows found byextension_drop__sanity_check(). This should never be needed in normal operation.
An event trigger (extension_drop, on sql_drop) fires whenever an
extension is dropped, runs any SQL registered for it via
extension_drop__add/extension_drop__update, and removes the registration
afterward.