nhibernate/nhibernate-core — pull request #77 by gliljas (2012-02-14 23:27:10+00:00)
Title: Nh 2692

NH converts the Any (and All) calls to

WHERE EXISTS (SELECT key FROM .....)

and for component types it falls back to the key name of the containing type, which of course becomes invalid. In fact, choosing any column at all is pointless. A more natural SQL approach is "SELECT *", "SELECT 1" or even "SELECT NULL".

I thought it would be easy to intersect the Any-call and fix a problematic Ident, but the Any is preprocessed be Relinq and turned into a SubQueryExpression. Replacing the Selector of the SelectClause to a constant or a NhStarExpression renders a MismatchedTreeNodeException from the HqlSqlWalker, and that's a scary place to be.