Thanks. It worked when I picked the latest version. I now see Merge throwing the appropriate error I expected.
On Sep 1, 4:53 am, Rami Ojares <[email protected]> wrote: > I ran your statements and they behaved exactly like they should > I am using 1.2.139 > > - rami > > #1: SET SCHEMA TEST > Statement lasted 6 ms > Statement executed SUCCESFULLY. > > #2: create table TestTbl ( > Statement lasted 3 ms > Statement executed SUCCESFULLY. > > #3: insert into Testtbl (col1, col2 , col3 ) values ('1', '2', 33333) > Statement lasted 6 ms > 1 rows UPDATED. > > #4: insert into Testtbl (col1, col2 , col3 ) values (null, '2', 33333) > Statement lasted 1 ms > 1 rows UPDATED. > > #5: insert into Testtbl (col1, col2 , col3 ) values ('1', null, 33333) > Statement lasted 0 ms > 1 rows UPDATED. > > #6: insert into Testtbl (col1, col2 , col3 ) values ('11', '2', 33333) > 1 insert into Testtbl (col1, col2 , col3 ) values ('11', '2', 33333) > Value too long for column "COL1 VARCHAR(1)": "'11' (2)"; SQL statement: > insert into Testtbl (col1, col2 , col3 ) values ('11', '2', 33333) > [90005-134] > > #7: insert into Testtbl (col1, col2 , col3 ) values ('1', '22', 33333) > 1 insert into Testtbl (col1, col2 , col3 ) values ('1', '22', 33333) > Value too long for column "COL2 CHAR(1)": "'22' (2)"; SQL statement: > insert into Testtbl (col1, col2 , col3 ) values ('1', '22', 33333) > [90005-134] > > #8: insert into Testtbl (col1, col2 , col3 ) values ('1', '2', 333333) > Statement lasted 0 ms > 1 rows UPDATED. > > #9: SELECT * FROM TESTTBL > Statement lasted 10 ms > ------------------------------------------------------------------------- > | COL0 : BIGINT | COL1 : VARCHAR | COL2 : CHAR | COL3 : INTEGER | > ------------------------------------------------------------------------- > | 1 | 1 | 2 | 33333 | > ------------------------------------------------------------------------- > | 2 | NULL | 2 | 33333 | > ------------------------------------------------------------------------- > | 3 | 1 | NULL | 33333 | > ------------------------------------------------------------------------- > | 6 | 1 | 2 | 333333 | > ------------------------------------------------------------------------- > > #10: MERGE into Testtbl values (1, '1', '3', 333333) > Statement lasted 6 ms > 1 rows UPDATED. > > #11: MERGE into Testtbl values (2, '11', '4', 333333) > 1 MERGE into Testtbl values (2, '11', '4', 333333) > Value too long for column "COL1 VARCHAR(1)": "'11' (2)"; SQL statement: > MERGE into Testtbl values (2, '11', '4', 333333) [90005-134] > > #12: MERGE into Testtbl values (3, '1', '555', 333333) > 1 MERGE into Testtbl values (3, '1', '555', 333333) > Value too long for column "COL2 CHAR(1)": "'555' (3)"; SQL statement: > MERGE into Testtbl values (3, '1', '555', 333333) [90005-134] > > #13: MERGE into Testtbl values (6, '1', '6', 3333333) > Statement lasted 1 ms > 1 rows UPDATED. > > #14: SELECT * FROM TESTTBL > Statement lasted 1 ms > ------------------------------------------------------------------------- > | COL0 : BIGINT | COL1 : VARCHAR | COL2 : CHAR | COL3 : INTEGER | > ------------------------------------------------------------------------- > | 1 | 1 | 3 | 333333 | > ------------------------------------------------------------------------- > | 2 | NULL | 2 | 33333 | > ------------------------------------------------------------------------- > | 3 | 1 | NULL | 33333 | > ------------------------------------------------------------------------- > | 6 | 1 | 6 | 3333333 | > ------------------------------------------------------------------------- > 31.8.2010 21:48, Sudhir kirjoitti: > > > Noticed that a Merge fails (as in does not apply changes) without > > errors/notification when the data being updated or even inserted > > exceeds the column definition. Following is a test case. I would have > > expected the Merge to either silently truncate (at least in case of > > strings) or throw an error like it does in Inserts. > > > --------------------------------------------------------------------------------------------------------------------------------------------------- > > create table TestTbl ( > > col0 identity, > > col1 varchar(1), > > col2 char(1), > > col3 int > > ) > > > insert into Testtbl (col1, col2 , col3 ) values ('1', '2', 33333); > > insert into Testtbl (col1, col2 , col3 ) values (null, '2', 33333); > > insert into Testtbl (col1, col2 , col3 ) values ('1', null, 33333); > > insert into Testtbl (col1, col2 , col3 ) values ('11', '2', 33333); > > insert into Testtbl (col1, col2 , col3 ) values ('1', '22', 33333); > > insert into Testtbl (col1, col2 , col3 ) values ('1', '2', 333333); > > SELECT * FROM TESTTBL ; > > > --Fails > > MERGE into Testtbl values (1, '1', '3', 333333); > > MERGE into Testtbl values (2, '11', '4', 333333); > > MERGE into Testtbl values (3, '1', '555', 333333); > > --Fails > > MERGE into Testtbl values (6, '1', '6', 3333333); > > > SELECT * FROM TESTTBL -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
