maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12942
Re: 688ad5ed67f: MDEV-26830: Wrong ROW_NUMBER in diagnostics upon INSERT IGNORE with CHECK violation
Hi, Rucha!
On Oct 18, Rucha Deodhar wrote:
> revision-id: 688ad5ed67f (mariadb-10.6.1-138-g688ad5ed67f)
> parent(s): c27f04ede5a
> author: Rucha Deodhar
> committer: Rucha Deodhar
> timestamp: 2021-10-18 13:40:56 +0530
> message:
>
> 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.
>
> diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
> index 3dff6722a3d..11289779f7c 100644
> --- a/sql/sql_insert.cc
> +++ b/sql/sql_insert.cc
> @@ -1007,8 +1007,10 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
> goto values_loop_end;
> }
>
> + thd->get_stmt_da()->reset_current_row_for_warning(0);
This changes the behavior in array binding case, let's not do it in this
commit.
Better change the previous reset_current_row_for_warning() to reset to
0, not to 1.
The rest is ok.
> while ((values= its++))
> {
> + thd->get_stmt_da()->inc_current_row_for_warning();
> if (fields.elements || !value_count)
> {
> /*
> @@ -1125,7 +1127,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++;
>
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx