summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorDaniel Black <daniel@linux.ibm.com>2018-05-18 12:59:32 +1000
committerSergei Golubchik <serg@mariadb.org>2018-10-31 16:06:15 +0100
commitbb85d92d6f7e15731570917e2ea14b31aa872a56 (patch)
treee40fc4eb4ad71b4dd494ae76dc721e0c02496154 /mysql-test/main
parent4272eec050400a1913362cbcd215133ff3eccdd5 (diff)
downloadmariadb-git-bb85d92d6f7e15731570917e2ea14b31aa872a56.tar.gz
MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
Add INSTALL SONAME IF NOT EXISTS; syntax only, installing duplicate SONAMES doesn't currently cause any errors or warnings. UNINSTALL SONAME IF EXISTS was added. Allow the installation / uninstallation of plugins without doing checks for existence first.
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/plugin.result31
-rw-r--r--mysql-test/main/plugin.test19
2 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result
index 3a141a25b5c..b5ac9d3160a 100644
--- a/mysql-test/main/plugin.result
+++ b/mysql-test/main/plugin.result
@@ -331,3 +331,34 @@ UNINSTALL PLUGIN example;
RENAME TABLE t1 TO t2;
ERROR 42S02: Table 'test.t1' doesn't exist
DROP TABLE t1;
+#
+# INSTALL IF NOT EXISTS [PLUGIN name] SONAME library /
+# UNINSTALL IF EXISTS PLUGIN|SONAME name
+#
+#
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+plugin_name
+INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+plugin_name
+EXAMPLE
+INSTALL PLUGIN IF NOT EXISTS EXAMPLE SONAME 'ha_example';
+SHOW WARNINGS;
+Level Code Message
+Note 1968 Plugin 'EXAMPLE' already installed
+INSTALL SONAME IF NOT EXISTS 'ha_example';
+SHOW WARNINGS;
+Level Code Message
+Note 1968 Plugin 'EXAMPLE' already installed
+UNINSTALL PLUGIN IF EXISTS example;
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+plugin_name
+UNUSABLE
+UNINSTALL SONAME IF EXISTS 'ha_example';
+Warnings:
+Note 1305 PLUGIN EXAMPLE does not exist
+SHOW WARNINGS;
+Level Code Message
+Note 1305 PLUGIN EXAMPLE does not exist
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+plugin_name
diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test
index 68c4d5afd64..3dad1ab2f73 100644
--- a/mysql-test/main/plugin.test
+++ b/mysql-test/main/plugin.test
@@ -265,3 +265,22 @@ UNINSTALL PLUGIN example;
--error ER_NO_SUCH_TABLE
RENAME TABLE t1 TO t2;
DROP TABLE t1;
+
+--echo #
+--echo # INSTALL IF NOT EXISTS [PLUGIN name] SONAME library /
+--echo # UNINSTALL IF EXISTS PLUGIN|SONAME name
+--echo #
+--echo #
+
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+INSTALL PLUGIN IF NOT EXISTS EXAMPLE SONAME 'ha_example';
+SHOW WARNINGS;
+INSTALL SONAME IF NOT EXISTS 'ha_example';
+SHOW WARNINGS;
+UNINSTALL PLUGIN IF EXISTS example;
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+UNINSTALL SONAME IF EXISTS 'ha_example';
+SHOW WARNINGS;
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';