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

MDEV-16783 Assertion `!conds' failed in mysql_delete upon 2nd execution of SP with DELETE HISTORY

* remove assertion
* do not setup `conds` if it's already cached

Fixes #823
This commit is contained in:
Nikita Malyavin
2018-07-24 01:59:15 +10:00
committed by Sergei Golubchik
parent 6c6ca907ee
commit db3be33ec8
3 changed files with 25 additions and 5 deletions

View File

@ -100,5 +100,11 @@ ERROR 42S02: 'v' is a view
unlock tables; unlock tables;
drop view v; drop view v;
drop table t; drop table t;
create table t1 (i int) with system versioning;
create procedure pr() delete history from t1 before system_time now();
call pr;
call pr;
drop procedure pr;
drop table t1;
drop database test; drop database test;
create database test; create database test;

View File

@ -107,5 +107,15 @@ unlock tables;
drop view v; drop view v;
drop table t; drop table t;
#
# MDEV-16783 Assertion `!conds' failed in mysql_delete upon 2nd execution of SP with DELETE HISTORY
#
create table t1 (i int) with system versioning;
create procedure pr() delete history from t1 before system_time now();
call pr;
call pr;
drop procedure pr;
drop table t1;
drop database test; drop database test;
create database test; create database test;

View File

@ -323,12 +323,16 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_ASSERT(table); DBUG_ASSERT(table);
DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute()); DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute());
if (select_lex->vers_setup_conds(thd, table_list))
DBUG_RETURN(TRUE);
DBUG_ASSERT(!conds); // conds could be cached from previous SP call
conds= table_list->on_expr; if (!conds)
table_list->on_expr= NULL; {
if (select_lex->vers_setup_conds(thd, table_list))
DBUG_RETURN(TRUE);
conds= table_list->on_expr;
table_list->on_expr= NULL;
}
} }
if (mysql_handle_list_of_derived(thd->lex, table_list, DT_MERGE_FOR_INSERT)) if (mysql_handle_list_of_derived(thd->lex, table_list, DT_MERGE_FOR_INSERT))