summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-24 14:45:09 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-24 14:45:09 +0400
commitfe25ec8f2425cfd0e59d9a20f0094d6fc6e0cd3a (patch)
tree79d297822c1d85981f562b66cc48a7dfcafb8d64 /sql/sql_select.cc
parenta9a2ceae1f360c275ed4db5b093ab65be4f5fb7b (diff)
parentbccf219bfc61bb45d334b40d732651eb9bef5075 (diff)
downloadmariadb-git-fe25ec8f2425cfd0e59d9a20f0094d6fc6e0cd3a.tar.gz
5.0-bugteam->5.1-bugteam merge
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 618332ae89b..77d63305b19 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5043,6 +5043,11 @@ greedy_search(JOIN *join,
if (best_extension_by_limited_search(join, remaining_tables, idx, record_count,
read_time, search_depth, prune_level))
DBUG_RETURN(TRUE);
+ /*
+ 'best_read < DBL_MAX' means that optimizer managed to find
+ some plan and updated 'best_positions' array accordingly.
+ */
+ DBUG_ASSERT(join->best_read < DBL_MAX);
if (size_remain <= search_depth)
{
@@ -8824,8 +8829,14 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
we still make the inner tables dependent on the outer tables.
It would be enough to set dependency only on one outer table
for them. Yet this is really a rare case.
+ Note:
+ RAND_TABLE_BIT mask should not be counted as it
+ prevents update of inner table dependences.
+ For example it might happen if RAND() function
+ is used in JOIN ON clause.
*/
- if (!(prev_table->on_expr->used_tables() & ~prev_used_tables))
+ if (!((prev_table->on_expr->used_tables() & ~RAND_TABLE_BIT) &
+ ~prev_used_tables))
prev_table->dep_tables|= used_tables;
}
}