yarmol / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

org.h2.jdbc.JdbcSQLException: Unable to create or alter sequence on Version 1.3.175 #543

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After upgrade from Version 1.3.174 to Version 1.3.175 i get the error:

2014-01-24 00:10:09,240 INFO  - Config Database Manager        - 
confdb:database opening /disks/lars1/diskpool01/db/confdb/confdb (build 175)
2014-01-24 00:10:09,349 ERROR - Config Database Manager        - 
confdb:database CREATE SEQUENCE 
CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4 START WITH 0 
INCREMENT BY -1 BELONGS_TO_TABLE
org.h2.jdbc.JdbcSQLException: Unable to create or alter sequence 
"SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4" because of invalid 
attributes (start value "0", min value "-9223372036854775808", max value "-1", 
increment "-1"); $
CREATE SEQUENCE CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4 
START WITH 0 INCREMENT BY -1 BELONGS_TO_TABLE [90009-175]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
        at org.h2.message.DbException.get(DbException.java:172)
        at org.h2.schema.Sequence.<init>(Sequence.java:77)
        at org.h2.command.ddl.CreateSequence.update(CreateSequence.java:66)
        at org.h2.engine.MetaRecord.execute(MetaRecord.java:58)
        at org.h2.engine.Database.open(Database.java:686)
        at org.h2.engine.Database.openDatabase(Database.java:244)
        at org.h2.engine.Database.<init>(Database.java:239)
        at org.h2.engine.Engine.openSession(Engine.java:56)
        at org.h2.engine.Engine.openSession(Engine.java:160)
        at org.h2.engine.Engine.createSessionAndValidate(Engine.java:139)
        at org.h2.engine.Engine.createSession(Engine.java:122)
        at org.h2.engine.Engine.createSession(Engine.java:28)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:323)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:105)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)
        at org.h2.Driver.connect(Driver.java:73)
        at java.sql.DriverManager.getConnection(DriverManager.java:579)
        at java.sql.DriverManager.getConnection(DriverManager.java:221)
        at ch.nextstride.core.thread.H2DataBaseServer.run(H2DataBaseServer.java:149)
        at ch.nextstride.core.thread.DatabaseManager.runImpl(DatabaseManager.java:282)
        at ch.nextstride.tools.thread.NsThread.run(NsThread.java:85)
2014-01-24 00:10:09,352 ERROR - Config Database Manager        - JCT2128E 
H2DataBaseServer run() Cannot get connection for DB using 
url:jdbc:h2:file:confdb;DB_CLOSE_ON_EXIT=FALSE;CACHE_SIZE=64000;TRACE_LEVEL_FILE
=4, Error: org.h2.jdbc.$
CREATE SEQUENCE CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4 
START WITH 0 INCREMENT BY -1 BELONGS_TO_TABLE [90009-175]
org.h2.jdbc.JdbcSQLException: Unable to create or alter sequence 
"SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4" because of invalid 
attributes (start value "0", min value "-9223372036854775808", max value "-1", 
increment "-1"); $
CREATE SEQUENCE CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4 
START WITH 0 INCREMENT BY -1 BELONGS_TO_TABLE [90009-175]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
        at org.h2.message.DbException.get(DbException.java:172)
        at org.h2.schema.Sequence.<init>(Sequence.java:77)
        at org.h2.command.ddl.CreateSequence.update(CreateSequence.java:66)
        at org.h2.engine.MetaRecord.execute(MetaRecord.java:58)
        at org.h2.engine.Database.open(Database.java:686)
        at org.h2.engine.Database.openDatabase(Database.java:244)
        at org.h2.engine.Database.<init>(Database.java:239)
        at org.h2.engine.Engine.openSession(Engine.java:56)
        at org.h2.engine.Engine.openSession(Engine.java:160)
        at org.h2.engine.Engine.createSessionAndValidate(Engine.java:139)
        at org.h2.engine.Engine.createSession(Engine.java:122)
        at org.h2.engine.Engine.createSession(Engine.java:28)
        at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:323)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:105)
        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)
        at org.h2.Driver.connect(Driver.java:73)
        at java.sql.DriverManager.getConnection(DriverManager.java:579)
        at java.sql.DriverManager.getConnection(DriverManager.java:221)
        at ch.nextstride.core.thread.H2DataBaseServer.run(H2DataBaseServer.java:149)
        at ch.nextstride.core.thread.DatabaseManager.runImpl(DatabaseManager.java:282)
        at ch.nextstride.tools.thread.NsThread.run(NsThread.java:85)

After going back to verion 1.3.174 the error is gone.

2014-01-24 00:22:03,485 INFO  - Config Database Manager        - 
confdb:database opening /disks/lars1/diskpool01/db/confdb/confdb (build 174)
2014-01-24 00:22:03,672 INFO  - Config Database Manager        - 
confdb:database opened /disks/lars1/diskpool01/db/confdb/confdb
2014-01-24 00:22:03,672 INFO  - Config Database Manager        - 
confdb:database connecting session #3 to 
/disks/lars1/diskpool01/db/confdb/confdb
2014-01-24 00:22:03,673 INFO  - Config Database Manager        - confdb:jdbc[3]
/*SQL */SET CACHE_SIZE 64000;
2014-01-24 00:22:03,673 INFO  - Config Database Manager        - confdb:jdbc[3]
/*SQL */SET TRACE_LEVEL_FILE 4;
2014-01-24 00:22:03,673 INFO  - Config Database Manager        - confdb:jdbc[3]
/**/Connection conn11 = 
DriverManager.getConnection("jdbc:h2:file:confdb;DB_CLOSE_ON_EXIT=FALSE;CACHE_SI
ZE=64000;TRACE_LEVEL_FILE=4", "CONFDB", "");
2014-01-24 00:22:04,674 INFO  - Config Database Manager        - JCT2133I 
DataBaseServerAbstract connectionCheckDB() Checking DB connection. 
URL:jdbc:h2:file:confdb;DB_CLOSE_ON_EXIT=FALSE;CACHE_SIZE=64000;TRACE_LEVEL_FILE
=4
2014-01-24 00:22:04,674 INFO  - Config Database Manager        - 
confdb:database connecting session #4 to 
/disks/lars1/diskpool01/db/confdb/confdb
2014-01-24 00:22:04,674 INFO  - Config Database Manager        - confdb:jdbc[4]
/*SQL */SET CACHE_SIZE 64000;
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - confdb:jdbc[4]
/*SQL */SET TRACE_LEVEL_FILE 4;
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - confdb:jdbc[4]
/**/Connection conn12 = 
DriverManager.getConnection("jdbc:h2:file:confdb;DB_CLOSE_ON_EXIT=FALSE;CACHE_SI
ZE=64000;TRACE_LEVEL_FILE=4", "CONFDB", "");
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - JCT2134I 
DataBaseServerAbstract connectionCheckDB() Database connection is OK! 
URL:jdbc:h2:file:confdb;DB_CLOSE_ON_EXIT=FALSE;CACHE_SIZE=64000;TRACE_LEVEL_FILE
=4
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - JCT2135I 
DataBaseServerAbstract connectionCheckDB() Using database: H2
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - JCT2136I 
DataBaseServerAbstract connectionCheckDB() Database version: 1.3.174 
(2013-10-19)
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - JCT2137I 
DataBaseServerAbstract connectionCheckDB() Database URL: jdbc:h2:file:confdb
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - JCT2138I 
DataBaseServerAbstract connectionCheckDB() Database JDBC DriverName: H2 JDBC 
Driver
2014-01-24 00:22:04,675 INFO  - Config Database Manager        - JCT2139I 
DataBaseServerAbstract connectionCheckDB() Database JDBC DriverVersion: 1.3.174 
(2013-10-19)
2014-01-24 00:22:04,676 INFO  - Config Database Manager        - 
confdb:database disconnecting session #4
2014-01-24 00:22:04,676 INFO  - Config Database Manager        - 
confdb:database disconnected session #4
2014-01-24 00:22:04,676 INFO  - Config Database Manager        - JCT2128I 
H2DataBaseServer run() The H2 database has successfully been started!

Original issue reported on code.google.com by fly...@gmail.com on 23 Jan 2014 at 11:50

Attachments:

GoogleCodeExporter commented 9 years ago
Here are the DDL from the problem table

CREATE SEQUENCE CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4 
START WITH 0 INCREMENT BY -1 BELONGS_TO_TABLE;
CREATE CACHED TABLE CONFDB.CONF__FAST_PARSER_BASE(
    DEVICE_GROUP VARCHAR(255) NOT NULL,
    PARSER_FIELD_ID BIGINT DEFAULT (NEXT VALUE FOR CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4) NOT NULL NULL_TO_DEFAULT SEQUENCE CONFDB.SYSTEM_SEQUENCE_FF1E3DAF_3365_4896_9FA6_3CFE334F16E4,
    FIELD_ID INT NOT NULL,
    PARSER_ID INT NOT NULL,
    PARSER_VERSION INT NOT NULL,
    SOURCE_FIELD_ID INT NOT NULL,
    DEPEND_FIELD_ID VARCHAR(1024) COMMENT '(CSV) Comma separated list of field ids',
    PARSER_FIELD_SEQ INT NOT NULL,
    PARSER_FIELD_PARM VARCHAR(1024) NOT NULL,
    PARSER_CODE_ID INT NOT NULL,
    PARSER_CODE_VERSION INT NOT NULL,
    PARSER_CODE_PARM VARCHAR(1024),
    MASKING_CODE_ID INT,
    MASKING_CODE_VERSION INT,
    MASKING_CODE_PARM VARCHAR(1024),
    VALIDATION_CODE_ID INT,
    VALIDATION_CODE_VERSION INT,
    VALIDATION_CODE_PARM VARCHAR(1024),
    ON_ERROR_ACTION VARCHAR(255),
    ACTIVE INT NOT NULL,
    DESCRIPTION VARCHAR(1024),
    UPDATE_USER VARCHAR(255),
    UPDATE_TS BIGINT
);
ALTER TABLE CONFDB.CONF__FAST_PARSER_BASE ADD CONSTRAINT CONFDB.CONSTRAINT_C6 
PRIMARY KEY(PARSER_FIELD_ID);
-- 0 +/- SELECT COUNT(*) FROM CONFDB.CONF__FAST_PARSER_BASE;

Original comment by fly...@gmail.com on 23 Jan 2014 at 11:58

GoogleCodeExporter commented 9 years ago
This is fixed in SVN with revision r5425

Original comment by noelgrandin on 24 Jan 2014 at 1:50