-
Type:
Regression Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: 5.2.3, 6.0.5 GA
-
Fix Version/s: --Sprint - SP, 6.0.6 GA, 6.1.0 CE RC1
-
Component/s: Environments > Databases
-
Labels:None
-
Branch Version/s:6.0.x, 5.2.x
-
Backported to Branch:Committed
As a result of LPS-9903, pagination does not work if the ORDER BY uses column aliases.
While LPS-14537 fixed that issue, it introduced a separate defect where pagination failed if the query had a union, because it added the "row_number()" column to the first part, but not on the subsequent parts that were being unioned together.
The solution isn't as straightforward as adding a row_number() to every subquery being unioned, because the resulting row numbers will not match the row numbers we actually want, since what we actually want is the row_number() according to the order by on the unioned result.
Therefore, the natural solution in this case is to do another level of nesting – to re-select the columns and the row number of the unioned result. Though this will result in a reduction in performance, it should still be better than no pagination.