summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-01-12 00:14:40 -0800
committerIgor Babaev <igor@askmonty.org>2018-01-12 13:14:27 -0800
commitabc123391f5a22e18c8e260541dbdbde1375e8b5 (patch)
treef6c1281622ceb25124595bccf051603782feb243 /sql
parent6293e3bbcfc866397809b844485b9fdede97dc1b (diff)
downloadmariadb-git-abc123391f5a22e18c8e260541dbdbde1375e8b5.tar.gz
Fixed mdev-6706 Wrong result (missing rows)
with joins, SQ, ORDER BY, semijoin=on A bug in get_sort_by_table() could mislead the function setup_semijoin_dups_elimination(). As a result the optimizer could produce invalid execution plans for queries with ORDER BY and subquery predicates that could be converted to semi-joins.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c7f547edbc0..5a7fa4d2c6f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -21159,6 +21159,7 @@ get_sort_by_table(ORDER *a,ORDER *b, List<TABLE_LIST> &tables,
if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT)))
DBUG_RETURN(0);
+ map&= ~const_tables;
while ((table= ti++) && !(map & table->table->map)) ;
if (map != table->table->map)
DBUG_RETURN(0); // More than one table