diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-10-18 13:27:36 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2021-10-20 09:04:09 +0530 |
commit | 5703d7ce1c2fc4cbd95c9b7747343923afc74571 (patch) | |
tree | 1bb593237c2ee48fe42f04608e4f36e985c49eb2 /sql/sql_insert.cc | |
parent | c27f04ede5a92f37d0b22e5c90523bcccb1af37a (diff) | |
download | mariadb-git-bb-10.7-row_number-MDEV-26830.tar.gz |
MDEV-26830: Wrong ROW_NUMBER in diagnostics upon INSERT IGNORE withbb-10.7-row_number-MDEV-26830
CHECK violation
Analysis: When there is constraint fail we return non-zero value for
view_check_option(). So we continue the loop which doesn't increment the
counter because it increments at the end of the loop.
Fix: Increment m_current_row_for_warning() at the beginning of loop. This
will also fix similar bugs if any, about counter not incrementing
correctly because of continue.
Diffstat (limited to 'sql/sql_insert.cc')
-rw-r--r-- | sql/sql_insert.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 3dff6722a3d..9ad29eba04a 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -842,7 +842,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, switch_to_nullable_trigger_fields(*values, table); } its.rewind (); - thd->get_stmt_da()->reset_current_row_for_warning(1); + thd->get_stmt_da()->reset_current_row_for_warning(0); /* Restore the current context. */ ctx_state.restore_state(context, table_list); @@ -1009,6 +1009,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, while ((values= its++)) { + thd->get_stmt_da()->inc_current_row_for_warning(); if (fields.elements || !value_count) { /* @@ -1125,7 +1126,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, if (unlikely(error)) break; info.accepted_rows++; - thd->get_stmt_da()->inc_current_row_for_warning(); } its.rewind(); iteration++; |