← Back to team overview

maria-developers team mailing list archive

Re: MDEV-17359

 

Hi Jerome,

Note, Oracle supports not only concatenation in the pattern,
but also additive and multiplicative expressions, e.g.:

SELECT 'x' FROM DUAL WHERE '100' LIKE 10*10;

This kind of expressions currently also do not work.

I think that in this rule:

        | bit_expr LIKE mysql_concatenation_expr opt_escape
          {
            $$= new (thd->mem_root) Item_func_like(thd, $1, $3, $4,
                                                   Lex->escape_used);
            if (unlikely($$ == NULL))
              MYSQL_YYABORT;
          }


mysql_concatenation_expr should be just replaced to bit_expr.

But this adds a lot of new shift/reduce conflicts because of flaws in
the current grammar. They need to be fixed before MDEV-17359.


I reported these conflicts in:

MDEV-17374 Shift/reduce conflicts because of SOUNDS_SYM, ESCAPE_SYM,
USER_SYM not given precedence

I'll have a patch soon, then will return to MDEV-17359.

Greetings.


On 10/04/2018 09:26 AM, Alexander Barkov wrote:
> Jerome,
> 
> Can you please wait. I'll do some more analysis on the subject.
> 
> 
> On 10/04/2018 09:16 AM, Alexander Barkov wrote:
>>   Hello Jerome,
>>
>> On 10/03/2018 05:33 PM, jerome brauge wrote:
>>> Hello Alexander,
>>> Can you review this patch for MDEV-17359 ?
>>>
>>> Best regards.
>>>
>>
>>
>> Thanks for you contribution!
>>
>>
>> I noticed that Oracle also supports concatenation in the ESCAPE clause:
>>
>> SELECT 'x' FROM DUAL WHERE 'a' LIKE 'b' ESCAPE ''||'x'||'';
>>
>> This can be done separately, or can be addressed in the same patch, if
>> you wish :)
>>
>>
>> Review comments:
>>
>> I've been trying to gradually make the two *.yy files as similar as
>> possible, to turn them into a single *.yy at the end.
>> So new changes in the grammar should usually make the two files look
>> more similar rather than make them diverge.
>>
>> However, it seems in case of concatenation and like, having
>> only a pair of MYSQL_CONCAT_SYM and ORACLE_CONCAT_SYM does
>> not solve the problem. I could not make a quick patch which would
>> converge sql_yacc.yy and sql_yacc_ora.yy.
>>
>> It's likely that we'll have to introduce separate MYSQL_LIKE_SYM
>> and  ORACLE_LIKE_SYM. But I can do it separately later (after more
>> analysis).
>>
>>
>> I the meanwhile, could you please rename mysql_concatenation_expr
>> into oracle_concatenation_expr in sql_yacc_ora.yy, so it looks
>> like this:
>>
>>
>> oracle_concatenation_expr:
>>            simple_expr
>>         | oracle_concatenation_expr ORACLE_CONCAT_SYM simple_expr
>>            {
>>              $$= new (thd->mem_root)
>> Item_func_concat_operator_oracle(thd, $1, $3);
>>              if (unlikely($$ == NULL))
>>                MYSQL_YYABORT;
>>            }
>>         ;
>>
>>
>>
>> Later, when we join the two *.yy files, we will need both
>> mysql_concatenation_expr (in its current reduction)
>> and oracle_concatenation_expr (in your reduction with
>> ORACLE_CONCAT_SYM and Item_func_concat_operator_oracle) .
>>
>>
>> Thanks.
>>


Follow ups

References