[MDEV-23022] Incorrect query result when NOT inside BETWEEN is used in VIEW Created: 2020-06-26 Updated: 2022-06-23 Resolved: 2022-06-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server, Views |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.3.36, 10.4.26, 10.5.17, 10.6.9, 10.7.5, 10.8.4, 10.9.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Sergei Petrunia | Assignee: | Oleksandr Byelkin |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
Ok, we got empty result as the row doesn't match the WHERE.
This is incorrect. The cause can be seen here:
The brackets are printed in a way that doesn't match the original WHERE clause. Do CMP_PRECEDENCE and BETWEEN_PRECENDENCE have wrong values? |
| Comments |
| Comment by Sergei Petrunia [ 2020-06-26 ] | |||||||||||||
|
I was using 10.4 but probably eariler versions are affected as well. | |||||||||||||
| Comment by Oleksandr Byelkin [ 2020-06-30 ] | |||||||||||||
|
Printing of an expression looks like this:
(taken from debug) | |||||||||||||
| Comment by Oleksandr Byelkin [ 2020-06-30 ] | |||||||||||||
|
probably problem is here starting from 10.2 where print_parenthesised was introduced. | |||||||||||||
| Comment by Oleksandr Byelkin [ 2020-06-30 ] | |||||||||||||
|
And as far as I can see :
and so
and
shoud be equal | |||||||||||||
| Comment by Oleksandr Byelkin [ 2020-06-30 ] | |||||||||||||
|
Normal test suite
| |||||||||||||
| Comment by Oleksandr Byelkin [ 2020-06-30 ] | |||||||||||||
|
10.1 is OK. So problem is that according to print rules "=" has higher priority then BETWEEN but it is contradict reality of our parser and following:
parsed to
| |||||||||||||
| Comment by Oleksandr Byelkin [ 2022-06-23 ] | |||||||||||||
|
fixed already:
|