Bug #21777 PLUGINS: (UN)INSTALL PLUGIN allowed in SF/Trigger but mysql.plugin not locked

Submitted: 22 Aug 2006 9:38 Modified: 24 Oct 2006 23:23
Reporter: Andrey Hristov Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.12-bk OS:Linux (Linux, possibly All)
Assigned to: Antony Curtis CPU Architecture:Any

[22 Aug 2006 9:38] Andrey Hristov
Description:
(UN)INSTALL PLUGIN is allowed in stored functions and triggers but when executed an error message that mysql.plugin wasn't locked comes out.

mysql> use test
Database changed
mysql> delimiter |
mysql> drop function if exists func_1|
Query OK, 0 rows affected (0.14 sec)

mysql> create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
Query OK, 0 rows affected (0.05 sec)

mysql> select func_1()|
ERROR 1100 (HY000): Table 'plugin' was not locked with LOCK TABLES
mysql> drop function func_1|
Query OK, 0 rows affected (0.12 sec)

mysql> select version()|
+------------------------------------+
| version()                          |
+------------------------------------+
| 5.1.12-beta-valgrind-max-debug-log |
+------------------------------------+
1 row in set (0.01 sec)

How to repeat:
use test;
delimiter |
drop function if exists func_1|
create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
select func_1()|
drop function func_1|
select version()|

Suggested fix:
Add the following to `install` and `uninstall` rules in sql_yacc.yy

    if (lex->sphead && lex->sphead->m_type != TYPE_ENUM_PROCEDURE)
    {
      /*
        Note that both (UN)INSTALL PLUGIN touch mysql.plugin
        So better disable them till they are SF/Trigger compatible.
      */
      my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "INSTALL PLUGIN");
      YYABORT;
    }          

or fix the locking of (UN)INSTALL PLUGIN to lock mysql.plugin as appropriate - add mysql.plugin as table to be prelocked.
[24 Aug 2006 6:50] Valeriy Kravchuk
Thank you for a bug report. Verified just as described on 5.1.12-BK (ChangeSet@1.2280, 2006-08-22 14:16:39+02:00):

openxs@suse:~/dbs/5.1> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.1.12-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> delimiter |
mysql> drop function if exists func_1|
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql> create function func_1() returns int begin install plugin my_plug soname
    -> '/tmp/plugin'; return 1; end|
Query OK, 0 rows affected (0.01 sec)

mysql> select func_1()|
ERROR 1100 (HY000): Table 'plugin' was not locked with LOCK TABLES
mysql> drop function func_1|
Query OK, 0 rows affected (0.00 sec)
[24 Oct 2006 23:23] Antony Curtis
Already fixed in source repository

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.