AshharAhmadKhan opened a new pull request, #6494: URL: https://github.com/apache/fineract/pull/6494
GenericDataServiceImpl#wrapSQL wraps every report's SQL as select x.* from (<sql>) x. A derived table's own ORDER BY is not guaranteed to be honored by the outer query, so a report SQL script ending in an ORDER BY clause returns rows in an arbitrary order. Added ReportSqlOrderByLifter to detect a top-level trailing ORDER BY and lift it onto the outer wrapper query, ignoring ORDER BY inside subqueries, window functions, string literals, and SQL comments. Updated GenericDataServiceImpl#wrapSQL to use it. Added ReportSqlOrderByLifterTest and GenericDataServiceImplTest#wrapSqlPreservesOrderByFromJiraRepro. Prior attempt: #6058 See https://issues.apache.org/jira/browse/FINERACT-2622 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
