mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug #54734 assert in Diagnostics_area::set_ok_status
This assert checks that the server does not try to send OK to the client if there has been some error during processing. This is done to make sure that the error is in fact sent to the client. The problem was that view errors during processing of WHERE conditions in UPDATE statements where not detected by the update code. It therefore tried to send OK to the client, triggering the assert. The bug was only noticeable in debug builds. This patch fixes the problem by making sure that the update code checks for errors during condition processing and acts accordingly.
This commit is contained in:
@@ -11657,38 +11657,30 @@ flush_cached_records(JOIN *join,JOIN_TAB *join_tab,bool skip_last)
|
||||
SQL_SELECT *select=join_tab->select;
|
||||
if (rc == NESTED_LOOP_OK)
|
||||
{
|
||||
bool consider_record= !join_tab->cache.select ||
|
||||
!join_tab->cache.select->skip_record();
|
||||
|
||||
/*
|
||||
Check for error: skip_record() can execute code by calling
|
||||
Item_subselect::val_*. We need to check for errors (if any)
|
||||
after such call.
|
||||
*/
|
||||
if (join->thd->is_error())
|
||||
bool skip_record= FALSE;
|
||||
if (join_tab->cache.select &&
|
||||
join_tab->cache.select->skip_record(join->thd, &skip_record))
|
||||
{
|
||||
reset_cache_write(&join_tab->cache);
|
||||
return NESTED_LOOP_ERROR;
|
||||
}
|
||||
|
||||
if (consider_record)
|
||||
if (!skip_record)
|
||||
{
|
||||
uint i;
|
||||
reset_cache_read(&join_tab->cache);
|
||||
for (i=(join_tab->cache.records- (skip_last ? 1 : 0)) ; i-- > 0 ;)
|
||||
{
|
||||
read_cached_record(join_tab);
|
||||
if (!select || !select->skip_record())
|
||||
skip_record= FALSE;
|
||||
if (select && select->skip_record(join->thd, &skip_record))
|
||||
{
|
||||
/*
|
||||
Check for error: skip_record() can execute code by calling
|
||||
Item_subselect::val_*. We need to check for errors (if any)
|
||||
after such call.
|
||||
*/
|
||||
if (join->thd->is_error())
|
||||
rc= NESTED_LOOP_ERROR;
|
||||
else
|
||||
rc= (join_tab->next_select)(join,join_tab+1,0);
|
||||
reset_cache_write(&join_tab->cache);
|
||||
return NESTED_LOOP_ERROR;
|
||||
}
|
||||
if (!skip_record)
|
||||
{
|
||||
rc= (join_tab->next_select)(join,join_tab+1,0);
|
||||
if (rc != NESTED_LOOP_OK && rc != NESTED_LOOP_NO_MORE_ROWS)
|
||||
{
|
||||
reset_cache_write(&join_tab->cache);
|
||||
|
||||
Reference in New Issue
Block a user