maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12937
Re: fcf2c5fff14: MDEV-26299: Some views force server (and mysqldump) to generate invalid SQL for their definitions
Hi, Oleksandr!
> > > @@ -25806,7 +25811,8 @@ void st_select_lex::print(THD *thd, String *str,
> > > else
> > > str->append(',');
> > >
> > > - if (is_subquery_function() && item->is_autogenerated_name)
> > > + if ((is_subquery_function() && item->is_autogenerated_name) ||
> > > + !item->name)
> >
> > Where can item->name be NULL? I thought the either specified by the user
> > or autogenerated, but never NULL.
>
> Or internally created with null name.
Do you have an example of such internally created with null name item?
> > > @@ -25815,7 +25821,26 @@ void st_select_lex::print(THD *thd, String
> > > + if (top_level ||
> > > + !item->is_autogenerated_name ||
> > > + !check_table_name(item->name, len, TRUE))
> >
> > why check_table_name() if it isn't a table? it's an incorrect check to
> > use for columns.
>
> A derived table AKA a subquery in the FROM clause is still a table. For
> other things I have no idea why we check AS part for correspondence to
> table name rules, but we do it on parsing.
A derived table is still a table. But item->name isn't a name of a
defived, it's a name of the item. check_table_name is just incorrect
there, it will reject valid column names and will accept invalid column
names. A check_column_name function exists for a reason :)
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx
References