fix 'is distinct from' predicate on HSQL
the semantics of the built-in operator are different to our semantics
This commit is contained in:
parent
1807e1cc43
commit
cb7b364b46
|
@ -242,12 +242,11 @@ public class HSQLSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAs
|
|||
}
|
||||
else {
|
||||
// HSQL does not like parameters in the distinct from predicate
|
||||
render( lhs, SqlAstNodeRenderingMode.NO_PLAIN_PARAMETER );
|
||||
appendSql( operator.sqlText() );
|
||||
render( rhs, SqlAstNodeRenderingMode.NO_PLAIN_PARAMETER );
|
||||
renderComparisonEmulateIntersect( lhs, operator, rhs );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// HSQL has a broken 'is distinct from' operator
|
||||
renderComparisonStandard( lhs, operator, rhs );
|
||||
break;
|
||||
}
|
||||
|
@ -317,4 +316,5 @@ public class HSQLSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAs
|
|||
appendSql( CLOSE_PARENTHESIS );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -121,12 +121,14 @@ public class DistinctFromTest {
|
|||
scope.inSession(session -> {
|
||||
assertEquals(1, session.createSelectionQuery("select 1 where 1 is distinct from 0").getResultList().size());
|
||||
assertEquals(0, session.createSelectionQuery("select 1 where 1 is distinct from 1").getResultList().size());
|
||||
assertEquals(1, session.createSelectionQuery("select 1 where 1 is distinct from null").getResultList().size());
|
||||
assertEquals(1, session.createSelectionQuery("select 1 where null is distinct from 1").getResultList().size());
|
||||
assertEquals(1, session.createSelectionQuery("select 1 where null is distinct from 0").getResultList().size());
|
||||
assertEquals(0, session.createSelectionQuery("select 1 where null is distinct from null").getResultList().size());
|
||||
|
||||
assertEquals(0, session.createSelectionQuery("select 1 where 1 is not distinct from 0").getResultList().size());
|
||||
assertEquals(1, session.createSelectionQuery("select 1 where 1 is not distinct from 1").getResultList().size());
|
||||
assertEquals(0, session.createSelectionQuery("select 1 where 1 is not distinct from null").getResultList().size());
|
||||
assertEquals(0, session.createSelectionQuery("select 1 where null is not distinct from 1").getResultList().size());
|
||||
assertEquals(0, session.createSelectionQuery("select 1 where null is not distinct from 0").getResultList().size());
|
||||
assertEquals(1, session.createSelectionQuery("select 1 where null is not distinct from null").getResultList().size());
|
||||
|
|
Loading…
Reference in New Issue