Hi! I don't know is it a bug or feature, please explain.
Identity column is autoincremented, even previous statment completed with 
an error (so I expect ID column value will not incremented).

Example snippet:

drop table TEST_TABLE if exists;

create table TEST_TABLE (
    ID IDENTITY NOT NULL PRIMARY KEY, -- this column value we will observe
    REQ_FIELD VARCHAR2(32) NOT NULL,
    NOT_REQ_FIELD VARCHAR2(32)
);

insert into TEST_TABLE (NOT_REQ_FIELD) values ('foo'); -- this will fail 
because of REQ_FIELD is still NULL - it is expected behavior, but identity 
value incremented inside H2!

insert into TEST_TABLE (REQ_FIELD) values ('test'); -- this will be 
executed fine, but ID value becomes 2 instead of (IMHO) expected 1, see 
select statament below
COMMIT;

select * from TEST_TABLE; -- we see 2 in "ID" column, but expected 1

H2 Database version 1.3.171

java -version:
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Windows 7 Ultimate x64 Russian.

Thanks!

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to