summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-04-30 15:10:48 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-04-30 15:10:48 +0400
commit97374a11849f3b61ed431c1abe75a283d765e859 (patch)
tree23f9e399ede4ce1cc9f7110de694937f94df1d32 /sql/sql_select.cc
parent6eca53f1d382a247456d29794c70338f972b77a9 (diff)
downloadmariadb-git-97374a11849f3b61ed431c1abe75a283d765e859.tar.gz
Bug #48419: another explain crash..
WHERE predicates containing references to empty tables in a subquery were handled incorrectly by the optimizer when executing EXPLAIN. As a result, the optimizer could try to evaluate such predicates rather than just stop with "Impossible WHERE noticed after reading const tables" as it would do in a non-subquery case. This led to valgrind errors and crashes. Fixed the code checking the above condition so that subqueries are not excluded and hence are handled in the same way as top level SELECTs. mysql-test/r/explain.result: Added a test case for bug #48419. mysql-test/r/ps.result: Updated test results to take the new (and more correct) "Extra" comments in execution plans. mysql-test/t/explain.test: Added a test case for bug #48419. sql/sql_select.cc: There is no point in excluding subqueries from checking for identically false WHERE conditions.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 545f1cb6636..c8c23e9a602 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1107,8 +1107,7 @@ JOIN::optimize()
}
if (conds && const_table_map != found_const_table_map &&
- (select_options & SELECT_DESCRIBE) &&
- select_lex->master_unit() == &thd->lex->unit) // upper level SELECT
+ (select_options & SELECT_DESCRIBE))
{
conds=new Item_int((longlong) 0,1); // Always false
}