Hi,

Looks like I've discovered bug in H2 ver.1.3.170. Just use the following 
example to reproduce it:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class TestSimple {
    public static void main(String... args) throws Exception {
        org.h2.Driver.load();
        Connection conn = DriverManager.getConnection("jdbc:h2:mem:test", 
"sa", "");
        Statement stat = conn.createStatement();
        stat.execute("CREATE MEMORY TABLE IF NOT EXISTS TBL(long_field 
BIGINT) NOT PERSISTENT");
        stat.execute("INSERT INTO TBL (long_field) VALUES 
(3718087583405574161)");
        ResultSet rs = stat.executeQuery("SELECT long_field FROM TBL WHERE 
long_field IN (6277, 4174)");
        rs.next();
        Object o = rs.getObject(1);
        System.out.println(o.getClass().getName());
        conn.close();
    }
}

I'm getting the following error:

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Numeric value out 
of range: "3718087583405574161"; SQL statement:
SELECT long_field FROM TBL WHERE long_field IN (6277, 4174) [22003-170]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:169)
at org.h2.message.DbException.get(DbException.java:146)
at org.h2.value.Value.convertToInt(Value.java:945)
at org.h2.value.Value.convertTo(Value.java:581)
at 
org.h2.expression.ConditionInConstantSet.getValue(ConditionInConstantSet.java:58)
at org.h2.expression.Expression.getBooleanValue(Expression.java:180)
at org.h2.command.dml.Select.queryFlat(Select.java:515)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:618)
at org.h2.command.dml.Query.query(Query.java:307)
at org.h2.command.dml.Query.query(Query.java:277)
at org.h2.command.dml.Query.query(Query.java:36)
at org.h2.command.CommandContainer.query(CommandContainer.java:86)
at org.h2.command.Command.executeQuery(Command.java:191)
at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:76)

I would appreciate if you suggest some workaround to avoid this problem.

Thanks,
Victor

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to