summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-24 21:18:20 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-24 21:18:20 -0700
commitc68020210fa7f9ab41ba35108a109640f0b50eb5 (patch)
tree8da3aa7e027d30d32937071f162c76780101d21e /mysql-test
parent37bac085da110a42b1d7dc3ced5e555070cb8c36 (diff)
downloadmariadb-git-c68020210fa7f9ab41ba35108a109640f0b50eb5.tar.gz
Added test cases for LP bug #798625 and LP bug #800085
fixed by the patch for LP bug 798621.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/derived.result13
-rw-r--r--mysql-test/r/view.result17
-rw-r--r--mysql-test/t/derived.test16
-rw-r--r--mysql-test/t/view.test16
4 files changed, 62 insertions, 0 deletions
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 4805616841c..5ea398a6c09 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -464,3 +464,16 @@ a b a
255 8 8
DROP VIEW v1;
DROP TABLE t1,t2;
+#
+# LP bug #800085: crash with a query using a simple derived table
+# (fixed by the patch for bug 798621)
+#
+CREATE TABLE t1 (f1 int, f2 varchar(32)) ;
+INSERT INTO t1 VALUES (NULL,'j'), (8,'c');
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (1), (5);
+SELECT DISTINCT t.f1 FROM (SELECT * FROM t1) AS t, t2
+WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
+f1
+8
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 76aad8b6260..2c58dc8c783 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4207,6 +4207,23 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where ((`test`.`t1`.`b` = 1) or ((`test`.`t1`.`a` = 'a') and (length(`test`.`t1`.`a`) >= `test`.`t1`.`b`)))
DROP VIEW v1;
DROP TABLE t1,t2;
+# Bug#798625: duplicate of the previous one, but without crash
+CREATE TABLE t1 (f1 int NOT NULL, f2 int, f3 int, f4 varchar(32), f5 int) ;
+INSERT INTO t1 VALUES (20,5,2,'r', 0);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT v1.f4 FROM v1
+WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
+f4
+r
+EXPLAIN EXTENDED
+SELECT v1.f4 FROM v1
+WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select 'r' AS `f4` from `test`.`t1` where ((20 <> 0) or 0)
+DROP VIEW v1;
+DROP TABLE t1;
#
# Bug#798576: abort on a GROUP BY query over a view with left join
# that can be converted to inner join
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index b989bfbcf24..3cf8bd92512 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -369,3 +369,19 @@ SELECT * FROM v1, t1 WHERE v1.b=t1.a ORDER BY v1.a;
DROP VIEW v1;
DROP TABLE t1,t2;
+
+--echo #
+--echo # LP bug #800085: crash with a query using a simple derived table
+--echo # (fixed by the patch for bug 798621)
+--echo #
+
+CREATE TABLE t1 (f1 int, f2 varchar(32)) ;
+INSERT INTO t1 VALUES (NULL,'j'), (8,'c');
+
+CREATE TABLE t2 (f1 int);
+INSERT INTO t2 VALUES (1), (5);
+
+SELECT DISTINCT t.f1 FROM (SELECT * FROM t1) AS t, t2
+ WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 2c5b65a2bbc..5d148facb9e 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4156,6 +4156,22 @@ SELECT * FROM v1 LEFT JOIN t2 ON t2.a = v1.a
DROP VIEW v1;
DROP TABLE t1,t2;
+--echo # Bug#798625: duplicate of the previous one, but without crash
+
+CREATE TABLE t1 (f1 int NOT NULL, f2 int, f3 int, f4 varchar(32), f5 int) ;
+INSERT INTO t1 VALUES (20,5,2,'r', 0);
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT v1.f4 FROM v1
+ WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
+EXPLAIN EXTENDED
+SELECT v1.f4 FROM v1
+ WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo #
--echo # Bug#798576: abort on a GROUP BY query over a view with left join
--echo # that can be converted to inner join