summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/bug13633383.test82
-rw-r--r--mysql-test/t/events_restart.test1
-rw-r--r--mysql-test/t/join_outer.test56
-rw-r--r--mysql-test/t/multi_update.test5
-rw-r--r--mysql-test/t/myisam.test14
-rw-r--r--mysql-test/t/partition.test45
-rw-r--r--mysql-test/t/partition_error.test28
-rw-r--r--mysql-test/t/ps.test7
-rw-r--r--mysql-test/t/sp-bugs.test24
-rw-r--r--mysql-test/t/sp.test29
10 files changed, 291 insertions, 0 deletions
diff --git a/mysql-test/t/bug13633383.test b/mysql-test/t/bug13633383.test
new file mode 100644
index 00000000000..72eb2f81c98
--- /dev/null
+++ b/mysql-test/t/bug13633383.test
@@ -0,0 +1,82 @@
+--echo #
+--echo # Bug#13633383 63183: SMALL SORT_BUFFER_SIZE CRASH IN MERGE_BUFFERS
+--echo #
+
+CREATE TABLE t1 (
+ `a` int(11) DEFAULT NULL,
+ `col432` bit(8) DEFAULT NULL,
+ `col433` multipoint DEFAULT NULL,
+ `col434` polygon DEFAULT NULL,
+ `col435` decimal(50,17) unsigned DEFAULT NULL,
+ `col436` geometry NOT NULL,
+ `col437` tinyblob NOT NULL,
+ `col438` multipolygon DEFAULT NULL,
+ `col439` mediumblob NOT NULL,
+ `col440` tinyblob NOT NULL,
+ `col441` double unsigned DEFAULT NULL
+);
+
+CREATE TABLE t2 (
+ `a` multipoint DEFAULT NULL,
+ `col460` date DEFAULT NULL,
+ `col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `col462` date NOT NULL,
+ `col463` varbinary(89) NOT NULL,
+ `col464` year(4) DEFAULT NULL,
+ `col465` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `col466` varchar(236) CHARACTER SET utf8 NOT NULL,
+ `col467` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
+);
+
+CREATE TABLE t3 (
+ `FTS_DOC_ID` bigint(20) unsigned NOT NULL,
+ `col577` datetime DEFAULT NULL,
+ `col579` bit(38) NOT NULL,
+ `col580` varchar(93) NOT NULL,
+ `col581` datetime DEFAULT NULL,
+ `col583` multipolygon DEFAULT NULL,
+ `col584` bit(47) NOT NULL
+);
+
+--disable_query_log
+
+INSERT INTO t1 VALUES (0,0xFF,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 JæÀ',NULL,0.00000000000000000,'\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àÃ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àC\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àC\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',0xB623A952C5,'\0\0\0\0\0\0\0\0\0\0\0ðiøÀ\0\0\0\0jøÀ',0x22,0xD81F72A9,56403);
+INSERT INTO t1 VALUES (-32768,0x00,'\0\0\0\0\0\0\0\0\0\0\0Àrç@\0\0\0\0jøÀ','\0\0\0\0\0\0\0\0\0\0\0\0ÛâÀ\0\0\0\0jøÀ',NULL,'\0\0\0\0\0\0\0\0\0\0\0À6Ò@\0\0\0\0\0jøÀ',0xC80876AF04,'\0\0\0\0\0\0\0\0\0\0\0€[áÀ\0\0\0\0ðiøÀ',0x016C576E34,0x1B,0);
+INSERT INTO t1 VALUES (-2147483648,0x17,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0]ÇÀ',NULL,0.00000000000000000,'\0\0\0\0\0\0\0\0\0\0\0ðiøÀìÊFQƒìCµ',0x68D352,'\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àÃ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àC\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àÃ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àC \0\0\0\0\0àÃ\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','','',0);
+INSERT INTO t1 VALUES (1,0xFF,'\0\0\0\0\0\0\0\0\0\0\0Ð÷À\0\0\0\0Àü×À','\0\0\0\0\0\0\0\0\0\0\0`6ë@\0\0\0\0à²î@',32767.00000000000000000,'\0\0\0\0\0\0\0\0\0\0\0ðiø@†ö¯{âÌ',0x1406B0C524,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0àà \0\0\0\0\0àC \0\0\0\0\0àC',0xC04B75CCFD,0xC4CD,1);
+INSERT INTO t1 VALUES (0,0xFF,NULL,'\0\0\0\0\0\0\0\0\0\0\0\0jø@\0\0\0\0\0(¦À',0.06140000000000000,'\0\0\0\0\0\0\0\0\0\0\0ðiø@$7”H#ÀÐ1',0x3F,'\0\0\0\0\0\0\0\0\0\0\0jøÀCHK¶µ$·',0x1E87C5DA,0xCC870E,NULL);
+
+
+INSERT INTO t2 VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0k¿À\0\0\0\0\0jø@','2011-02-19','2011-08-10 14:21:44','2012-09-25',0xCCC3,0000,'2012-07-28 16:25:23','idpapxbfjrigkfqnhnfmhvtewlvxfmjhfqizhhsowbetimmkhukpzeixbfyzmsalaafssdovflpvxldldmuamfoulanivuxigbjwkzbapcxmmprpyasaozdqwqjuixajzmiepkcvnvtewdvyodupziffgzbcmsfhikbuehyhzfnxlsdzulbsrqmtszzzupcmxlvcpxahuiotgadwhpcuqmyzgrbkxzxwriqkymdaqnzz','2012-01-20 09:01:25');
+INSERT INTO t2 VALUES (NULL,'2011-05-14','2012-10-17 04:33:30','2012-01-20','',0000,'2012-05-08 11:06:53','otbywkbfwwtgpfgurtqwgfcwmmntsdxkounuzueoclrpnadghfzmbrh','2012-03-24 21:01:09');
+INSERT INTO t2 VALUES ('\0\0\0\0\0\0\06ý¹PVh,;bºö$î°','2012-07-21','2011-11-21 04:23:27','2011-06-18',0x21,0000,'2011-09-10 14:01:05','goybgohrexhfqwerpknkbyiqowvcdpyxvbklkbeeuvfbjtkmontmkmgcjutkjphewnvvobzilamtjqjbtvqgczozqcmvbbzvoxkycsvplfykmzpwljdcromsilspjuoyhxwduymxkymvmijehtutftqmpfpbesonppacogyogjqhyonizbsgzwubzgeoehryqswzkftgzhzssnlstuszpwauxmdhgjcawabnjcynzrrh','2012-11-19 18:30:51');
+INSERT INTO t2 VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0À®ÛÀ','2012-09-01','2012-01-20 09:01:34','2011-02-12',0x1FDF59DC65,0000,'2011-07-07 19:48:34','xohwzrslzxbpxdvqfsumavjwwmsdcgczlmxrtxavsqtnpggxesvekbcelnnrxkvvlwqwbydlhwzltwaurkfltafeijstmzueiqddjdxzddymhsungndmojndbspkezvdfhqxijxxrwiolqgnsedenszkiljgropmcbxsjntjmnonnltyiysuejsznuurmonebslawybppziavystrylwunselezpbslmkzggpziffrud','2012-01-19 22:00:00');
+INSERT INTO t2 VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0jø@\0\0\0\0\0\0\0\0','0000-00-00','2012-05-21 09:59:10','2011-04-17',0x02307EDF,0000,'2012-01-20 09:01:34','vjcwlxxeydntegsdqhxgriarmbvzwzwdexcalvacxhilaejpmxdpkuvblukchagzoellbdndelfednqktzobyhjqweqaugqnfikdalmaytyunjqvxcsirhaqnvqsstgrgfscnsemseebdemfditoswccsxthnddzslgjkyujxoqsvzrssymoovqmibcmbboruyxlvopengdqqgqwekrflhvjcpondxivnshvhrnqvfls','2012-09-23 23:54:02');
+
+
+INSERT INTO t3 VALUES (11787,'2012-07-24 15:22:50',0x00000000FF,'qbdydwxepydtonqnghurnuntughjwfygzttqwtmfzfbtifjcearpatksofbrfgnaccvapahywhsstdplphrxbcubhktov','2011-08-27 19:28:03',NULL,0x00000000001C);
+
+INSERT INTO t3 VALUES (11788,'2012-05-17 08:38:13',0x3FFFFFFFFF,'jkvkjxaikruljqalyvnbfjptxgbpsgnxlzthhcrswwdcfrhilwwgqmxynxjnehwmyfzdyywjzfyasuvjbrevkxtnyodiu','2012-05-09 11:09:52',NULL,0x0000000000B8);
+
+INSERT INTO t3 VALUES (1,'2011-02-17 19:55:19',0x000098FAF3,'rnzhemtrqjdrappwbmxnzkfatcgtvqklrpfpdqiwjnjbeaxpcbhqqunbzmtmitdszxyrdvkeedqwpbiefqnwvhiznwfyq','2012-11-10 18:00:25','\0\0\0\0\0\0\0\0\0\0\0\0jøÀ\0\0\0\0€1á@',0x7FFFFFFFFFFF);
+
+INSERT INTO t3 VALUES (11789,'2011-12-26 01:30:56',0x0000000001,'dhryqjghgixymqywclxpovwnlgnltuzdvggmlaxtzrsbpxkahkiahpkrddpoeftqqwejbjxrdzfgvkzvhcalopgumspgg','2011-03-21 06:25:44',NULL,0x00000000293A);
+
+INSERT INTO t3 VALUES (4294967296,'2011-04-12 21:05:37',0x0000CE3238,'xwcplgaxcpgfsmcjftxffxgmjwabpmrcycbxmwjvqtlvtlwuipuwgbuygnxomjplqohyuqyzsoiggroigcnchzpiilyhe','2012-03-20 05:35:39',NULL,0x00000000006E);
+
+--enable_query_log
+
+set session sort_buffer_size= 32768;
+select col435
+from t3
+natural right outer join t1
+natural right outer join t2 a
+left outer join t2 b on 1
+group by
+ repeat('a',10000) desc,
+ repeat('a',10000)
+with rollup
+;
+set session sort_buffer_size= default;
+
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test
index facf2912087..83d28c0812d 100644
--- a/mysql-test/t/events_restart.test
+++ b/mysql-test/t/events_restart.test
@@ -106,3 +106,4 @@ let $wait_condition=
select count(*) = 0 from information_schema.processlist
where db='events_test' and command = 'Connect' and user=current_user();
--source include/wait_condition.inc
+
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index d5c6d995b4c..a4469728c0f 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1260,6 +1260,62 @@ WHERE TABLE1.pk IS NULL;
DROP TABLE h,m,k;
+--echo
+--echo # BUG#12567331 - INFINITE LOOP WHEN RESOLVING AN ALIASED COLUMN
+--echo # USED IN GROUP BY
+--echo
+CREATE TABLE t1 (
+ col_varchar_1024_latin1_key varchar(1024),
+ col_varchar_10_latin1 varchar(10),
+ col_int int(11),
+ pk int(11)
+);
+CREATE TABLE t2 (
+ col_int_key int(11),
+ col_int int(11),
+ pk int(11)
+);
+
+PREPARE prep_stmt_9846 FROM '
+SELECT alias1.pk AS field1 FROM
+t1 AS alias1
+LEFT JOIN
+(
+ t2 AS alias2
+ RIGHT JOIN
+ (
+ t2 AS alias3
+ JOIN t1 AS alias4
+ ON 1
+ )
+ ON 1
+)
+ON 1
+GROUP BY field1';
+execute prep_stmt_9846;
+execute prep_stmt_9846;
+drop table t1,t2;
+
+--echo #
+--echo # Bug #11765810 58813: SERVER THREAD HANGS WHEN JOIN + WHERE + GROUP BY
+--echo # IS EXECUTED TWICE FROM P
+--echo #
+CREATE TABLE t1 ( a INT ) ENGINE = MYISAM;
+INSERT INTO t1 VALUES (1);
+PREPARE prep_stmt FROM '
+ SELECT 1 AS f FROM t1
+ LEFT JOIN t1 t2
+ RIGHT JOIN t1 t3
+ JOIN t1 t4
+ ON 1
+ ON 1
+ ON 1
+ GROUP BY f';
+EXECUTE prep_stmt;
+EXECUTE prep_stmt;
+
+DROP TABLE t1;
+
--echo #
--echo # Bug#49600: outer join of two single-row tables with joining attributes
--echo # evaluated to nulls
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 51bb64bd31d..48735304aad 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -6,6 +6,8 @@
source include/not_embedded.inc;
source include/have_log_bin.inc;
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+
--disable_warnings
drop table if exists t1,t2,t3;
drop database if exists mysqltest;
@@ -142,6 +144,7 @@ INSERT INTO t2(ParId) VALUES(1), (2), (3);
select * from t2;
+--disable_warnings ONCE
UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id;
select * from t2;
@@ -299,6 +302,7 @@ drop table t1,t2;
create table t1 (a int not null auto_increment primary key, b int not null);
insert into t1 (b) values (1),(2),(3),(4);
+--disable_warnings ONCE
update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
select * from t1;
drop table t1;
@@ -356,6 +360,7 @@ create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(1
insert into t1 values (0,'A01-Comp',1);
insert into t1 values (0,'B01-Comp',1);
insert into t2 values (0,1,'A Note',1);
+--disable_warnings ONCE
update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
select * from t1;
select * from t2;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 9bdd6faa422..4199d98073c 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1718,6 +1718,20 @@ CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
+--echo #
+--echo # BUG 11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
+--echo # CASES RESETS DATA POINTER TO SMAL
+--echo #
+CREATE TABLE t1(a INT, KEY(a));
+ALTER TABLE t1 DISABLE KEYS;
+let $MYSQLD_DATADIR= `select @@datadir`;
+SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+FLUSH TABLES;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--exec $MYISAMCHK -sn $MYSQLD_DATADIR/test/t1
+SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+SELECT @before=@after;
+DROP TABLE t1;
--echo End of 5.1 tests
--echo #
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 3224f4d4081..d6d49c59255 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2350,6 +2350,51 @@ INSERT INTO t1 VALUES(0);
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
+--echo #
+--echo # Bug#13580775 ASSERTION FAILED: RECORD_LENGTH == M_RECORD_LENGTH,
+--echo # FILE FILESORT_UTILS.CC
+--echo #
+
+CREATE TABLE t1 (
+ a INT PRIMARY KEY,
+ b INT,
+ c CHAR(1),
+ d INT,
+ KEY (c,d)
+) PARTITION BY KEY () PARTITIONS 1;
+
+INSERT INTO t1 VALUES (1,1,'a',1), (2,2,'a',1);
+
+SELECT 1 FROM t1 WHERE 1 IN
+(SELECT group_concat(b)
+ FROM t1
+ WHERE c > geomfromtext('point(1 1)')
+ GROUP BY b
+);
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#13011410 CRASH IN FILESORT CODE WITH GROUP BY/ROLLUP
+--echo #
+
+CREATE TABLE t1 (
+ a INT,
+ b MEDIUMINT,
+ c VARCHAR(300) CHARACTER SET hp8 COLLATE hp8_bin,
+ PRIMARY KEY (a,c(299)))
+ENGINE=myisam
+PARTITION BY LINEAR KEY () PARTITIONS 2;
+
+INSERT INTO t1 VALUES (1,2,'test'), (2,3,'hi'), (4,5,'bye');
+SELECT 1 FROM t1 WHERE b < SOME
+( SELECT 1 FROM t1 WHERE a >= 1
+ GROUP BY b WITH ROLLUP
+ HAVING b > geomfromtext("")
+);
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
--echo #
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index 39dd6773ce8..f8f09e4b5e7 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -11,6 +11,34 @@ drop table if exists t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
+--echo # Bug#13608188 - 64038: CRASH IN HANDLER::HA_THD ON ALTER TABLE AFTER
+--echo # REPAIR NON-EXISTING PARTITION
+--echo #
+CREATE TABLE t1 ( a INT, b INT );
+INSERT INTO t1 VALUES (5,3),(5,6);
+ALTER TABLE t1 PARTITION BY KEY(b) PARTITIONS 3 ;
+ALTER TABLE t1 REPAIR PARTITION p1, p3;
+ALTER TABLE t1 ORDER BY b;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#13593865 - 64037: CRASH IN HA_PARTITION::CREATE_HANDLERS ON
+--echo # ALTER TABLE AFTER DROP PARTITION
+--echo #
+
+CREATE TABLE t1 (a INT)
+PARTITION BY RANGE (a)
+(PARTITION p0 VALUES LESS THAN (0),
+ PARTITION p1 VALUES LESS THAN MAXVALUE ) ;
+
+ALTER TABLE t1 DROP PARTITION p1;
+ALTER TABLE t1 ANALYZE PARTITION p0, p1;
+
+ALTER TABLE t1 COMMENT 'altered';
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug#57924: crash when creating partitioned table with
--echo # multiple columns in the partition key
--echo #
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 58e85c7a3a1..b89c4974b20 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1,5 +1,6 @@
-- source include/not_embedded.inc
-- source include/have_log_bin.inc
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
#
# SQL Syntax for Prepared Statements test
#
@@ -249,8 +250,10 @@ prepare stmt1 from "select 1 into @var";
execute stmt1;
execute stmt1;
prepare stmt1 from "create table t1 select 1 as i";
+--disable_warnings ONCE
execute stmt1;
drop table t1;
+--disable_warnings ONCE
execute stmt1;
prepare stmt1 from "insert into t1 select i from t1";
execute stmt1;
@@ -443,6 +446,7 @@ deallocate prepare stmt;
create table t1 (a int);
insert into t1 values (1),(2),(3);
create table t2 select * from t1;
+--disable_warnings
prepare stmt FROM 'create table t2 select * from t1';
drop table t2;
execute stmt;
@@ -452,6 +456,7 @@ execute stmt;
execute stmt;
drop table t2;
execute stmt;
+--enable_warnings
drop table t1,t2;
deallocate prepare stmt;
@@ -1187,6 +1192,7 @@ create database mysqltest character set utf8;
prepare stmt1 from "create table mysqltest.t1 (c char(10))";
prepare stmt2 from "create table mysqltest.t2 select 'test'";
execute stmt1;
+--disable_warnings ONCE
execute stmt2;
show create table mysqltest.t1;
show create table mysqltest.t2;
@@ -1194,6 +1200,7 @@ drop table mysqltest.t1;
drop table mysqltest.t2;
alter database mysqltest character set latin1;
execute stmt1;
+--disable_warnings ONCE
execute stmt2;
show create table mysqltest.t1;
show create table mysqltest.t2;
diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test
index fe52632c784..a23ccea8189 100644
--- a/mysql-test/t/sp-bugs.test
+++ b/mysql-test/t/sp-bugs.test
@@ -138,4 +138,28 @@ DROP FUNCTION db1.f1;
DROP TABLE db1.t1;
DROP DATABASE db1;
DROP DATABASE db2;
+
+--echo #
+--echo # Bug#13105873:valgrind warning:possible crash in foreign
+--echo # key handling on subsequent create table if not exists
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS testdb;
+--enable_warnings
+CREATE DATABASE testdb;
+USE testdb;
+CREATE TABLE t1 (id1 INT PRIMARY KEY);
+DELIMITER $;
+CREATE PROCEDURE `p1`()
+BEGIN
+ CREATE TABLE IF NOT EXISTS t2(id INT PRIMARY KEY,
+ CONSTRAINT FK FOREIGN KEY (id) REFERENCES t1( id1 ));
+END$
+DELIMITER ;$
+CALL p1();
+--echo # below stmt should not return valgrind warnings
+CALL p1();
+DROP DATABASE testdb;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index cafa7f0a551..02182dbf0c6 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9040,3 +9040,32 @@ DROP PROCEDURE p2;
DROP TABLE t1;
--echo # End of 5.5 test
+
+
+--echo #
+--echo # Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
+--echo #
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+
+delimiter $;
+CREATE FUNCTION f1() RETURNS INT
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
+ BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
+ RETURN f1();
+ END;
+ END;
+RETURN 1;
+END $
+delimiter ;$
+
+# This used to cause an assertion.
+SELECT f1();
+
+DROP FUNCTION f1;