Hi Davi,
On 03/25/11 20:45, Davi Arnaut wrote:
>> +static bool do_fill_table(THD *thd,
>> + TABLE_LIST *table_list,
>> + JOIN_TAB *join_table)
>> +{
>> + Warning_info wi(thd->query_id);
>> + Warning_info *wi_saved= thd->warning_info;
>> +
>> + thd->warning_info=&wi;
>> +
>> + bool res= table_list->schema_table->fill_table(
>> + thd, table_list, join_table->select_cond);
>> +
>> + thd->warning_info= wi_saved;
>> +
>> + // Pass an error if any.
>> +
>> + if (thd->stmt_da->is_error())
>> + {
>> + thd->warning_info->push_warning(thd,
>> + thd->stmt_da->sql_errno(),
>> + thd->stmt_da->get_sqlstate(),
>> + MYSQL_ERROR::WARN_LEVEL_ERROR,
>> + thd->stmt_da->message());
>> + }
>> +
>> + // Pass warnings (if any).
>> + //
>> + // Filter out warnings with WARN_LEVEL_ERROR level, because they
>> + // correspond to the errors which were filtered out in fill_table().
>> +
>
> Please investigate whether this logic can be implemented with a handler.
> It seems all we have to allow is any condition which is not a error
> (that is, a warning or note) and only allow a error condition only if
> the diagnostics area state is not set yet.
At least, the second part of that proposal does not work:
- first error condition happens, the diagnosticts area is not set
- thus the error condition gets propagated
- then fill_table() understands that there was an error,
and clears the diagnostics area. But the warning info does not
get cleared, so it still has a record for the ignored error
condition. That's the problem #1.
- another error condition happens
- the diagnostics areas is not set (it has been reset)
- the error condition gets propagated
...
- the warning info has records for all the ignored error conditions.
That's the problem #2.