[MDEV-17263] Different Result of calculation in view Created: 2018-09-21 Updated: 2023-04-27 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Views |
| Affects Version/s: | 10.2.17, 10.3.9, 10.2, 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Björn Gießler | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Docker Image mariadb:latest |
||
| Description |
|
After upgrading MariaDB an old view we are using suddenly returned different results. I have built an test case: Two tables containing forms and position. Each form has n positions. Every position has an amount and every form has a discount, valid for all its positions:
When I query this, I get the right result:
Now when I wrap exactly this SQL statement inside an view, a different result occurs:
Problem is obviously, that the parentheses in SUM(P.amount) * (100 - F.discount)/100 are ignored in the VIEW and therefor the multiplication is executed before the subtraction.
The problem occurred when upgrading a docker container to mariadb:latest. Unfortunately I cannot say which version we were running before. So I have tested all the latest minor releases of 5.5 and 10.x from the official docker repo:
Hope that helps. It's my first bug here |
| Comments |
| Comment by Alice Sherepa [ 2018-09-24 ] | |||||||
|
Thanks for the report and the test case!
|