You can clone with
HTTPS or Subversion.
FIX Empty fields on SQLQuery->aggregate() with alias
Breaks Postgres otherwise, because it produces a
"SELECT *, <field> ... " statement without putting all
fields into the GROUP BY.
@chillu Did you ever get something like this? ...see below:
mssql_query(): message: Column "SiteTree_Live.Sort" is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause.
This most likely happens with PostgreSQL as well. You can check this by simply using a <% cached 'something', List(Page).max(LastEdited) %> block in the template. It will try querying for the aggregate and fail.
<% cached 'something', List(Page).max(LastEdited) %>
e53280c seems to have introduced the ability to sort an aggregate. DataQuery::initialiseQuery() will add "Sort" as a default sorting on all queries to Page (SiteTree::$default_sort), but it won't add a GROUP BY automatically, thus causing the error. MSSQL complains if you sort an aggregate without specifying a GROUP BY clause. Seems like these template aggregates don't need any sorting or grouping anyway, so we could probably remove those.
EDIT: Proposed fix in this pull request: #1712