Re: [Maria-developers] 93493a0e9b5: MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if()

2022-04-13 Thread Aleksey Midenkov
Hi Sergei,

On Wed, Apr 13, 2022 at 8:18 PM Sergei Golubchik  wrote:
>
> Hi, Aleksey,
>
> On Apr 12, Aleksey Midenkov wrote:
> > > > > > +bool Vcol_expr_context::init()
> > > > > > +{
> > > > > > +  /*
> > > > > > +  As this is vcol expression we must narrow down name 
> > > > > > resolution to
> > > > > > +  single table.
> > > > > > +  */
> > > > > > +  if (init_lex_with_single_table(thd, table, ))
> > > > >
> > > > CURRENT_TEST: gcol.gcol_bugfixes
> > > > mysqltest: At line 579: query 'INSERT INTO t1 (suppliersenttoday)
> > > > VALUES (0)' failed: 2013: Lost connection to MySQL server during query
> > >
> > > this one crashes. on the next line, 580, though.
> > > because you set CONTEXT_ANALYSIS_ONLY_VCOL_EXPR, so
> > > Type_std_attributes::agg_item_set_converter does not wrap items
> > > in Item_func_conv_charset. Which is likely incorrect, because items
> > > without wrapping cannot be properly evaluated, and it looks like they
> > > has to be evaluated later, so it's not "context analysys only".
> > >
> > > Crash on wrapped items is https://jira.mariadb.org/browse/MDEV-25638
> > > that Sanja is looking at right now.
> >
> > Agree, I have the same picture now. Previous faults were on work in
> > progress. So it faults anyway and we keep
> > init_lex_with_single_table(), right?
>
> No, quite the opposite.
> I think (see above) that CONTEXT_ANALYSIS_ONLY_VCOL_EXPR
> (it's set inside init_lex_with_single_table()) is wrong, what you're
> doing is not "context analysys only", you're preparing items for
> evaluation.

That works identically in branch and vanilla 10.3:

--source include/have_ucs2.inc
create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci,
 v1 char(1) character set ucs2 collate ucs2_test_ci as (c1),
 v2 int as (c1 = 'b'),
 v3 int as (v1 = 'b'));
insert into t1 (c1) values ('a');
select * from t1 where v1 = 'b';
drop table t1;

Result:
select * from t1 where v1 = 'b';
c1  v1  v2  v3
a   a   0   0

.opt file:
--character-sets-dir=$MYSQL_TEST_DIR/std_data/ldml/

Please, correct the test case if I missed something.
...

As a side note here I tried to clear CONTEXT_ANALYSIS_ONLY_VCOL_EXPR:
https://github.com/midenok/mariadb/issues/93#issuecomment-1098336828

Couple of tests failed.

>
> Let's wait for Sanja to close his MDEV-25638, and then I'll check this
> test case again.
>
> Regards,
> Sergei
> VP of MariaDB Server Engineering
> and secur...@mariadb.org



-- 
@midenok

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] 93493a0e9b5: MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if()

2022-04-13 Thread Sergei Golubchik
Hi, Aleksey,

On Apr 12, Aleksey Midenkov wrote:
> > > > > +bool Vcol_expr_context::init()
> > > > > +{
> > > > > +  /*
> > > > > +  As this is vcol expression we must narrow down name resolution 
> > > > > to
> > > > > +  single table.
> > > > > +  */
> > > > > +  if (init_lex_with_single_table(thd, table, ))
> > > >
> > > CURRENT_TEST: gcol.gcol_bugfixes
> > > mysqltest: At line 579: query 'INSERT INTO t1 (suppliersenttoday)
> > > VALUES (0)' failed: 2013: Lost connection to MySQL server during query
> >
> > this one crashes. on the next line, 580, though.
> > because you set CONTEXT_ANALYSIS_ONLY_VCOL_EXPR, so
> > Type_std_attributes::agg_item_set_converter does not wrap items
> > in Item_func_conv_charset. Which is likely incorrect, because items
> > without wrapping cannot be properly evaluated, and it looks like they
> > has to be evaluated later, so it's not "context analysys only".
> >
> > Crash on wrapped items is https://jira.mariadb.org/browse/MDEV-25638
> > that Sanja is looking at right now.
> 
> Agree, I have the same picture now. Previous faults were on work in
> progress. So it faults anyway and we keep
> init_lex_with_single_table(), right?

No, quite the opposite.
I think (see above) that CONTEXT_ANALYSIS_ONLY_VCOL_EXPR
(it's set inside init_lex_with_single_table()) is wrong, what you're
doing is not "context analysys only", you're preparing items for
evaluation.

Let's wait for Sanja to close his MDEV-25638, and then I'll check this
test case again.

Regards,
Sergei
VP of MariaDB Server Engineering
and secur...@mariadb.org

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp