summaryrefslogtreecommitdiff
path: root/sql/opt_subselect.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-07-16 09:22:17 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-07-16 09:22:17 +0400
commit9651a6f5745c330111b5281e69a7d52fc8261d0d (patch)
tree57fdb29f4035a0a1c4edc155f97577f645e29796 /sql/opt_subselect.cc
parent716a49a19e9a6fdd86f384917c8fdd6fdd0dd53f (diff)
downloadmariadb-git-9651a6f5745c330111b5281e69a7d52fc8261d0d.tar.gz
mdev-4173: Wrong result (extra row) with semijoin=on, joins in outer query, LEFT JOIN in the subquery
Apply the patch from Patryk Pomykalski: - create_internal_tmp_table_from_heap() will now return information whether the last row that we tried to write was a duplicate row. (mysql-5.6 also has this change)
Diffstat (limited to 'sql/opt_subselect.cc')
-rw-r--r--sql/opt_subselect.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 660d52e20fe..773897474f3 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4227,9 +4227,13 @@ int SJ_TMP_TABLE::sj_weedout_check_row(THD *thd)
/* create_internal_tmp_table_from_heap will generate error if needed */
if (!tmp_table->file->is_fatal_error(error, HA_CHECK_DUP))
DBUG_RETURN(1); /* Duplicate */
+
+ bool is_duplicate;
if (create_internal_tmp_table_from_heap(thd, tmp_table, start_recinfo,
- &recinfo, error, 1))
+ &recinfo, error, 1, &is_duplicate))
DBUG_RETURN(-1);
+ if (is_duplicate)
+ DBUG_RETURN(1);
}
DBUG_RETURN(0);
}