I'm trying to migrate from H2 version 1.4.196 to 1.4.200 and I encountered
a strange problem.
We're using H2 for unit tests to mimic MySql. The connection string is "...;
MODE=MYSQL;IGNORECASE=TRUE;IFEXISTS=TRUE;INIT=SET SCHEMA TEST"
When running the following:
CREATE TABLE test_table(column1 VARCHAR(10), update_time TIMESTAMP NOT NULL
DEFAULT CURRENT_TIMESTAMP)
INSERT INTO test_table(column1, update_time) VALUES ('test', null)
I get an exception:
org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed
for column "UPDATE_TIME"; SQL statement:
INSERT INTO test_table(column1, update_time) VALUES ('test', null) [23502-
200]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:459)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:429)
at org.h2.message.DbException.get(DbException.java:205)
at org.h2.message.DbException.get(DbException.java:181)
at org.h2.table.Column.validateConvertUpdateSequence(Column.java:374)
at org.h2.table.Table.validateConvertUpdateSequence(Table.java:845)
at org.h2.command.dml.Insert.insertRows(Insert.java:187)
at org.h2.command.dml.Insert.update(Insert.java:151)
at org.h2.command.CommandContainer.update(CommandContainer.java:198)
at org.h2.command.Command.executeUpdate(Command.java:251)
at org.h2.jdbc.JdbcStatement.executeUpdateInternal(JdbcStatement.java:168)
at org.h2.jdbc.JdbcStatement.executeUpdate(JdbcStatement.java:126)
at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(
DelegatingStatement.java:234)
at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(
DelegatingStatement.java:234)
This works well in both 1.4.196 and on MySql. Is this a regression? Is
there a workaround?
Thanks!
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/7a784d72-95df-4302-a7ca-0cb89ccadf13%40googlegroups.com.