Hello all, I have a problem with H2. I'm using H2 version 1.2.139. I have a database with an only table (named JBOSSTSTXTABLE) with the following structure:
- column STATETYPE INTEGER(10) NOT NULL - column TYPENAME VARCHAR(1024) NOT NULL - column UIDSTRING VARCHAR(255) NOT NULL, - column OBJECTSTATE VARBINARY(2147483647) - an only index, of type PRIMARY KEY, on UIDSTRING, STATETYPE, TYPENAME I'm accessing this database in PostgreSQL compatibility mode. What I'm seeing is the following message: org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "PRIMARY_KEY_E ON PUBLIC.JBOSSTSTXTABLE(UIDSTRING, STATETYPE)"; SQL statement: INSERT INTO JBossTSTxTable (StateType,TypeName,UidString,ObjectState) VALUES (?,?,?,?) [23001-139] As you can see, the exception message says that a primary key constraint violation has occurred on columns UIDSTRING, STATETYPE. However I'm sure the primary key is set on (UIDSTRING, STATETYPE, TYPENAME): I can see this through the H2 console. Moreover, I know which is the SQL statement used to create the table: CREATE TABLE JBOSSTSTXTABLE (StateType INTEGER, TypeName VARCHAR(1024), UidString VARCHAR(255), ObjectState bytea, PRIMARY KEY(UidString, StateType, TypeName)) However, I don't know the exact insert statement that causes the error, because it's not under my control (it's generated by a Java library and I can't debug it). What could be the cause of this problem? Could this be a problem bound to the use of the PostgreSQL compatibility mode? May it be a bug fixed in H2 > 1.2.139? I looked at the changelog but I couldn't find any suspicious entry. The parameters I'm using to connect to my database are: DB_CLOSE_ON_EXIT=TRUE;AUTO_SERVER=TRUE;AUTO_RECONNECT=FALSE;MODE=PostgreSQL Any help would be greatly appreciated. Thanks in advance, Mauro. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
