Open AnyhowStep opened 3 years ago
According to the documentation, we should see 'a' = 'a' LIKE '0'
be evaluated as,
('a' = 'a') LIKE '0'
But it is evaluated,
'a' = ('a' LIKE '0')
predicate:
...
| bit_expr LIKE simple_expr opt_escape
...
| bit_expr
bool_pri:
...
| bool_pri comp_op predicate %prec EQ
...
| predicate
The problem is that when we have 'a' = 'a' LIKE '0'
, for it to parse as ('a' = 'a') LIKE '0'
,
there needs to be a rule (directly or indirectly),
predicate:
...
| bool_pri LIKE simple_expr opt_escape
because 'a' = 'a'
is a bool_pri
.
There is no such rule.
https://dev.mysql.com/doc/refman/5.7/en/operator-precedence.html
View on DB Fiddle