diff options
author | unknown <monty@mysql.com> | 2005-07-27 22:58:55 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-07-27 22:58:55 +0300 |
commit | e0b13405f6a3ac6ceee3518d50f964cb9542feb4 (patch) | |
tree | d22dfd676047629b4e15869388962ab4b66a287e | |
parent | 7b88672dce715ccc023be3cbb68905d5c0fd4d53 (diff) | |
download | mariadb-git-e0b13405f6a3ac6ceee3518d50f964cb9542feb4.tar.gz |
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
sql/sql_select.cc:
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
-rw-r--r-- | sql/sql_select.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 29560e8701b..d3e8b3ab9e7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1072,7 +1072,14 @@ JOIN::exec() else { 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) || procedure->end_of_records()) |