leinn32 / h2database

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

Unique index or primary key violation when using batch updates #452

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When inserting data into a table, which has constraints from unique 
multi-column index, H2 throws an error message.

Workaround:
a) DROP the INDEX
b) BATCH insert the data
c) CREATE the INDEX

Reproducde:
Please see the attached sample.

Original issue reported on code.google.com by andreas....@gmail.com on 22 Mar 2013 at 3:37

GoogleCodeExporter commented 9 years ago
Sample to reproduce the error.

Original comment by andreas....@gmail.com on 22 Mar 2013 at 3:38

Attachments:

GoogleCodeExporter commented 9 years ago
Tested with h2-1.3.169.jar and h2-1.3.171.jar in SERVER mode.

Original comment by andreas....@gmail.com on 22 Mar 2013 at 4:01

GoogleCodeExporter commented 9 years ago
This is working fine for me with 1.3.171.
Are you sure you actually updated when you ran the test?

Original comment by noelgrandin on 2 Apr 2013 at 7:52

GoogleCodeExporter commented 9 years ago
noelgrandin wrote: "Are you sure you actually updated when you ran the test?"

Updated what exactly? For batches there is no "UPDATE", only the 
executeBatch()-method as shown in the code. Also please note I can create the 
index after executeBatch() and the data are n the table so I think the code is 
right.

Original comment by andreas....@gmail.com on 7 Apr 2013 at 6:15

GoogleCodeExporter commented 9 years ago
Updated to the latest version of h2.
Because I can run your test case and it works fine for me.

Original comment by noelgrandin on 7 Apr 2013 at 6:18

GoogleCodeExporter commented 9 years ago
Mh, strange. I retried now bymyself with any combination of 169 and 171 on 
server and client and indeed it works flawless now. I can not reproduce the 
error message as shown above.

Sorry about that, please close the report.

Original comment by andreas....@gmail.com on 7 Apr 2013 at 6:42

GoogleCodeExporter commented 9 years ago
No problem. Thanks for checking.

Original comment by noelgrandin on 7 Apr 2013 at 8:08

GoogleCodeExporter commented 9 years ago

Original comment by noelgrandin on 7 Apr 2013 at 11:56