[MDEV-23656] view: removal of parentheses results in wrong result Created: 2020-09-03 Updated: 2021-04-19 Resolved: 2020-10-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Views |
| Affects Version/s: | 10.5.5, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.35, 10.3.26, 10.4.16, 10.5.7 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Georg Richter | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
might be related to Parentheses in view were optimized out, which ends up in wrong result:
|
| Comments |
| Comment by Alice Sherepa [ 2020-09-03 ] | |||||||||||
|
Correct results in 5.5-10.1, but in 10.2-10.5 view was created as:
| |||||||||||
| Comment by Georg Richter [ 2020-09-03 ] | |||||||||||
|
See also Stackoverflow | |||||||||||
| Comment by Geoff Montee (Inactive) [ 2020-10-01 ] | |||||||||||
|
The documentation team noticed that MySQL sometimes adds superfluous parentheses to view definitions. For example, if you create this view:
It becomes this on MariaDB 10.2:
But it becomes this on MySQL 5.7:
Maybe MySQL does this as a way to prevent bugs like this, but I'm not sure. | |||||||||||
| Comment by Sergei Golubchik [ 2020-10-03 ] | |||||||||||
|
Yes, MySQL just adds parentheses whenever possible just in case. MariaDB did that too until 10.2. Since then it tries to produce more readable expressions by only adding parentheses where needed. |