Please sign in to comment.
BUG Fixing SQLQuery::aggregate() adding ORDER BY when no limit.
DataQuery::initialiseQuery() will add a default sort to a query, and when calling up an aggregate it will make a query like this which doesn't make sense: SELECT MAX("LastEdited") FROM "Member" ORDER BY "ID" In this case there is no need to add the ORDER BY, and it will break databases like MSSQL in cases such as GenericTemplateGlobalProvider which provides a default List() function for adding aggregates into SSViewer template cacheblocks. If we add a limit, however, then it does make sense: SELECT MAX("LastEdited") FROM "Member" ORDER BY "ID" LIMIT 10 This fixes SQLQuery::aggregate() to NOT add an ORDER BY to an aggregate call if there is no limit.
- Loading branch information...
Showing with 38 additions and 4 deletions.