1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-26830: Wrong ROW_NUMBER in diagnostics upon INSERT IGNORE with

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.
This commit is contained in:
Rucha Deodhar
2021-10-18 13:27:36 +05:30
committed by Sergei Golubchik
parent 797bd73cfa
commit e13dc7d0d0
3 changed files with 34 additions and 2 deletions

View File

@ -844,7 +844,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);
@ -1011,6 +1011,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)
{
/*
@ -1127,7 +1128,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++;