If I remove the foreign key definition (last line in the SQL) the problem 
doesn't present itself.

Of course I can't do this, as I have many databases already created. I'll 
stick with 174 until this is solved.

Il giorno venerdì 9 maggio 2014 15:30:07 UTC+2, Germano Rizzo ha scritto:
>
> Hi,
>    I have a reproducible bug with versions 174 and 176 (at least). A db 
> created with 1.3.174 (no particular settings) corrupts when just opening 
> and closing it in 1.3.176. To reproduce:
>
>
>    1. download this sql (generated by the SCRIPT command from a test db 
>    of mine): https://www.dropbox.com/s/gjng7vfqkpp9fio/SQL.sql
>    2. create a blank db in 1.3.174 and restore the script; close the db
>    3. open the db in 1.3.176, close it;
>    4. reopen the db in 1.3.176. it will crash.
>    
> As said, I don't use any parameter for the JDBC URL. The crash is this:
>
> Exception in thread "main" org.h2.jdbc.JdbcSQLException: Unique index or 
> primary key violation: "PRIMARY KEY ON """".PAGE_INDEX"; SQL statement:
> ALTER TABLE PUBLIC.DETAILS ADD CONSTRAINT PUBLIC.FK_DETAILS FOREIGN 
> KEY(ID) REFERENCES PUBLIC.ENTITIES(ID) NOCHECK [23505-176]
>     at org.h2.message.DbException.getJdbcSQLException(DbException.java:344)
>     at org.h2.message.DbException.get(DbException.java:178)
>     at org.h2.message.DbException.get(DbException.java:154)
>     at 
> org.h2.index.PageDataIndex.getNewDuplicateKeyException(PageDataIndex.java:166)
>     at org.h2.index.PageDataIndex.add(PageDataIndex.java:144)
>     at org.h2.store.PageStore.addMeta(PageStore.java:1808)
>     ...
>
> Here you can find the corrupted db: 
> https://www.dropbox.com/s/e4fj39jaoqwsdom/test.h2.db
>
> You can use SquirrelSQL to test, or use this eclipse project: 
> https://www.dropbox.com/s/ez2lre6t7uf64vc/H2Bug.7z
>
> To use it:
>
>    1. Put only h2-1.3.174.jar in the path
>    2. Launch DBCreate174.java
>    3. Put only h2-1.3.176.jar in the path
>    4. Launch DBTriggerBug176.java
>    5. crash
>    
> Hope this helps. Let me know if I can be of further assistance.
>
>       Germano
>
>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to