Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-15015

Fix pagination in Microsoft SQL Server for queries using UNION

    Details

    • Branch Version/s:
      6.0.x, 5.2.x
    • Backported to Branch:
      Committed

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  8 years, 39 weeks, 6 days ago

                  Packages

                  Version Package
                  --Sprint - SP
                  6.0.6 GA
                  6.1.0 CE RC1