Window Functions final ordering of result set
(MDEV-10879)
|
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions |
| Affects Version/s: | 10.2 |
| Fix Version/s: | 10.3.11, 10.2.19 |
| Type: | Technical task | Priority: | Critical |
| Reporter: | Chris Calender (Inactive) | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
Feature request for Oracle/DB2 migration compatibility: We are using the window function "ROW_NUMBER() OVER()" to generate the row sequence number required for pagination across the pages. For example:
Since there is no expression given in the OVER() clause, DB2 will just assign sequential numbers to the output. The column RN returned from the query will have numbers in perfect order. However, MariaDB does not guarantee the numbers in order without an explicit ORDER BY. This will require query re-writing in order to migrate. |
| Comments |
| Comment by Sergei Petrunia [ 2017-05-11 ] |
|
(I assume "ROW_NUMBER() ORDER()" had a typo, changed it to be "ROW_NUMBER() OVER()" ) |
| Comment by Vicențiu Ciorbaru [ 2018-11-01 ] |
|
Window Functions will now force the result set to use the last ordering that the server used to compute their values. This only happens if there is no specific ORDER BY for the SELECT statement. |