Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19852

Change plugin API to allow plugins to run a script when installed

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Fix Version/s: N/A
    • Component/s: Plugins
    • Labels:
      None

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                GeoffMontee Geoff Montee
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: