Gmail
unread,Nov 28, 2021, 6:39:39 AM11/28/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to h2-da...@googlegroups.com
Hi,
When executing the script below on 1.4.200 I get the result below :
DBMS : H2 1.4.200 (2019-10-14)
JDBC : H2 JDBC Driver 1.4.200 (2019-10-14)
create table ftypes(
ID IDENTITY primary key ,
types VARCHAR
);
insert into ftypes (id,types) values(1,'R1');
insert into ftypes (id,types) values(2,'R2');
insert into ftypes (id,types) values(3,'R3');
insert into ftypes (id,types) values(default,'R4');
insert into ftypes (id,types) values(null,'R5');
insert into ftypes (types) values('R6');
select * from ftypes;
-------------------------------------------
| ID | TYPES |
-------------------------------------------
| 1 | R1 |
| 2 | R2 |
| 3 | R3 |
| 4 | R4 |
| 5 | R5 |
| 6 | R6 |
-------------------------------------------
But on 2.0.202 I get the following errors:
DBMS : H2 2.0.202 (2021-11-25)
create table ftypes(
ID IDENTITY primary key ,
types VARCHAR
);
insert into ftypes (id,types) values(1,'R1');
insert into ftypes (id,types) values(2,'R2');
insert into ftypes (id,types) values(3,'R3');
insert into ftypes (id,types) values(default,'R4');
Err: java.sql.SQLException: Unique index or primary key violation:
"PRIMARY KEY ON PUBLIC.FTYPES(ID) ( /* key:1 */ CAST(1 AS BIGINT),
'R1')"; SQL statement:
insert into ftypes (id,types) values(default,'R4') [23505-202]
insert into ftypes (id,types) values(null,'R5');
Err: java.sql.SQLException: NULL not allowed for column "ID"; SQL
statement:
insert into ftypes (id,types) values(null,'R5') [23502-202]
insert into ftypes (types) values('R6');
Err: java.sql.SQLException: Unique index or primary key violation:
"PRIMARY KEY ON PUBLIC.FTYPES(ID) ( /* key:2 */ CAST(2 AS BIGINT),
'R2')"; SQL statement:
insert into ftypes (types) values('R6') [23505-202]
select * from ftypes;
-------------------------------------------
| ID | TYPES |
-------------------------------------------
| 1 | R1 |
| 2 | R2 |
| 3 | R3 |
-------------------------------------------
Question : Is there a way to set the behaviour in 2.0.202 the same as
in 1.4.200 ?
Thanks in advance and very good job to all of you
willy