← Back to team overview

maria-developers team mailing list archive

Re: b14b6f31fa2: MDEV-26843: Inconsistent behavior of ROW_NUMBER upon resignalling from function Analysis: ROW_NUMBER should be 0 because the error produced is not related to statement that modifies table data. It is just wrong number of arguments. However, ROW_NUMBER is 1 because m_current_row_for_warning is not set to 0 before executing function. Fix: Set m_current_row_for_warning to 0.

 

Hi, Rucha!

What if you have

 INSERT t1 VALUES (f1(1)), (f1(2)), (f1());

?

On Jan 11, Rucha Deodhar wrote:
> revision-id: b14b6f31fa2 (mariadb-10.6.1-143-gb14b6f31fa2)
> parent(s): d555ae38381
> author: Rucha Deodhar
> committer: Rucha Deodhar
> timestamp: 2021-10-21 17:13:13 +0530
> message:
> 
> MDEV-26843: Inconsistent behavior of ROW_NUMBER upon resignalling from
> function
> Analysis: ROW_NUMBER should be 0 because the error produced is not related to
> statement that modifies table data. It is just wrong number of arguments.
> However, ROW_NUMBER is 1 because m_current_row_for_warning is not set to 0
> before executing function.
> Fix: Set m_current_row_for_warning to 0.
> 
> diff --git a/sql/sp_head.cc b/sql/sp_head.cc
> index d1cf5c2d9bd..ebae2f356bd 100644
> --- a/sql/sp_head.cc
> +++ b/sql/sp_head.cc
> @@ -2033,6 +2033,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
>    */
>    if (argcount != m_pcont->context_var_count())
>    {
> +    thd->get_stmt_da()->reset_current_row_for_warning(0);
>      /*
>        Need to use my_error here, or it will not terminate the
>        invoking query properly.

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx