diff options
Diffstat (limited to 'mysql-test/t/sp-prelocking.test')
-rw-r--r-- | mysql-test/t/sp-prelocking.test | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test index ec5b7fbad7c..966c59a5789 100644 --- a/mysql-test/t/sp-prelocking.test +++ b/mysql-test/t/sp-prelocking.test @@ -333,4 +333,58 @@ insert into bug_27907_t1(a) values (1); drop table bug_27907_t1; +--echo +--echo Bug#22427 create table if not exists + stored function results in +--echo inconsistent behavior +--echo +--echo Add a test case, the bug itself was fixed by the patch for +--echo Bug#20662 +--echo +--disable_warnings +drop table if exists t1; +drop function if exists f_bug22427; +--enable_warnings +create table t1 (i int); +insert into t1 values (1); +create function f_bug22427() returns int return (select max(i) from t1); +select f_bug22427(); +# Until this bug was fixed, the following emitted error +# ERROR 1213: Deadlock found when trying to get lock +create table if not exists t1 select f_bug22427() as i; +--error ER_TABLE_EXISTS_ERROR +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 + |