Details
Description
The regexp function works differently when evaluating a string stored in a variable than it does when evaluating a string literal.
Example:
select |
0xE001A90213021002,
|
@regCheck:= '\\xE0\\x01', |
'\\xE0\\x01'= @regCheck, |
0xE001A90213021002 REGEXP @regCheck,
|
0xE001A90213021002 REGEXP '\\xE0\\x01'; |
The select statement above successfully matches via the regular expression only when the string literal is used. The evaluation of the variable fails to match, even though Maria is saying the string literal and the variable have matching values.
The problem appears to be related to the use of the hex values in the regular expression, as the following statement evaluates without issue:
select |
@regCheck :='D' |
@testvar:='Dude', |
@testvar regexp @regCheck,
|
@testvar regexp 'D'; |
I tested this against MySQL 5.5, where the evaluation fails for both the string literal and the variable (completely non-functional in all situations), so I decided to report the bug here instead.