summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2013-05-04 21:56:45 -0700
committerIgor Babaev <igor@askmonty.org>2013-05-04 21:56:45 -0700
commit75befe7526c6bdb38c042695fd302c037e59409d (patch)
tree2ad7d1dcf2fe25ebfafc64a32054cd1489d478f2 /mysql-test/t
parentddd341b71ae6b9c2dd206df64c662c0a29730ae9 (diff)
parent920c479c6ebd2236dbe5510e5ed8b748bf0ee158 (diff)
downloadmariadb-git-75befe7526c6bdb38c042695fd302c037e59409d.tar.gz
Merge 5.3->5.5
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/join_outer.test17
-rw-r--r--mysql-test/t/select.test37
-rw-r--r--mysql-test/t/type_datetime.test15
3 files changed, 69 insertions, 0 deletions
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 44f4afd451b..a325d0b6233 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1622,4 +1622,21 @@ ORDER BY t1.b;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug mdev-4336: LEFT JOIN with disjunctive
+--echo # <non-nullable datetime field> IS NULL in WHERE
+--echo # causes a hang and eventual crash
+--echo #
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ modified datetime NOT NULL,
+ PRIMARY KEY (id)
+);
+
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+ WHERE a.modified > b.modified or b.modified IS NULL;
+
+DROP TABLE t1;
+
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index af507b1f7ef..b036cc6bc01 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4289,6 +4289,7 @@ SELECT f1 FROM t1 GROUP BY 1;
SELECT f1 FROM t1 GROUP BY '123' = 'abc';
SELECT 1 FROM t1 GROUP BY 1;
drop table t1;
+set sql_buffer_result= 0;
--echo #
@@ -4479,5 +4480,41 @@ WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
+--echo #
+--echo # Bug mdev-4274: result of simplification of OR badly merged
+--echo # into embedding AND
+--echo #
+
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+ WHERE 1 IS NULL OR b < 33 AND b = c;
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+ WHERE 1 IS NULL OR b < 33 AND b = c;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug mdev-4413: another manifestations of bug mdev-2474
+--echo # (valgrind complains)
+--echo #
+
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+
+SELECT * FROM t1, t2
+ WHERE c = a AND
+ ( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+
+DROP TABLE t1, t2;
+
--echo End of 5.3 tests
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index d1648254fb2..05bc72291cd 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -471,6 +471,21 @@ insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
drop table t1;
+--echo #
+--echo # Semantics of the condition <non-nullable datetime field> IS NULL
+--echo # when the field belongs to an inner table of an outer join
+--echo #
+
+create table t1 (a int, b date not null);
+insert t1 values (1, 0), (2, '1999-01-02');
+create table t2 (c int);
+insert t2 values (1),(3);
+
+select * from t2 left join t1 on t1.a=t2.c where t1.a is null;
+select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
+
+drop table t1,t2;
+
--echo End of 5.3 tests
--echo #