summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/drop.result20
-rw-r--r--mysql-test/r/errors.result36
-rw-r--r--mysql-test/r/group_by.result3
-rw-r--r--mysql-test/r/insert_notembedded.result1
-rw-r--r--mysql-test/r/lock.result6
-rw-r--r--mysql-test/r/lock_multi.result10
-rw-r--r--mysql-test/r/myisam.result2
-rw-r--r--mysql-test/r/query_cache_notembedded.result1
-rw-r--r--mysql-test/r/sp-error.result23
-rw-r--r--mysql-test/r/sp.result34
-rw-r--r--mysql-test/r/status.result6
-rw-r--r--mysql-test/r/view.result3
-rw-r--r--mysql-test/t/drop.test33
-rw-r--r--mysql-test/t/errors.test34
-rw-r--r--mysql-test/t/group_by.test3
-rw-r--r--mysql-test/t/insert_notembedded.test1
-rw-r--r--mysql-test/t/lock.test6
-rw-r--r--mysql-test/t/lock_multi.test38
-rw-r--r--mysql-test/t/myisam.test2
-rw-r--r--mysql-test/t/query_cache_notembedded.test1
-rw-r--r--mysql-test/t/sp-error.test37
-rw-r--r--mysql-test/t/sp.test21
-rw-r--r--mysql-test/t/status.test15
-rw-r--r--mysql-test/t/view.test3
24 files changed, 329 insertions, 10 deletions
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 42739b10d50..54bd05e526f 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -86,6 +86,26 @@ select 1;
1
1
unlock tables;
+drop table if exists t1,t2;
+create table t1 (a int);
+create table t2 (a int);
+lock table t1 read;
+drop table t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+drop table t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t1,t2;
+create table t1 (i int);
+create table t2 (i int);
+lock tables t1 read;
+lock tables t2 read;
+drop table t1;
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+drop table t1,t2;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t1,t2;
End of 5.0 tests
create database mysql_test;
create table mysql_test.t1(f1 int);
diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result
index d15daf2e4b0..b5863b94026 100644
--- a/mysql-test/r/errors.result
+++ b/mysql-test/r/errors.result
@@ -55,6 +55,42 @@ Error 1054 Unknown column 'b' in 'field list'
INSERT INTO t1 SELECT b FROM t1;
ERROR 42S22: Unknown column 'b' in 'field list'
DROP TABLE t1;
+flush status;
+drop table if exists t1, t2;
+create table t1 (a int unique);
+create table t2 (a int);
+drop function if exists f1;
+Warnings:
+Note 1305 FUNCTION f1 does not exist
+drop function if exists f2;
+Warnings:
+Note 1305 FUNCTION f2 does not exist
+create function f1() returns int
+begin
+insert into t1 (a) values (1);
+insert into t1 (a) values (1);
+return 1;
+end|
+create function f2() returns int
+begin
+insert into t2 (a) values (1);
+return 2;
+end|
+flush status;
+select f1(), f2();
+ERROR 23000: Duplicate entry '1' for key 'a'
+show status like 'Com_insert';
+Variable_name Value
+Com_insert 2
+select * from t1;
+a
+1
+select * from t2;
+a
+drop table t1;
+drop table t2;
+drop function f1;
+drop function f2;
SET NAMES utf8;
SET sql_quote_show_create= _binary x'5452C39C45';
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'TR\xC3\x9CE'
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 742d4b90807..e6063047ba4 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -107,8 +107,9 @@ SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2
cid CONCAT(firstname, ' ', surname) COUNT(call_id)
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
cid CONCAT(firstname, ' ', surname) COUNT(call_id)
-drop table t1,t2;
+drop table t2;
unlock tables;
+drop table t1;
CREATE TABLE t1 (
bug_id mediumint(9) NOT NULL auto_increment,
groupset bigint(20) DEFAULT '0' NOT NULL,
diff --git a/mysql-test/r/insert_notembedded.result b/mysql-test/r/insert_notembedded.result
index ac69cb65972..2315d695abe 100644
--- a/mysql-test/r/insert_notembedded.result
+++ b/mysql-test/r/insert_notembedded.result
@@ -122,5 +122,6 @@ a b
connection: default
select * from t1;
a b
+unlock tables;
drop table t1;
set low_priority_updates=default;
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 7ec07fb5273..1f8f6aa04ae 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -48,6 +48,9 @@ unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
drop table t1,t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+drop table t1,t2;
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
@@ -69,6 +72,9 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
delete t2 from t1,t2 where t1.a=t2.a;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
drop table t1,t2;
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t2,t1;
End of 4.1 tests.
drop table if exists t1;
create table t1 (a int);
diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
index d8768e802ea..3f1165fd069 100644
--- a/mysql-test/r/lock_multi.result
+++ b/mysql-test/r/lock_multi.result
@@ -27,6 +27,7 @@ update t1,t2 set c=a where b=d;
select c from t2;
c
2
+unlock tables;
drop table t1;
drop table t2;
create table t1 (a int);
@@ -209,3 +210,12 @@ select @tlwa < @tlwb;
@tlwa < @tlwb
1
End of 5.1 tests
+drop table if exists t1;
+create table t1 (i int);
+connection: default
+lock tables t1 write;
+connection: flush
+flush tables with read lock;;
+connection: default
+flush tables;
+drop table t1;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 95fdc4fb93d..16e8a8e5ad1 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -529,6 +529,7 @@ select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
a a b
1 1 1
2 2 1
+unlock tables;
drop table t1,t2;
CREATE TABLE t1 (c1 varchar(250) NOT NULL);
CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1));
@@ -542,6 +543,7 @@ INSERT INTO t2 VALUES ('test000001'), ('test000005');
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
t1c1 t2c1
+UNLOCK TABLES;
DROP TABLE t1,t2;
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
Got one of the listed errors
diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result
index d9bf7a6d814..25894634bf3 100644
--- a/mysql-test/r/query_cache_notembedded.result
+++ b/mysql-test/r/query_cache_notembedded.result
@@ -93,6 +93,7 @@ a
3
SELECT * FROM t1;
a
+UNLOCK TABLES;
drop table t1;
flush query cache;
reset query cache;
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 499506957fa..7a3cb55858b 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1659,6 +1659,29 @@ begin
declare continue handler for sqlstate '00000' set @x=0;
end$$
ERROR 42000: Bad SQLSTATE: '00000'
+drop procedure if exists proc_36510;
+create procedure proc_36510()
+begin
+declare should_be_illegal condition for sqlstate '00123';
+declare continue handler for should_be_illegal set @x=0;
+end$$
+ERROR 42000: Bad SQLSTATE: '00123'
+create procedure proc_36510()
+begin
+declare continue handler for sqlstate '00123' set @x=0;
+end$$
+ERROR 42000: Bad SQLSTATE: '00123'
+create procedure proc_36510()
+begin
+declare should_be_illegal condition for 0;
+declare continue handler for should_be_illegal set @x=0;
+end$$
+ERROR HY000: Incorrect CONDITION value: '0'
+create procedure proc_36510()
+begin
+declare continue handler for 0 set @x=0;
+end$$
+ERROR HY000: Incorrect CONDITION value: '0'
drop procedure if exists p1;
set @old_recursion_depth = @@max_sp_recursion_depth;
set @@max_sp_recursion_depth = 255;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 26ba2af8f68..a73abf787d8 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3321,9 +3321,43 @@ call bug11529()|
call bug11529()|
delete from t1|
drop procedure bug11529|
+set character set utf8|
drop procedure if exists bug6063|
drop procedure if exists bug7088_1|
drop procedure if exists bug7088_2|
+create procedure bug6063()
+begin
+lâbel: begin end;
+label: begin end;
+label1: begin end;
+end|
+create procedure bug7088_1()
+label1: begin end label1|
+create procedure bug7088_2()
+läbel1: begin end|
+call bug6063()|
+call bug7088_1()|
+call bug7088_2()|
+set character set default|
+show create procedure bug6063|
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+bug6063 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug6063`()
+begin
+lâbel: begin end;
+label: begin end;
+label1: begin end;
+end utf8 latin1_swedish_ci latin1_swedish_ci
+show create procedure bug7088_1|
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+bug7088_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug7088_1`()
+label1: begin end label1 utf8 latin1_swedish_ci latin1_swedish_ci
+show create procedure bug7088_2|
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+bug7088_2 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug7088_2`()
+läbel1: begin end utf8 latin1_swedish_ci latin1_swedish_ci
+drop procedure bug6063|
+drop procedure bug7088_1|
+drop procedure bug7088_2|
drop procedure if exists bug9565_sub|
drop procedure if exists bug9565|
create procedure bug9565_sub()
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index ce3acba9b8a..c0cd0f7bc1a 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -238,5 +238,11 @@ SELECT 9;
9
DROP PROCEDURE p1;
DROP FUNCTION f1;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+NAME
+DROP VIEW v1;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index f9156d4ae70..b10c542f644 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1104,6 +1104,9 @@ select * from t2;
ERROR HY000: Table 't2' was not locked with LOCK TABLES
drop view v1;
drop table t1, t2;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t1, t2;
create table t1 (a int);
create view v1 as select * from t1 where a < 2 with check option;
insert into v1 values(1);
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 6be4ea25007..4aeb7165bcb 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -124,6 +124,39 @@ disconnect addconroot1;
--source include/wait_until_disconnected.inc
connection default;
+#
+# Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks
+#
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+create table t1 (a int);
+create table t2 (a int);
+lock table t1 read;
+--error ER_TABLE_NOT_LOCKED
+drop table t2;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop table t1;
+unlock tables;
+drop table t1,t2;
+connect (addconroot, localhost, root,,);
+connection default;
+create table t1 (i int);
+create table t2 (i int);
+lock tables t1 read;
+connection addconroot;
+lock tables t2 read;
+--error ER_TABLE_NOT_LOCKED
+drop table t1;
+connection default;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop table t1,t2;
+disconnect addconroot;
+connection default;
+unlock tables;
+drop table t1,t2;
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
index 820766c3a78..44c514f1244 100644
--- a/mysql-test/t/errors.test
+++ b/mysql-test/t/errors.test
@@ -68,6 +68,40 @@ INSERT INTO t1 SELECT b FROM t1;
DROP TABLE t1;
# End of 5.0 tests
+flush status;
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+create table t1 (a int unique);
+create table t2 (a int);
+drop function if exists f1;
+drop function if exists f2;
+
+delimiter |;
+
+create function f1() returns int
+begin
+ insert into t1 (a) values (1);
+ insert into t1 (a) values (1);
+ return 1;
+end|
+create function f2() returns int
+begin
+ insert into t2 (a) values (1);
+ return 2;
+end|
+delimiter ;|
+
+flush status;
+--error 1062
+select f1(), f2();
+show status like 'Com_insert';
+select * from t1;
+select * from t2;
+drop table t1;
+drop table t2;
+drop function f1;
+drop function f2;
#
# testing the value encoding in the error messages of set_var
#
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 5b96213034a..7ed8dfe5784 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -120,8 +120,9 @@ SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2
SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
-drop table t1,t2;
+drop table t2;
unlock tables;
+drop table t1;
#
# Test of group by bug in bugzilla
diff --git a/mysql-test/t/insert_notembedded.test b/mysql-test/t/insert_notembedded.test
index 24040f9c310..2950acff3cc 100644
--- a/mysql-test/t/insert_notembedded.test
+++ b/mysql-test/t/insert_notembedded.test
@@ -185,5 +185,6 @@ select * from t1;
connection default;
disconnect update;
disconnect select;
+unlock tables;
drop table t1;
set low_priority_updates=default;
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
index 30f4d4d6c61..04994e3e48f 100644
--- a/mysql-test/t/lock.test
+++ b/mysql-test/t/lock.test
@@ -58,6 +58,9 @@ insert into t1 select index1,nr from t1;
unlock tables;
lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias;
+--error ER_TABLE_NOT_LOCKED
+drop table t1,t2;
+unlock tables;
drop table t1,t2;
#
@@ -90,7 +93,10 @@ delete t1 from t1,t2 where t1.a=t2.a;
delete from t2 using t1,t2 where t1.a=t2.a;
--error 1099
delete t2 from t1,t2 where t1.a=t2.a;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop table t1,t2;
+unlock tables;
+drop table t2,t1;
--echo End of 4.1 tests.
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
index dbaa96b0374..75ee6d07723 100644
--- a/mysql-test/t/lock_multi.test
+++ b/mysql-test/t/lock_multi.test
@@ -76,6 +76,7 @@ update t1,t2 set c=a where b=d;
connection reader;
select c from t2;
connection locker;
+unlock tables;
drop table t1;
drop table t2;
@@ -635,6 +636,41 @@ select @tlwa < @tlwb;
--echo End of 5.1 tests
+#
+# Test that DROP TABLES does not wait for a impending FLUSH TABLES
+# WITH READ LOCK
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (i int);
+connect (flush,localhost,root,,test,,);
+connection default;
+--echo connection: default
+lock tables t1 write;
+connection flush;
+--echo connection: flush
+--send flush tables with read lock;
+connection default;
+--echo connection: default
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Flushing tables";
+--source include/wait_condition.inc
+flush tables;
+let $wait_condition=
+ select count(*) = 1 from information_schema.processlist
+ where state = "Flushing tables";
+--source include/wait_condition.inc
+drop table t1;
+let $wait_condition=
+ select count(*) = 0 from information_schema.processlist
+ where state = "Flushing tables";
+--source include/wait_condition.inc
+connection flush;
+--reap
+connection default;
+disconnect flush;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 56fe103adc9..3ee61dcbc1f 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -503,6 +503,7 @@ insert into t2 values(2,0);
disconnect root;
connection default;
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
+unlock tables;
drop table t1,t2;
#
# Full key.
@@ -520,6 +521,7 @@ disconnect con1;
connection default;
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
+UNLOCK TABLES;
DROP TABLE t1,t2;
# End of 4.0 tests
diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test
index 095d47f5bdf..77033ced564 100644
--- a/mysql-test/t/query_cache_notembedded.test
+++ b/mysql-test/t/query_cache_notembedded.test
@@ -99,6 +99,7 @@ connection root2;
SELECT * FROM t1;
connection root;
SELECT * FROM t1;
+UNLOCK TABLES;
drop table t1;
connection default;
disconnect root;
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index b022ca4b0e1..a9bb80647bc 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -2420,6 +2420,43 @@ end$$
delimiter ;$$
#
+# Bug#36510 (Stored Procedures: mysql_error_code 0 should be illegal)
+#
+
+--disable_warnings
+drop procedure if exists proc_36510;
+--enable_warnings
+
+delimiter $$;
+
+--error ER_SP_BAD_SQLSTATE
+create procedure proc_36510()
+begin
+ declare should_be_illegal condition for sqlstate '00123';
+ declare continue handler for should_be_illegal set @x=0;
+end$$
+
+--error ER_SP_BAD_SQLSTATE
+create procedure proc_36510()
+begin
+ declare continue handler for sqlstate '00123' set @x=0;
+end$$
+
+--error ER_WRONG_VALUE
+create procedure proc_36510()
+begin
+ declare should_be_illegal condition for 0;
+ declare continue handler for should_be_illegal set @x=0;
+end$$
+
+--error ER_WRONG_VALUE
+create procedure proc_36510()
+begin
+ declare continue handler for 0 set @x=0;
+end$$
+delimiter ;$$
+
+#
# Bug#15192: "fatal errors" are caught by handlers in stored procedures
#
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index a9825d13f66..b0342491a34 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -4061,34 +4061,41 @@ drop procedure bug11529|
# BUG#6063: Stored procedure labels are subject to restrictions (partial)
# BUG#7088: Stored procedures: labels won't work if character set is utf8
#
+
+set character set utf8|
+
--disable_warnings
drop procedure if exists bug6063|
drop procedure if exists bug7088_1|
drop procedure if exists bug7088_2|
--enable_warnings
---disable_parsing # temporarily disabled until Bar fixes BUG#11986
create procedure bug6063()
- lâbel: begin end|
-call bug6063()|
-# QQ Known bug: this will not show the label correctly.
-show create procedure bug6063|
+begin
+ lâbel: begin end;
+ label: begin end;
+ label1: begin end;
+end|
-set character set utf8|
create procedure bug7088_1()
label1: begin end label1|
+
create procedure bug7088_2()
läbel1: begin end|
+
+call bug6063()|
call bug7088_1()|
call bug7088_2()|
+
set character set default|
+
+show create procedure bug6063|
show create procedure bug7088_1|
show create procedure bug7088_2|
drop procedure bug6063|
drop procedure bug7088_1|
drop procedure bug7088_2|
---enable_parsing
#
# BUG#9565: "Wrong locking in stored procedure if a sub-sequent procedure
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 5da210f5a69..f951218f5c8 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -353,6 +353,21 @@ DROP FUNCTION f1;
# End of 5.1 tests
+#
+# Bug#17954 Threads_connected > Threads_created
+#
+
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+
+DROP VIEW v1;
+
# Restore global concurrent_insert value. Keep in the end of the test file.
--connection default
set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index e180d4ebab8..4515f26bc52 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1017,6 +1017,9 @@ select * from v1;
-- error ER_TABLE_NOT_LOCKED
select * from t2;
drop view v1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+drop table t1, t2;
+unlock tables;
drop table t1, t2;
#