summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2016-07-27 17:01:45 +0300
committerSergei Petrunia <psergey@askmonty.org>2016-07-27 17:06:29 +0300
commita63ceaeab10fc1fc72f5853ce14b278da95579b4 (patch)
tree726ef7d168ab50a8efb00fc83346b9bcd3d79c7f /sql/opt_subselect.cc
parenta52d3aa831454aa2e7dd4dfde9c65d4b87532caa (diff)
downloadmariadb-git-a63ceaeab10fc1fc72f5853ce14b278da95579b4.tar.gz
MDEV-10389: Query returns different results on a debug vs non-debug build
The problem was caused by a merged semi-join, which contained a non-merged semi-join, which used references to the top-level query in the left_expr. When moving non-merged semi-join from the subquery to its parent, do not forget to call fix_after_pullout for its Item_subselect. We need to do that specifically, because non-merged semi-joins do not have their IN-equality in the WHERE clause at this stage.
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 537774aea2a..361da4e6279 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1558,7 +1558,12 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
{
tl->set_tablenr(table_no);
if (tl->is_jtbm())
+ {
tl->jtbm_table_no= table_no;
+ Item *dummy= tl->jtbm_subselect;
+ tl->jtbm_subselect->fix_after_pullout(parent_lex, &dummy);
+ DBUG_ASSERT(dummy == tl->jtbm_subselect);
+ }
SELECT_LEX *old_sl= tl->select_lex;
tl->select_lex= parent_join->select_lex;
for (TABLE_LIST *emb= tl->embedding;