← Back to team overview

maria-developers team mailing list archive

Oracle strings functions compatibility : substr / MDEV 10574

 

Hello Alexander,
If you remember, there was still a problem with our function substr_oracle when length is less or equal to zero.
Can you review this very small patch for this ?

For MDEV-10574, If we overload only functions required for Oracle compatibility (ltrim/rtrim and lpad/rpad), could I make a similar patch ? (by adding functions ltrim_oracle, ... like for substr)  
It's for us the last blocking point.

Regards,
Jérôme.

> -----Message d'origine-----
> De : Alexander Barkov [mailto:bar@xxxxxxxxxxx]
> Envoyé : mardi 19 septembre 2017 13:16
> À : jerome brauge
> Objet : Re: Oracle strings functions compatibility : substr
> 
>   Hi Jerome,
> 
> I noticed one more difference in SUBSTR:
> 
> 
> SELECT SUBSTR('aaa',1,-1)  FROM DUAL;
> 
> MariaDB returns an empty string.
> Oracle returns NULL.
> 
> Here's Oracle's documentation:
> 
> https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions162.htm
> 
> 
> I think we should do this in the same patch, to avoid behavior change in the
> future.
> 
> Would you like to try doing this additional change?
> Or would you like me to make an incremental patch on top of yours?
> 
> Thanks!
> 
> On 09/19/2017 10:33 AM, jerome brauge wrote:
> > Hello Alexander,
> > It's done.
> >
> > Do you have news from Sergei for MDEV-12874,  MDEV-13417 and MDEV-
> 13418 ?
> 
> I asked Sergei, awaiting for his answer. I'll let you know.
> 
> >
> > Thank you very much.
> >
> >
> >
> >> -----Message d'origine-----
> >> De : Alexander Barkov [mailto:bar@xxxxxxxxxxx] Envoyé : lundi 18
> >> septembre 2017 18:12 À : jerome brauge Objet : Re: Oracle strings
> >> functions compatibility : substr
> >>
> >> Hello Jerome,
> >>
> >>
> >> On 09/18/2017 05:14 PM, jerome brauge wrote:
> >>> Hello Alexander,
> >>> I don't understand how I've missed such an obvious solution !
> >>> Here is the new patch.
> >>
> >> Thanks. Now it looks simpler.
> >>
> >> Can you please do one small thing:
> >> move get_position() from "public:" to "protected:".
> >>
> >> Ok to make a pull request after this change.
> >>
> >> Thank you very much!
> >>
> >>
> >>>
> >>> Regards.
> >>> Jérôme.
> >>>
> >>>
> >>>> -----Message d'origine-----
> >>>> De : Alexander Barkov [mailto:bar@xxxxxxxxxxx] Envoyé : lundi 18
> >>>> septembre 2017 11:30 À : jerome brauge Objet : Re: Oracle strings
> >>>> functions compatibility : substr
> >>>>
> >>>>   Hello Jerome,
> >>>>
> >>>>
> >>>> On 08/17/2017 04:43 PM, jerome brauge wrote:
> >>>>> Hello Alexander,
> >>>>> Here is a patch for function SUBSTR in sql_mode=oracle (If
> >>>>> position is 0,
> >>>> then it is treated as 1).
> >>>>
> >>>> I'm thinking of how to get a smaller patch.
> >>>>
> >>>> Wouldn't it be possible to introduce:
> >>>>
> >>>>  virtual longlong get_position();
> >>>>
> >>>>
> >>>>
> >>>>  longlong Item_func_substr::get_position()  {
> >>>>    return args[1]->val_int();
> >>>>  }
> >>>>
> >>>>  longlong Item_func_substr_oracle::get_position()
> >>>>  {
> >>>>    longlong pos= args[1]->val_int();
> >>>>    return pos == 0 ? 1 : pos;
> >>>>  }
> >>>>
> >>>>
> >>>> and just replace all calls for args[1]->val_int() to get_position()  ?
> >>>>
> >>>> Thanks!
> >>>>
> >>>>
> >>>>>
> >>>>> Regards,
> >>>>> Jérôme.
> >>>>>

Attachment: mdev14012_part2.diff
Description: mdev14012_part2.diff


Follow ups