[MDEV-25032] Window functions without column references get removed from ORDER BY Created: 2021-03-02 Updated: 2021-07-07 Resolved: 2021-07-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.38, 10.3.29, 10.4.19, 10.5.10 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vicențiu Ciorbaru | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The DESC keyword is being ignored. |
| Comments |
| Comment by Vicențiu Ciorbaru [ 2021-03-02 ] | ||||||||||||
|
Preliminary analysis: 1. The ORDER BY clause drops the window function column as it reports no used tables. This is apparent when adding a column to the window function's OVER () clause, causing it to report used tables properly:
Potential fixes: | ||||||||||||
| Comment by Vicențiu Ciorbaru [ 2021-03-02 ] | ||||||||||||
|
Hi Sergei! Can you please review this fix for window functions. I chose to go with option 2 (according to my first comment on the issue), as option 1 didn't semantically fit, see patch comment. https://github.com/MariaDB/server/commit/f4428ec3a2e5c256b3c4af7c9a3aea3892ec7d65 | ||||||||||||
| Comment by Sergei Petrunia [ 2021-03-04 ] | ||||||||||||
|
Ok to push. |