← Back to team overview

maria-developers team mailing list archive

Re: 1c0731e0544: MDEV-26695: Number of an invalid row is not calculated for table value constructor

 

Hi, Rucha,

Looks good. please also check that row_number values match what's in a
warning, and then ok to push!

On Apr 26, Rucha Deodhar wrote:
> On Tue, Apr 26, 2022 at 12:41 AM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> > what if you combine it with union?
> > create table t (a char(1)) values ('a'),('b') union values ('foo');
> >
> > please, add a test for that.
> >
> >
> It gives 3 as row the number (in warning).  Added a test for it.
> Please find it here: 1c0731e0544db4d2f5c107473776bbd6d4d3e2f0
> 
> > On Apr 25, Rucha Deodhar wrote:
> > > revision-id: 1c0731e0544 (mariadb-10.7.1-33-g1c0731e0544)
> > > parent(s): 5e6fd4e8043
> > > author: Rucha Deodhar
> > > committer: Rucha Deodhar
> > > timestamp: 2022-01-23 13:48:18 +0530
> > > message:
> > >
> > > MDEV-26695: Number of an invalid row is not calculated for table value
> > > constructor
> > >
> > > Analysis: counter does not increment while sending rows for table value
> > > constructor and so row_number assumes the default value (0 in this case).
> > > Fix: Increment the counter to avoid counter using default value.
> > >
> > > diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc
> > > index bdaf6829fbd..7db0ab217ca 100644
> > > --- a/sql/sql_tvc.cc
> > > +++ b/sql/sql_tvc.cc
> > > @@ -422,7 +422,9 @@ bool table_value_constr::exec(SELECT_LEX *sl)
> > >    DBUG_ENTER("table_value_constr::exec");
> > >    List_iterator_fast<List_item> li(lists_of_values);
> > >    List_item *elem;
> > > +  THD *cur_thd= sl->parent_lex->thd;
> > >    ha_rows send_records= 0;
> > > +  int rc=0;
> > >
> > >    if (select_options & SELECT_DESCRIBE)
> > >      DBUG_RETURN(false);
> > > @@ -438,10 +440,10 @@ bool table_value_constr::exec(SELECT_LEX *sl)
> > >
> > >    while ((elem= li++))
> > >    {
> > > +    cur_thd->get_stmt_da()->inc_current_row_for_warning();
> > >      if (send_records >= sl->master_unit()->lim.get_select_limit())
> > >        break;
> > > -    int rc=
> > > -      result->send_data_with_check(*elem, sl->master_unit(),
> > send_records);
> > > +    rc= result->send_data_with_check(*elem, sl->master_unit(),
> > send_records);
> >
> > you don't need to do that anymore (it was needed in your first patch,
> > but not here)
> >
> > Removed.
> 
> > >      if (!rc)
> > >        send_records++;
> > >      else if (rc > 0)
> >
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


References