You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running H2 in a Mode where numericWithBooleanComparison is set to true (e.g. LEGACY), certain queries where boolean and integers are compared still do not work.
For example, in the following select query
createtabledata (a boolean, b boolean);
select*from data d whered.a=1ord.b=1;
the following exception will be thrown:
org.h2.jdbc.JdbcSQLSyntaxErrorException: Values of types "INTEGER" and "BOOLEAN" are not comparable:
at org.h2.message.DbException.getJdbcSQLException(DbException.java:644) ~[h2-2.2.224.jar:2.2.224]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) ~[h2-2.2.224.jar:2.2.224]
at org.h2.message.DbException.get(DbException.java:223) ~[h2-2.2.224.jar:2.2.224]
at org.h2.value.TypeInfo.checkComparable(TypeInfo.java:766) ~[h2-2.2.224.jar:2.2.224]
at org.h2.expression.condition.ConditionIn.optimize(ConditionIn.java:110) ~[h2-2.2.224.jar:2.2.224]
at org.h2.expression.condition.ConditionAndOrN.optimize(ConditionAndOrN.java:229) ~[h2-2.2.224.jar:2.2.224]
at org.h2.expression.SearchedCase.optimize(SearchedCase.java:46) ~[h2-2.2.224.jar:2.2.224]
at org.h2.expression.ConcatenationOperation.determineType(ConcatenationOperation.java:201) ~[h2-2.2.224.jar:2.2.224]
at org.h2.expression.ConcatenationOperation.optimize(ConcatenationOperation.java:141) ~[h2-2.2.224.jar:2.2.224]
at org.h2.command.query.Select.prepareExpressions(Select.java:1170) ~[h2-2.2.224.jar:2.2.224]
at org.h2.command.query.Query.prepare(Query.java:218) ~[h2-2.2.224.jar:2.2.224]
at org.h2.command.Parser.prepareCommand(Parser.java:489) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.SessionLocal.prepareLocal(SessionLocal.java:639) ~[h2-2.2.224.jar:2.2.224]
at org.h2.engine.SessionLocal.prepareCommand(SessionLocal.java:559) ~[h2-2.2.224.jar:2.2.224]
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1166) ~[h2-2.2.224.jar:2.2.224]
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:93) ~[h2-2.2.224.jar:2.2.224]
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:316) ~[h2-2.2.224.jar:2.2.224]
Version: 2.2.224
Independent from this ticket: I believe numericWithBooleanComparison should also be set to true for Mode=ORACLE
The text was updated successfully, but these errors were encountered:
Good to know. My current workaround was to use d.a != 0 or d.b != 0 because then the optimizaton did not run, but ;OPTIMIZE_OR=FALSE seems to be a better workaround
I can't use standard d.a or d.b because the same query also runs against an actual Oracle database, which does not know booleans
Oracle 23ai supports standard BOOLEAN data type, TRUE and FALSE literals and null-safe boolean test predicate. UNKNOWN isn't supported, but NULL can be used instead.
Older versions of Oracle don't have BOOLEAN data type in SQL, so if you run the same SQL in old version of Oracle and H2, you probably shouldn't use BOOLEAN data type in H2 too.
When running H2 in a Mode where numericWithBooleanComparison is set to true (e.g. LEGACY), certain queries where boolean and integers are compared still do not work.
For example, in the following select query
the following exception will be thrown:
Version: 2.2.224
Independent from this ticket: I believe numericWithBooleanComparison should also be set to true for Mode=ORACLE
The text was updated successfully, but these errors were encountered: