Hi,

When running an update that fails with an unique constraint violation, the 
row that I tried to update "disappears" for the remainder of the 
transaction. I cannot select it using its primary key or using the column 
that gave the constraint violation.

Pseudo-SQL (all run within the same transaction):
CREATE TABLE foo (row_id INTEGER PRIMARY KEY, unique_val INTEGER UNIQUE, 
some_other_val INTEGER);
INSERT INTO foo VALUES (1, 1, 1);
INSERT INTO foo VALUES (2, 2, 2);

-- Gives a constraint violation
UPDATE foo SET unique_val = 1 WHERE row_id = 2;

-- The row that failed to update is no longer found by its old values
SELECT unique_val FROM foo WHERE row_id = 2;
SELECT unique_val FROM foo WHERE unique_val = 2;

-- both SELECTs above fail to find anything...

-- ...but this works
SELECT unique_val FROM foo WHERE some_other_val = 2;

I have a PasteBin with Groovy code in it:

http://pastebin.com/d6sXAcPP

Run it using
[Groovy installation]/bin/groovy [path to script]

I'm using H2 version 1.4.177.

Regards
/Karl

-- 
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