borinquenkid opened a new pull request, #16835:
URL: https://github.com/apache/grails-core/pull/16835
Fixes #16807
`@Where({ amount > avg(amount) })` in a data service generated `select
avg(amount) from t where amount > (select amount from t)`, which the database
rejects ('Scalar subquery contains more than one row').
`DetachedCriteriaTransformer` translated the aggregate into a bare closure;
inside a service the enclosing criteria resolved its `projections` call, so the
aggregate landed on the outer query and the subquery lost it.
The aggregate is now built as an explicit `new DetachedCriteria(X).build {
projections { ... } }`, the way the `.of { }` form already was. The `property`
projection form that feeds the `gtAll` family is unchanged.
- `WhereServiceAggregateScenarioSpec` runs `>`, `>=`, `<`, `<=`, `== max`,
`== min` and a combination with a method argument on both the H5 and H7 example
apps. All 7 fail on H7 without the change.
- Verified: datamapping-core 1813, H5 core 1167, H7 core 4470 tests and both
integration suites pass. Mongo, Neo4j and graphql are left to CI.
The issue was marked for Grails 9 on the assumption that it depends on the
classic domain binder. It does not: the fix is in the shared AST transformer in
grails-datamapping-core. Stacked on #16825.
https://claude.ai/code/session_01Dmki4SQGwRSj8pRJ5KCWyX
--
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]