summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc41
1 files changed, 24 insertions, 17 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e44ba4b59e1..c943de11394 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -19996,26 +19996,33 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
will be re-evaluated again. It could be fixed, but, probably,
it's not worth doing now.
*/
- if (tab->select_cond && !tab->select_cond->val_int())
+ if (tab->select_cond)
{
- /* The condition attached to table tab is false */
- if (tab == join_tab)
- {
- found= 0;
- if (not_exists_opt_is_applicable)
- DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
- }
- else
+ const longlong res= tab->select_cond->val_int();
+ if (join->thd->is_error())
+ DBUG_RETURN(NESTED_LOOP_ERROR);
+
+ if (!res)
{
- /*
- Set a return point if rejected predicate is attached
- not to the last table of the current nest level.
- */
- join->return_tab= tab;
- if (not_exists_opt_is_applicable)
- DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
+ /* The condition attached to table tab is false */
+ if (tab == join_tab)
+ {
+ found= 0;
+ if (not_exists_opt_is_applicable)
+ DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
+ }
else
- DBUG_RETURN(NESTED_LOOP_OK);
+ {
+ /*
+ Set a return point if rejected predicate is attached
+ not to the last table of the current nest level.
+ */
+ join->return_tab= tab;
+ if (not_exists_opt_is_applicable)
+ DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
+ else
+ DBUG_RETURN(NESTED_LOOP_OK);
+ }
}
}
}