1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Automatic merge

This commit is contained in:
Michael Widenius
2011-11-24 22:48:35 +02:00
1114 changed files with 25314 additions and 14998 deletions

View File

@@ -416,7 +416,7 @@ fix_inner_refs(THD *thd, List<Item> &all_fields, SELECT_LEX *select,
if (!ref->fixed && ref->fix_fields(thd, 0))
return TRUE;
thd->used_tables|= item->used_tables();
thd->lex->used_tables|= item->used_tables();
}
return false;
}
@@ -436,19 +436,18 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
int res;
nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
/*
Need to save the value, so we can turn off only the new NON_AGG_FIELD
Need to save the value, so we can turn off only any new non_agg_field_used
additions coming from the WHERE
*/
uint8 saved_flag= thd->lex->current_select->full_group_by_flag;
const bool saved_non_agg_field_used=
thd->lex->current_select->non_agg_field_used();
DBUG_ENTER("setup_without_group");
thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
res= setup_conds(thd, tables, leaves, conds);
/* it's not wrong to have non-aggregated columns in a WHERE */
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
thd->lex->current_select->full_group_by_flag= saved_flag |
(thd->lex->current_select->full_group_by_flag & ~NON_AGG_FIELD_USED);
thd->lex->current_select->set_non_agg_field_used(saved_non_agg_field_used);
thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
@@ -653,7 +652,8 @@ JOIN::prepare(Item ***rref_pointer_array,
aggregate functions with implicit grouping (there is no GROUP BY).
*/
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && !group_list &&
select_lex->full_group_by_flag == (NON_AGG_FIELD_USED | SUM_FUNC_USED))
select_lex->non_agg_field_used() &&
select_lex->agg_func_used())
{
my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,
ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0));
@@ -1621,7 +1621,7 @@ JOIN::optimize()
if (exec_tmp_table1->distinct)
{
table_map used_tables= thd->used_tables;
table_map used_tables= thd->lex->used_tables;
JOIN_TAB *last_join_tab= join_tab+tables-1;
do
{
@@ -2543,7 +2543,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (!(join= new JOIN(thd, fields, select_options, result)))
DBUG_RETURN(TRUE);
thd_proc_info(thd, "init");
thd->used_tables=0; // Updated by setup_fields
thd->lex->used_tables=0;
if ((err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param,
select_lex, unit)))
@@ -2695,6 +2695,16 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds,
table_vector[i]=s->table=table=tables->table;
table->pos_in_table_list= tables;
error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
DBUG_EXECUTE_IF("bug11747970_raise_error",
{
if (!error)
{
my_error(ER_UNKNOWN_ERROR, MYF(0));
goto error;
}
});
if (error)
{
table->file->print_error(error, MYF(0));
@@ -10781,6 +10791,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
if (open_tmp_table(table))
goto err;
// Make empty record so random data is not written to disk
empty_record(table);
thd->mem_root= mem_root_save;
DBUG_RETURN(table);
@@ -17371,7 +17384,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
need_order=0;
extra.append(STRING_WITH_LEN("; Using filesort"));
}
if (distinct & test_all_bits(used_tables,thd->used_tables))
if (distinct & test_all_bits(used_tables, thd->lex->used_tables))
extra.append(STRING_WITH_LEN("; Distinct"));
for (uint part= 0; part < tab->ref.key_parts; part++)