diff options
author | thek@adventure.(none) <> | 2007-07-27 16:56:29 +0200 |
---|---|---|
committer | thek@adventure.(none) <> | 2007-07-27 16:56:29 +0200 |
commit | 889b4ebcee0cbbc01cc1d87d04a9c2524dc49408 (patch) | |
tree | 2debe5900b642c4da4ed6a2427488d82f62e2784 /mysql-test/t/sp-prelocking.test | |
parent | 4c208499a409d9e558ca019e9e101115d801bab7 (diff) | |
download | mariadb-git-889b4ebcee0cbbc01cc1d87d04a9c2524dc49408.tar.gz |
Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
When a table was explicitly locked with LOCK TABLES no associated
tables from any related trigger on the subject table were locked.
As a result of this the user could experience unexpected locking
behavior and statement failures similar to "failed: 1100: Table'xx'
was not locked with LOCK TABLES".
This patch fixes this problem by making sure triggers are
pre-loaded on any statement if the subject table was explicitly
locked with LOCK TABLES.
Diffstat (limited to 'mysql-test/t/sp-prelocking.test')
-rw-r--r-- | mysql-test/t/sp-prelocking.test | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test index 60e97260839..966c59a5789 100644 --- a/mysql-test/t/sp-prelocking.test +++ b/mysql-test/t/sp-prelocking.test @@ -356,4 +356,35 @@ create table t1 select f_bug22427() as i; drop table t1; drop function f_bug22427; +--echo # +--echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables +--echo # +--disable_warnings +DROP table IF EXISTS t1,t2; +--enable_warnings +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c2 INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +DELIMITER //; +CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW +BEGIN +UPDATE t2 SET c2= c2 + 1; +END// +DELIMITER ;// +--echo # Take a table lock on t1. +--echo # This should pre-lock t2 through the trigger. +LOCK TABLE t1 WRITE; +INSERT INTO t1 VALUES (3); +UNLOCK TABLES; +LOCK TABLE t1 READ; +--error ER_TABLE_NOT_LOCKED +INSERT INTO t2 values(4); +UNLOCK TABLES; +SELECT * FROM t1; +SELECT * FROM t2; +DROP TRIGGER t1_ai; +DROP TABLE t1, t2; + --echo End of 5.0 tests + |