← Back to team overview

maria-developers team mailing list archive

Re: MDEV-4667 DATE('string') incompability between mysql and mariadb

 

Hi, Alexander!

On Jul 03, Alexander Barkov wrote:
> Hi Serg,
> 
> my review comments for
> http://bazaar.launchpad.net/~maria-captains/maria/5.3-serg/revision/3665
> 
> The patch looks ok. Just a couple of small comments:

Thanks!

> > === modified file 'sql/field.cc'
> > --- sql/field.cc	2013-02-28 20:48:47 +0000
> > +++ sql/field.cc	2013-07-03 07:46:20 +0000
> > @@ -5127,10 +5127,9 @@
> >    Lazy_string_str str(from, len);
> >
> >    func_res= str_to_datetime(from, len, &ltime,
> > -                            (TIME_FUZZY_DATE |
> > -                             (thd->variables.sql_mode &
> > +                            (thd->variables.sql_mode &
> >                                (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
> > -                               MODE_INVALID_DATES))),
> > +                               MODE_INVALID_DATES)),
> 
> 
> Why not to add a new method in THD to return these sql_mode datetime
> flags? These flags repeat many times.
> 
> 
> Something similar to sql_mode_for_dates(), but always returning the 
> "strict_date_checking" version that ORs all three flags:
> 
> return thd->variables.sql_mode &
>         (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES);

Let's do that in 10.0, we can simply use sql_mode_for_dates()
everywhere.

> By the way, sql_mode_for_dates() is used in str_to_datetime_with_warn()
> and Item::send(). Do you know why? Perhaps they also should follow
> all these three sql_mode date flags...

Yes, in 10.0 for 5.3 and 5.5 we preserved the historical behavior.

Regards,
Sergei


References