diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-10-18 20:30:04 +0530 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-10-26 17:29:40 +0200 |
commit | 92f7d008ab5da38e443cd1801be0cf147267d8cd (patch) | |
tree | a8770a1bf78605402399153d52d63abad81e1652 /sql/sql_delete.cc | |
parent | e13dc7d0d0820973684753cdb5cf674c4595f47b (diff) | |
download | mariadb-git-bb-10.7-row_number.tar.gz |
MDEV-26844: DELETE returns ROW_NUMBER=1 for every row uponbb-10.7-row_number
ER_TRUNCATED_WRONG_VALUE
Part 1: Fix for DELETE without ORDER BY
Analysis: m_current_row_for_warning doesn't increment and assumes default
value which is then used by ROW_NUMBER.
Fix: Increment m_current_row_for_warning for each processed row.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 396ba7fe3e4..0403d6e73c3 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -795,9 +795,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, THD_STAGE_INFO(thd, stage_updating); fix_rownum_pointers(thd, thd->lex->current_select, &deleted); + thd->get_stmt_da()->reset_current_row_for_warning(0); while (likely(!(error=info.read_record())) && likely(!thd->killed) && likely(!thd->is_error())) { + thd->get_stmt_da()->inc_current_row_for_warning(); if (delete_while_scanning) delete_record= record_should_be_deleted(thd, table, select, explain, delete_history); @@ -873,6 +875,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, else break; } + thd->get_stmt_da()->reset_current_row_for_warning(1); terminate_delete: killed_status= thd->killed; |