summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-06-22 18:21:21 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2020-10-12 17:07:33 +0200
commit1df5a92df899d033841d77c34e1512e2b118b2ec (patch)
treeff7879dbeb9f0afd8ef95cfa4aad0b5ba741ea20 /sql/sql_delete.cc
parent861cd4ce286e7b41cc38facfc86c358e15161a74 (diff)
downloadmariadb-git-bb-10.5-MDEV-21916.tar.gz
MDEV-21916: COM_STMT_BULK_EXECUTE with RETURNING insert wrong valuesbb-10.5-MDEV-21916
To allocate new net buffer to avoid changing bufer we are reading.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 7280236e43f..5aaff3cf623 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -685,8 +685,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
!table->prepare_triggers_for_delete_stmt_or_event())
will_batch= !table->file->start_bulk_delete();
- if (returning)
+ /*
+ thd->get_stmt_da()->is_set() means first iteration of prepared statement
+ with array binding operation execution (non optimized so it is not
+ INSERT)
+ */
+ if (returning && !thd->get_stmt_da()->is_set())
{
+ DBUG_ASSERT(thd->lex->sql_command != SQLCOM_INSERT);
if (result->send_result_set_metadata(returning->item_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
goto cleanup;