Conditionals in Select are too permissive
Description
Environment
None
Activity
Show:
Alex ZaytsevMay 1, 2017 at 3:42 AM
Closing issues resolved in 4.1.0
Alex ZaytsevAugust 12, 2015 at 11:48 PM
@Duncan Munro thanks! I have some minor comment on the pull request.
Duncan MunroAugust 12, 2015 at 10:05 PM
Alex ZaytsevAugust 12, 2015 at 5:37 AM
@Duncan Munro you can check the grammar.
Duncan MunroAugust 11, 2015 at 11:08 PM
Other than looking in HqlIdent, is there some way to tell that a type can be an Ident node?
Fixed
Details
Details
Assignee
Alex Zaytsev
Alex ZaytsevReporter
Duncan Munro
Duncan MunroComponents
Fix versions
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created August 11, 2015 at 7:00 PM
Updated May 1, 2017 at 3:42 AM
Resolved September 4, 2015 at 9:42 AM
Who's Looking?
The fix for NH-3801: AddJoinsReWriter disassociates Select expressions and GroupBy key expressionsClosed included allowing case statements in Select clauses to directly generate HQL. However, this solution is too permissive.
The HQL generator for conditional statements wraps the case statement in a cast.
So if the type of the conditional statement is not something that
NHibernate.Hql.Ast.HqlIdent
can handle, the expression fails.This could be corrected by either limiting conditional handling in the select statement to Ident types only (is there a known list, or helper to check somewhere?), or (possibly) skipping the unnecessary cast in the HQL tree.
This also seems to be related to NH-3005: NHibernate.Hql.Ast.HqlIdent..ctor throws Don't currently support idents of type DateResolved