summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/case.test11
-rw-r--r--mysql-test/t/compare.test8
-rw-r--r--mysql-test/t/func_group_innodb.test29
-rw-r--r--mysql-test/t/order_by.test39
-rw-r--r--mysql-test/t/partition.test10
-rw-r--r--mysql-test/t/ps.test92
-rw-r--r--mysql-test/t/sp.test9
-rw-r--r--mysql-test/t/subselect.test52
8 files changed, 140 insertions, 110 deletions
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
index 9d6cc7d375a..f536f556780 100644
--- a/mysql-test/t/case.test
+++ b/mysql-test/t/case.test
@@ -175,6 +175,16 @@ drop table t1, t2;
--echo End of 5.0 tests
#
+# lp:1001510
+# Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
+# ELSE CLAUSE
+#
+
+CREATE TABLE t1(a YEAR);
+SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
+DROP TABLE t1;
+
+#
# lp:839387 Assertion `(Item_result)i != TIME_RESULT' failed with CASE + datetime
#
@@ -182,3 +192,4 @@ create table t1 (f1 time);
insert t1 values ('00:00:00'),('00:01:00');
select case t1.f1 when '00:00:00' then 1 end from t1;
drop table t1;
+
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index 103244eb2f7..d2b2a7e5523 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -86,3 +86,11 @@ SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
DROP TABLE t1;
--echo End of 5.0 tests
+
+#
+# Bug #11764818 57692: Crash in item_func_in::val_int() with ZEROFILL
+#
+
+CREATE TABLE t1(a INT ZEROFILL);
+SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
+DROP TABLE t1;
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index bfe91f1f587..6706792d162 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -84,20 +84,6 @@ select count(*), min(7), max(7) from t2m, t1i;
drop table t1m, t1i, t2m, t2i;
-
---echo #
---echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
---echo #
-
-CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
- KEY(b, c, a(765))) ENGINE=INNODB;
-INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
-
-SELECT MIN(c) FROM t1 GROUP BY b;
-EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
-
-DROP TABLE t1;
-
--echo #
--echo # Bug #57954: BIT_AND function returns incorrect results when
--echo # semijoin=on
@@ -173,4 +159,19 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
DROP TABLE t1;
+--echo # End of test BUG#12713907
+
+--echo #
+--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
+--echo #
+
+CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
+ KEY(b, c, a(765))) ENGINE=INNODB;
+INSERT INTO t1(a, b, c) VALUES ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
+
+SELECT MIN(c) FROM t1 GROUP BY b;
+EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
+
+DROP TABLE t1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index a6f50107cbe..2912e190af8 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -1613,3 +1613,42 @@ SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
drop table t1,t2;
--echo End of 5.2 tests
+
+--echo #
+--echo # Bug mdev-449: ORDER BY with small sort_buffer_size
+--echo #
+
+CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
+INSERT INTO t1(f1, f2) VALUES
+(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
+(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
+(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
+(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
+(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
+(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
+(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
+(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
+(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
+(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
+(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
+(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
+(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
+(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
+(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
+(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
+(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
+(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
+(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
+(96,"96"),(97,"97"),(98,"98"),(99,"99");
+
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size= 2000;
+
+SELECT * FROM t1 ORDER BY f1 DESC, f0;
+
+set sort_buffer_size= @save_sort_buffer_size;
+
+DROP TABLE t1;
+
+--echo End of 5.3 tests
+
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 08c028c8224..ef0d3df6661 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2476,3 +2476,13 @@ SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0.a LIKE (SELECT 1 FROM t1);
SELECT * FROM vtmp;
DROP VIEW vtmp;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-365 "Got assertion when doing alter table on a partition"
+--echo #
+
+CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
+INSERT INTO t1 VALUES (1),(2),(2),(3),(4);
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+SELECT * from t1 order by i;
+DROP TABLE t1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index d955b46469c..ff28631862c 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3125,7 +3125,7 @@ DROP TABLE t1;
--echo End of 5.1 tests.
--echo #
---echo # LP bug#1001500 Crash on the second execution of the PS for
+--echo # lp:1001500 Crash on the second execution of the PS for
--echo # a query with degenerated conjunctive condition
--echo # (see also mysql bug#12582849)
--echo #
@@ -3572,94 +3572,4 @@ show status like '%Handler_read%';
deallocate prepare st;
drop table t1;
---echo #
---echo # LP bug#993459 Execution of PS for a query with GROUP BY
---echo # returns wrong result (see also mysql bug#13805127)
---echo #
-
-PREPARE s1 FROM
-"
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2
-";
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 2;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
-DEALLOCATE PREPARE s1;
-
--echo # End of 5.3 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 08421040109..2528f0d7b2b 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9111,9 +9111,14 @@ DROP FUNCTION f1;
--echo # ------------------------------------------------------------------
--echo #
---echo # LP bug#993459 Execution of PS for a query with GROUP BY
+--echo # lp:993459 Execution of PS for a query with GROUP BY
--echo # returns wrong result (see also mysql bug#13805127)
--echo #
+
+--echo
+--echo # Bug#13805127: Stored program cache produces wrong result in same THD
+--echo
+
delimiter |;
CREATE PROCEDURE p1(x INT UNSIGNED)
@@ -9147,7 +9152,7 @@ CALL p1(1);
DROP PROCEDURE p1;
--echo #
---echo # LP bug#1002157 : testing stored function
+--echo # lp:1002157 : testing stored function
--echo # bug#62125 result for null incorrectly yields 1292 warning.
--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 786e328aa72..9f35ecc43f1 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -5576,7 +5576,28 @@ SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 U
drop table t1;
--echo #
---echo # LP BUG#944706 Query with impossible or constant subquery in WHERE or HAVING is not
+--echo # MDEV-367: Different results with and without subquery_cache on
+--echo # a query with a constant NOT IN condition
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+
+set @mdev367_optimizer_switch = @@optimizer_switch;
+
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+set optimizer_switch=@mdev367_optimizer_switch;
+
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+set optimizer_switch=@mdev367_optimizer_switch;
+
+DROP TABLE t1;
+
+--echo #
+--echo # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
--echo # precomputed and thus not part of optimization
--echo #
@@ -5721,5 +5742,30 @@ set global userstat=@tmp_mdev410;
DROP TABLE t1,t2,t3,t4;
---echo # return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
+--echo #
+--echo # MDEV-430: Server crashes in select_describe on EXPLAIN with
+--echo # materialization+semijoin, 2 nested subqueries, aggregate functions
+--echo #
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+--echo #
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+
+DROP TABLE t1,t2;
+