Commit d28f576c authored by monty@mysql.com's avatar monty@mysql.com

We have also to test 'conds' even if there was no tables.

(This is because conds may not be a constant)
This bug caused a failure in the test suite for select.test becasue for prepared statements in one case a 'constant sub query' was not regarded as a constant
Sanja will as a separate task check if we can fix that the sub query can be recognized as a constant
Bug #12217
parent a5b6057d
...@@ -1072,7 +1072,14 @@ JOIN::exec() ...@@ -1072,7 +1072,14 @@ JOIN::exec()
else else
{ {
result->send_fields(fields_list,1); result->send_fields(fields_list,1);
if (cond_value != Item::COND_FALSE && (!having || having->val_int())) /*
We have to test for 'conds' here as the WHERE may not be constant
even if we don't have any tables for prepared statements or if
conds uses something like 'rand()'.
*/
if (cond_value != Item::COND_FALSE &&
(!conds || conds->val_int()) &&
(!having || having->val_int()))
{ {
if (do_send_rows && (procedure ? (procedure->send_row(fields_list) || if (do_send_rows && (procedure ? (procedure->send_row(fields_list) ||
procedure->end_of_records()) procedure->end_of_records())
......
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