MDEV-36080: Assertion on 2nd PS execution with error and Array Binding

The fix for MDEV-35318 has introduced LEX::needs_reprepare and logic in
Prepared_statement::execute_loop() and sp_lex_keeper::
validate_lex_and_exec_core() to re-prepare the statement if it has hit
an error when doing once-per-statement-life optimizations.

But there is also third code path: PS with Array Binding is handled in
Prepared_statement::execute_bulk_loop(). Add handling there as well.
This commit is contained in:
Sergei Petrunia 2025-02-13 13:06:50 +02:00
commit 33e0796e7a
2 changed files with 97 additions and 0 deletions

View file

@ -4574,6 +4574,18 @@ Prepared_statement::execute_bulk_loop(String *expanded_query,
goto err;
}
if (lex->needs_reprepare)
{
/*
Something has happened on previous execution that requires us to
re-prepare before we try to execute.
*/
lex->needs_reprepare= false;
error= reprepare();
if (error)
goto err;
}
if (send_unit_results && thd->init_collecting_unit_results())
{
DBUG_PRINT("error", ("Error initializing array."));