diff options
author | Joerg Bruehe <joerg@mysql.com> | 2008-11-10 20:32:45 +0100 |
---|---|---|
committer | Joerg Bruehe <joerg@mysql.com> | 2008-11-10 20:32:45 +0100 |
commit | a1e2d2d14615b0ccac6b1246a58cd347effaeefb (patch) | |
tree | 0c6bedc8298d6ba68c23420c95626e2b52466499 /mysql-test/t/explain.test | |
parent | 12ad7f3b9da5e0563c24698856102b4b646cea82 (diff) | |
parent | 9a0637750a4775e199b3915bd83e630540729d64 (diff) | |
download | mariadb-git-a1e2d2d14615b0ccac6b1246a58cd347effaeefb.tar.gz |
Merge main 5.1 -> 5.1-build
Diffstat (limited to 'mysql-test/t/explain.test')
-rw-r--r-- | mysql-test/t/explain.test | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index c9ae8aceaf6..3a71fde4421 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -94,4 +94,51 @@ EXPLAIN SELECT 1 FROM DROP TABLE t2; DROP TABLE t1; +# +# Bug #34773: query with explain extended and derived table / other table +# crashes server +# + +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); + +EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; + +EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1; + +prepare s1 from +'EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; +execute s1; + +prepare s1 from +'EXPLAIN EXTENDED SELECT 1 + FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1'; +execute s1; +execute s1; + +DROP TABLE t1,t2; + +--echo # +--echo # Bug#37870: Usage of uninitialized value caused failed assertion. +--echo # +create table t1 (dt datetime not null, t time not null); +create table t2 (dt datetime not null); +insert into t1 values ('2001-01-01 1:1:1', '1:1:1'), +('2001-01-01 1:1:1', '1:1:1'); +insert into t2 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1'); +flush tables; +EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); +flush tables; +SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL ); +flush tables; +EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); +flush tables; +SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' ); +drop tables t1, t2; + # End of 5.0 tests. |