Limit Handler for SQL server doesn't work with CTE queries with strings literals
Description
Activity
Show:
Andrea Boriero
changed the StatusDecember 5, 2019 at 4:27 PMResolved
Closed
Sanne Grinovero
changed the StatusDecember 4, 2019 at 7:39 PMOpen
Resolved
Sanne Grinovero
updated the backPortableDecember 4, 2019 at 7:39 PMNone
Backport?
Sanne Grinovero
updated the ResolutionDecember 4, 2019 at 7:39 PMNone
Fixed
Sanne Grinovero
updated the Fix versionsDecember 4, 2019 at 7:39 PMNone
5.4.10
Jason Jijón
updated the Pull RequestNovember 29, 2019 at 4:44 PMNone
https://github.com/hibernate/hibernate-orm/pull/3121
Jason Jijón
created the IssueNovember 29, 2019 at 2:46 PMFixed
Pinned fields
Click on the next to a field label to start pinning.
Details
Assignee
Reporter
Jason Jijón
Jason JijónLabels
Components
Fix versions
Affects versions
Priority
Major
Created November 29, 2019 at 2:46 PM
Updated December 5, 2019 at 4:27 PM
Resolved December 4, 2019 at 7:39 PM
The pagination using CTE queries which has string literals doesn't work because of issue in SQLServer2005LimitHandler in the method advanceOverCTEInnerQuery, specifically in this line of code in which doesn't recognize the end of string literal.
Example of CTE query with string literals (see 'GASTOS VIAJE' and 'SUMINISTROS' string literals):
WITH labores AS ( SELECT plbIdPresupuesto, plbIdSegmento, SUM(ROUND(plbPrecioExtendido, 2)) AS totalLabores FROM pre_Labor WHERE plbEliminado = 0 GROUP BY plbIdPresupuesto, plbIdSegmento ), miscelaneos AS ( SELECT pmiIdPresupuesto, pmiIdSegmento, SUM(CASE pmiTipo WHEN 'GASTOS VIAJE' THEN pmiPrecioExtendido ELSE 0 END) AS [GASTOS VIAJE], SUM(CASE pmiTipo WHEN 'SUMINISTROS' THEN pmiPrecioExtendido ELSE 0 END) AS [SUMINISTROS], SUM(ROUND(pmiPrecioExtendido, 2)) AS totalMiscelaneos FROM pre_Miscelaneo WHERE pmiEliminado = 0 GROUP BY pmiIdPresupuesto, pmiIdSegmento ) SELECT psgIdPresupuesto, totalLabores, [GASTOS VIAJE], [SUMINISTROS], totalMiscelaneos FROM pre_Segmento LEFT JOIN labores ON psgIdPresupuesto = plbIdPresupuesto AND psgIdSegmento = plbIdSegmento LEFT JOIN miscelaneos ON psgIdPresupuesto = pmiIdPresupuesto AND psgIdSegmento = pmiIdSegmento WHERE psgEliminado = 0 GROUP BY psgIdPresupuesto