1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Backport of revno: 2617.68.9

Bug #43272 HANDLER SQL command does not work under LOCK TABLES

HANDLER commands are now explicitly disallowed in LOCK TABLES mode.

Before, HANDLER OPEN gave the misleading error message: "Table x was 
not locked with LOCK TABLES". This patch changes HANDLER OPEN/READ/CLOSE 
to give ER_LOCK_OR_ACTIVE_TRANSACTION "Can't execute the given command 
because you have active locked tables or an active transaction" in
LOCK TABLES mode.

Test case added to lock.test.
This commit is contained in:
Jon Olav Hauglid
2009-12-08 15:56:06 +01:00
parent f28f985922
commit 9e1cb3fe1b
3 changed files with 55 additions and 0 deletions

View File

@@ -319,6 +319,21 @@ alter table t1 add column j int;
unlock tables;
drop table t1;
#
# Bug #43272 HANDLER SQL command does not work under LOCK TABLES
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
# HANDLER commands are not allowed in LOCK TABLES mode
HANDLER t1 OPEN;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
HANDLER t1 READ FIRST;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
HANDLER t1 CLOSE;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
UNLOCK TABLES;
DROP TABLE t1;
#
# Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
# LOCK TABLE
#

View File

@@ -385,6 +385,30 @@ alter table t1 add column j int;
unlock tables;
drop table t1;
--echo #
--echo # Bug #43272 HANDLER SQL command does not work under LOCK TABLES
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
--echo # HANDLER commands are not allowed in LOCK TABLES mode
--error ER_LOCK_OR_ACTIVE_TRANSACTION
HANDLER t1 OPEN;
--error ER_LOCK_OR_ACTIVE_TRANSACTION
HANDLER t1 READ FIRST;
--error ER_LOCK_OR_ACTIVE_TRANSACTION
HANDLER t1 CLOSE;
UNLOCK TABLES;
DROP TABLE t1;
--echo #
--echo # Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
--echo # LOCK TABLE