Commit 579a94a3 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

after review & some other fixes

parent 446b1bd2
...@@ -1637,4 +1637,3 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -1637,4 +1637,3 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1 2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1
drop table t1; drop table t1;
...@@ -959,7 +959,6 @@ double Item_func_round::val() ...@@ -959,7 +959,6 @@ double Item_func_round::val()
return tmp2; return tmp2;
} }
void Item_func_rand::fix_length_and_dec() void Item_func_rand::fix_length_and_dec()
{ {
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
...@@ -990,6 +989,12 @@ void Item_func_rand::fix_length_and_dec() ...@@ -990,6 +989,12 @@ void Item_func_rand::fix_length_and_dec()
} }
} }
void Item_func_rand::update_used_tables()
{
Item_real_func::update_used_tables();
used_tables_cache|= RAND_TABLE_BIT;
}
double Item_func_rand::val() double Item_func_rand::val()
{ {
......
...@@ -512,6 +512,7 @@ public: ...@@ -512,6 +512,7 @@ public:
double val(); double val();
const char *func_name() const { return "rand"; } const char *func_name() const { return "rand"; }
bool const_item() const { return 0; } bool const_item() const { return 0; }
void update_used_tables();
void fix_length_and_dec(); void fix_length_and_dec();
}; };
......
...@@ -585,8 +585,9 @@ JOIN::optimize() ...@@ -585,8 +585,9 @@ JOIN::optimize()
} }
if (const_table_map != found_const_table_map && if (const_table_map != found_const_table_map &&
!(select_options & SELECT_DESCRIBE) && !(select_options & SELECT_DESCRIBE) &&
!((conds->used_tables() & RAND_TABLE_BIT) && (!conds ||
select_lex->master_unit() != &thd->lex->unit))// not upper level SELECT !(conds->used_tables() & RAND_TABLE_BIT) ||
select_lex->master_unit() == &thd->lex->unit)) // upper level SELECT
{ {
zero_result_cause= "no matching row in const table"; zero_result_cause= "no matching row in const table";
DBUG_PRINT("error",("Error: %s", zero_result_cause)); DBUG_PRINT("error",("Error: %s", zero_result_cause));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment