UNLOAD PLUGIN

Enterprise

Plugins are developed against the open-source questdb library and run only on QuestDB Enterprise.

Learn more

Unloads a plugin, removing its SQL functions and closing its class loader. Requires PLUGIN ADMIN permission.

Syntax

UNLOAD PLUGIN [IF LOADED] plugin_name;
  • plugin_name — the JAR filename, with or without the .jar extension. May be quoted or unquoted.
  • IF LOADED — optional clause that makes the command idempotent: no error is raised if the plugin is not loaded.

Description

UNLOAD PLUGIN performs the following steps:

  1. Checks that no currently-loaded plugin depends on this plugin. If one does, the command fails with an error naming the blocking dependent.
  2. Invokes PluginLifecycle.onUnload() if the plugin declared a lifecycle implementation.
  3. Removes all SQL functions contributed by the plugin from the function cache.
  4. Closes the plugin's URLClassLoader.

After a successful unload, the compiled query cache is flushed. Queries that reference any of the plugin's functions will fail on re-execution until the plugin is loaded again.

Examples

Unload a plugin
UNLOAD PLUGIN 'questdb-plugin-example-1.0.0';
Idempotent unload
UNLOAD PLUGIN IF LOADED 'questdb-plugin-example-1.0.0';
Unload with dependency ordering
-- Unload the dependent plugin first
UNLOAD PLUGIN 'questdb-plugin-jsonl-1.0.0';
-- Then unload the base plugin
UNLOAD PLUGIN 'questdb-plugin-example-1.0.0';

Error conditions

ErrorCause
Plugin not loadedThe plugin is not currently loaded and IF LOADED was not specified.
Cannot unload plugin X: plugin Y depends on itPlugin Y is loaded and depends on X. Unload Y first.

See also