borinquenkid commented on PR #16875:
URL: https://github.com/apache/grails-core/pull/16875#issuecomment-6699745412
@jamesfredley Fixed in 4a94553b4b, on top of de7100cf35, for the negation
(head now 92fcdc8780, which adds the documentation of the connection). `not {
gt('age', <empty subquery>) }` now matches no row, and so do `not { not { ... }
}` and `not { <empty comparison> || x }`; `not { <empty comparison> && x }`
returns the rows where `x` is false, which is what SQL returns. The comparison
is unknown in SQL and so is its negation, so resolving the subqueries now
tracks whether the comparison sits inside an odd number of negations and,
there, replaces it with a criterion that matches every row, so that the
negation matches none.
The MongoDB and Neo4j `AggregateSubquerySpec` have a feature for it: the
`where` form, `not { }`, `not { not { } }`, an `or` and an `and`, with a row
whose age is null, which stays out. It fails without the change on MongoDB. The
upgrade guide and the `where` reference say it.
The connection: `Query` in `grails-datastore-core` has no connection, and
Hibernate 7 runs a subquery inside the same SQL, so there is nothing in this
layer to fix. A subquery runs on the connection of its own criteria, and one
written as `avg(age).of { }` is built by the compiler transform with the
default connection. The two documents now say so and show `withConnection` for
the subquery (92fcdc8780). Making the subquery inherit the connection of the
criteria that holds it belongs in `AbstractDetachedCriteria` and needs a
two-connection spec for each datastore, which does not exist yet, so it is
#16886.
--
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]