[MDEV-23826] ORDER BY in view definition leads to wrong result with GROUP BY on query using view Created: 2020-09-27 Updated: 2021-01-12 Resolved: 2021-01-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.2.33, 10.3.24, 10.4.14, 10.5.5 |
| Fix Version/s: | 10.2.37, 10.3.28, 10.4.18, 10.5.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
Starting with MariaDB 10.2 the SQL snippet below does no longer return the same result on all three SELECTs at its end as expected, instead the last query, which uses the view with ORDER BY in it, returns an empty result set now:
|
| Comments |
| Comment by Michael Widenius [ 2021-01-11 ] |
|
Shouldn't the change you did to Item_direct_view_ref be done to Item_direct_ref ? Item_direct_view_ref::val_time_packed() should probably be written as the other val methods in Item_direct_view_ref: double val_real() { if (check_null_ref()) return 0; else return Item_direct_ref::val_real(); }A suggestion to make this kind of bugs a bit easier to avoid in the future: I have attached a "fixed" patch to this Jira entry with the above changes. Feel free to push it after you have checked and agreed to my changes. |
| Comment by Michael Widenius [ 2021-01-11 ] |
|
See comments |