summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test46
1 files changed, 44 insertions, 2 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 49d6186f389..b3563e21bdd 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6258,6 +6258,32 @@ SELECT * FROM t11|
DROP TABLE t11, t12|
DROP FUNCTION bug19862|
+
+# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
+#
+# A regression caused by the fix for Bug#18444: for derived tables we should
+# set an empty string as the current database. They do not belong to any
+# database and must be usable even if there is no database
+# selected.
+--disable_warnings
+drop table if exists t3|
+drop database if exists mysqltest1|
+--enable_warnings
+create table t3 (a int)|
+insert into t3 (a) values (1), (2)|
+
+create database mysqltest1|
+use mysqltest1|
+drop database mysqltest1|
+
+# No current database
+select database()|
+
+select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
+use test|
+drop table t3|
+
+
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
#
# Prepare.
@@ -6291,6 +6317,7 @@ create procedure bug21416() show create procedure bug21416|
call bug21416()|
drop procedure bug21416|
+
#
# BUG#21414: SP: Procedure undroppable, to some extent
#
@@ -6310,6 +6337,21 @@ UNLOCK TABLES|
--echo The following should succeed.
DROP PROCEDURE bug21414|
+
+#
+# BUG#21311: Possible stack overrun if SP has non-latin1 name
+#
+set names utf8|
+--disable_warnings
+drop database if exists това_е_дълго_име_за_база_данни_нали|
+--enable_warnings
+create database това_е_дълго_име_за_база_данни_нали|
+INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','')|
+--error ER_SP_PROC_TABLE_CORRUPT
+call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
+drop database това_е_дълго_име_за_база_данни_нали|
+
+
#
# BUG#21493: Crash on the second call of a procedure containing
# a select statement that uses an IN aggregating subquery
@@ -6355,9 +6397,9 @@ INSERT INTO t4(Member_ID, Action, Action_Date, Track) VALUES
('666666', 'Enrolled', '2006-05-12', 'CHF' ),
('666666', 'Disenrolled', '2006-06-01', 'CAD' )|
-#--disable_warnings
+--disable_warnings
DROP FUNCTION IF EXISTS bug21493|
-#--enable_warnings
+--enable_warnings
CREATE FUNCTION bug21493(paramMember VARCHAR(15)) RETURNS varchar(45)
BEGIN