diff options
author | gkodinov/kgeorge@magare.gmz <> | 2007-05-04 10:48:51 +0300 |
---|---|---|
committer | gkodinov/kgeorge@magare.gmz <> | 2007-05-04 10:48:51 +0300 |
commit | 6badb08ce30c7b96714e7df91b8d7cf008a7bbb9 (patch) | |
tree | 063e8080c776ed341a337770fb33a4588175b108 /mysql-test/t/subselect.test | |
parent | b77a85ef22f2b728d185e5e0b0e9d1d5ff5bb940 (diff) | |
download | mariadb-git-6badb08ce30c7b96714e7df91b8d7cf008a7bbb9.tar.gz |
Bug #27807.
Non-correlated scalar subqueries may get executed
in EXPLAIN at the optimization phase if they are
part of a right hand sargable expression.
If the scalar subquery uses a temp table to
materialize its results it will replace the
subquery structure from the parser with a simple
select from the materialization table.
As a result the EXPLAIN will crash as the
temporary materialization table is not to be shown
in EXPLAIN at all.
Fixed by preserving the original query structure
right after calling optimize() for scalar subqueries
with temp tables executed during EXPLAIN.
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r-- | mysql-test/t/subselect.test | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 482b3e883e6..123a1ef3282 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -2845,3 +2845,13 @@ SELECT a FROM t1 t0 SET @@sql_mode=default; DROP TABLE t1; + +# +# Bug #27807: Server crash when executing subquery with EXPLAIN +# +CREATE TABLE t1 (a int, b int, KEY (a)); +INSERT INTO t1 VALUES (1,1),(2,1); +EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b); +DROP TABLE t1; + +--echo End of 5.0 tests. |