diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-10-01 14:08:38 +0400 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2010-10-01 14:08:38 +0400 |
commit | 233e4d809aeccff150494b8632abedb77c213fbd (patch) | |
tree | dd6a64f3ae4c4989c2ade7f0039d1143653ff241 /mysql-test/t/ps.test | |
parent | b76277fce5a375b931ae2f967e26956539eb1ffc (diff) | |
download | mariadb-git-233e4d809aeccff150494b8632abedb77c213fbd.tar.gz |
Bug#54488 crash when using explain and prepared statements with subqueries
The crash happens because original join table is replaced with temporary table
at execution stage and later we attempt to use this temporary table in
select_describe. It might happen that
Item_subselect::update_used_tables() method which sets const_item flag
is not called by some reasons (no where/having conditon in subquery for example).
It prevents JOIN::join_tmp creation and breaks original join.
The fix is to call ::update_used_tables() before ::const_item() check.
mysql-test/r/ps.result:
test case
mysql-test/t/ps.test:
test case
sql/item_subselect.cc:
call ::update_used_tables() before ::const_item() check.
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r-- | mysql-test/t/ps.test | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 036c8404095..9b3f3e750e1 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3090,4 +3090,15 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; +--echo # +--echo # Bug#54488 crash when using explain and prepared statements with subqueries +--echo # +CREATE TABLE t1(f1 INT); +INSERT INTO t1 VALUES (1),(1); +PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))'; +EXECUTE stmt; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +DROP TABLE t1; + --echo End of 5.1 tests. |