1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä
2021-10-13 12:33:56 +03:00
70 changed files with 1087 additions and 331 deletions

View File

@ -4695,7 +4695,8 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds,
bool free_join= 1;
DBUG_ENTER("mysql_select");
select_lex->context.resolve_in_select_list= TRUE;
if (!fields.is_empty())
select_lex->context.resolve_in_select_list= true;
JOIN *join;
if (select_lex->join != 0)
{
@ -21025,26 +21026,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)
const longlong res= tab->select_cond->val_int();
if (join->thd->is_error())
DBUG_RETURN(NESTED_LOOP_ERROR);
if (!res)
{
found= 0;
if (not_exists_opt_is_applicable)
DBUG_RETURN(NESTED_LOOP_NO_MORE_ROWS);
}
else
{
/*
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);
}
}
}
}