Bug #26240 Creating a trigger on a locked table hangs the session
Submitted: 9 Feb 2007 21:42 Modified: 12 Feb 2007 7:33
Reporter: Giuseppe Maxia Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Locking Severity:S2 (Serious)
Version:5.0.36,5.1.15 OS:Linux (Linux, Mac OS X)
Assigned to: CPU Architecture:Any
Tags: locking, triggers

[9 Feb 2007 21:42] Giuseppe Maxia
Description:
If you lock a table and then try to create a trigger, the session hangs.

   DROP TABLE IF EXISTS t1;
   CREATE TABLE t1 (i int);
   LOCK TABLE t1 WRITE;
   create trigger t1_bi before insert on t1 for each row set @a:=1;

After these commands, the session is locked for its own user, who can't unlock it.

This can be related to bug#23713  

How to repeat:
--disable_warnings
   DROP TABLE IF EXISTS t1;
--enable_warnings
   CREATE TABLE t1 (i int) engine=myisam;
   LOCK TABLE t1 WRITE;
   create trigger t1_bi before insert on t1 for each row set @a:=1;

Suggested fix:
Perhaps forbidding the trigger creation when a table is locked?
[12 Feb 2007 7:33] Giuseppe Maxia
This bug is fixed in 5.0 by the same patch issued for bug#23713
 
(http://lists.mysql.com/commits/19659)

Changing the status to duplicate.