akarshan2701 / h2database

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

MVCC: primary key violation with MERGE #117

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am using H2 (compiled from SVN on Sep. 7th). My application is using
MERGE to INSERT/UPDATE rows in a table. 

As MERGE is the only DML statement used to change rows, the following error
is somewhat surprising:

---
SQL error: Unique index or primary key violation: PRIMARY_KEY_3 ON
PUBLIC.COINS(SN)

---

As the VALUES clause of above statement contains data for 1 row, the
expected behaviour is that a PK violation cannot occur. Currently, my
assumption is that this might be caused by a bug in the MVCC code,

Original issue reported on code.google.com by mb555...@gmail.com on 9 Sep 2009 at 2:07

GoogleCodeExporter commented 8 years ago
Could you post a simple, standalone test case that reproduces the problem? It 
would
be great if the test case does not have any dependencies except the H2 jar file 
(that
is, a simple SQL script that can be run in the H2 Console, or a Java class uses 
the
JDBC API and is run using a static main method). Please include any 
initialization
code (CREATE TABLE, INSERT and so on) in the Java class or in a .sql script 
file.

Original comment by thomas.t...@gmail.com on 11 Sep 2009 at 6:00

GoogleCodeExporter commented 8 years ago
Here's a jUnit test that reproduces the problem on my system.

Original comment by mb555...@gmail.com on 14 Sep 2009 at 10:13

GoogleCodeExporter commented 8 years ago
Thanks a lot for the test case! I can reproduce this problem,
I hope I can fix it in the next days, but I'm not sure yet.

Original comment by thomas.t...@gmail.com on 18 Sep 2009 at 6:53

GoogleCodeExporter commented 8 years ago
Solving this problem turned out to be harder than I expected... I'm still 
working on it.

Original comment by thomas.t...@gmail.com on 29 Oct 2009 at 8:32

GoogleCodeExporter commented 8 years ago
I think I found a solution. I committed it to the trunk.
It will be available in the next release.

Original comment by thomas.t...@gmail.com on 8 Nov 2009 at 5:29

GoogleCodeExporter commented 8 years ago
This should now work in version 1.2.124.

Original comment by thomas.t...@gmail.com on 20 Nov 2009 at 4:54