1--echo #
2--echo # MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS
3--echo #
4--echo # INSTALL IF NOT EXISTS PLUGIN name SONAME library /
5--echo # UNINSTALL IF EXISTS PLUGIN|SONAME name
6--echo #
7
8if (!$HA_EXAMPLE_SO) {
9  skip Needs ha_example plugin;
10}
11
12select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
13INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
14select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
15
16--replace_regex /\.dll/.so/
17--error ER_PLUGIN_INSTALLED
18INSTALL PLUGIN example SONAME 'ha_example';
19
20INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
21SHOW WARNINGS;
22
23UNINSTALL PLUGIN IF EXISTS example;
24select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
25
26UNINSTALL PLUGIN IF EXISTS example;
27SHOW WARNINGS;
28
29--error ER_SP_DOES_NOT_EXIST
30UNINSTALL PLUGIN example;
31
32INSTALL SONAME 'ha_example';
33select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
34
35UNINSTALL SONAME IF EXISTS 'ha_example';
36
37--replace_regex /\.dll/.so/
38UNINSTALL SONAME IF EXISTS 'ha_example';
39--replace_regex /\.dll/.so/
40SHOW WARNINGS;
41select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
42
43--replace_regex /\.dll/.so/
44--error ER_SP_DOES_NOT_EXIST
45UNINSTALL SONAME 'ha_example';
46