[MDEV-19852] Change plugin API to allow plugins to run a script when installed Created: 2019-06-24  Updated: 2019-06-28  Resolved: 2019-06-28

Status: Closed
Project: MariaDB Server
Component/s: Plugins
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Sergei Golubchik
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-19850 per-plugin install/uninstall scriptlets Stalled
Relates
relates to MDEV-19842 Crash while creating statistics for S... Closed

 Description   

In PostgreSQL, plugins can include a SQL script that creates any database objects that the plugin depends on. If you install the plugin with CREATE EXTENSION, then PostgreSQL will automatically execute the plugin's SQL script:

CREATE EXTENSION loads a new extension into the current database. There must not be an extension of the same name already loaded.

Loading an extension essentially amounts to running the extension's script file. The script will typically create new SQL objects such as functions, data types, operators and index support methods. CREATE EXTENSION additionally records the identities of all the created objects, so that they can be dropped again if DROP EXTENSION is issued.

Loading an extension requires the same privileges that would be required to create its component objects. For most extensions this means superuser or database owner privileges are needed. The user who runs CREATE EXTENSION becomes the owner of the extension for purposes of later privilege checks, as well as the owner of any objects created by the extension's script.

https://www.postgresql.org/docs/11/sql-createextension.html

It would be useful if we could build similar functionality on top of INSTALL PLUGIN/INSTALL SONAME, and maybe even --plugin-load/--plugin-load-add.

https://mariadb.com/kb/en/library/install-plugin/

https://mariadb.com/kb/en/library/install-soname/

https://mariadb.com/kb/en/library/mysqld-options/#-plugin-load

https://mariadb.com/kb/en/library/mysqld-options/#-plugin-load-add

One case where it would be extremely useful is with Spider. Spider users currently have to manually run install_spider.sql to install the plugin and create all dependent objects.

https://mariadb.com/kb/en/library/spider-installation/#configuring-spider-nodes


Generated at Thu Feb 08 08:54:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.