[MDEV-30082] View definition losing brackets changes semantics of the query and causes wrong result Created: 2022-11-23 Updated: 2022-12-16 Resolved: 2022-12-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Views |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 |
| Fix Version/s: | 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
The initial WHERE clause in the query makes sense: t1.a <= ALL (SELECT 'a') in the IN expression returns true or false, and boolean t1.b is compared to it. But when the view is created, the brackets around the expression are omitted, and the whole query becomes very different:
So, now the boolean t1.b is instead compared to the string t1.a, and the result is again compared to the string. It causes warnings about data type truncation and eventual wrong result.
Reproducible on all of 10.3+. |
| Comments |
| Comment by Oleksandr Byelkin [ 2022-11-29 ] | |||||||||
|
I'd prefer do not have pure cosmetic changes in 10.3 if otherwise it is not changed:
Otherwise the patch is OK to push. |