# Bug report 1750

Begin;
Initialize;
InitializeSession "TESTDB";
Command "create database TESTDB";
Command "create table TBL(f int default 0 not null, g datetime default current_timestamp, h datetime default current_timestamp using on update, i int generated by default as identity ( start with 1 get max))";

Command "create index IDX_f on TBL(f)";
Command "create index IDX_g on TBL(g)";
Command "create index IDX_h on TBL(h)";
Command "create index IDX_i on TBL(i)";

Command "start transaction read write";
Command "insert TBL(f) values (1)";
Command "insert TBL(g) values (TIMESTAMP '1234-02-03 12:34:56')";
Command "insert TBL(h) values (TIMESTAMP '1234-10-09 08:07:06')";
Command "insert TBL(i) values (5)";
Command "insert TBL default values";
Command "commit";
Command "select f,i,case when g < DATE '2000-01-01' then g else '<current>' end,case when h < DATE '2000-01-01' then h when g < DATE '2000-01-01' then '<current>' when h = g then '<current>' else '<updated>' end from TBL";
Command "start transaction read write";
Command "insert TBL(f) values (10)";
Command "insert TBL(g) values (TIMESTAMP '1234-12-13 14:15:16')";
Command "insert TBL(h) values (TIMESTAMP '1234-11-11 11:11:11')";
Command "insert TBL(i) values (50)";
Command "insert TBL default values";
Command "rollback";
Command "select f,i,case when g < DATE '2000-01-01' then g else '<current>' end,case when h < DATE '2000-01-01' then h when g < DATE '2000-01-01' then '<current>' when h = g then '<current>' else '<updated>' end from TBL";
Command "start transaction read write";
Command "update TBL set f = 2 where f = 1";
Command "update TBL set g = TIMESTAMP '1234-10-09 08:07:06' where i between 1 and 2";
Command "update TBL set h = TIMESTAMP '1234-12-13 14:15:16' where i between 3 and 4";
Command "update TBL set i = 15 where i between 5 and 6";
Command "commit";
Command "select f,i,case when g < DATE '2000-01-01' then g else '<current>' end,case when h < DATE '2000-01-01' then h when g < DATE '2000-01-01' then '<current>' when h = g then '<current>' else '<updated>' end from TBL";
Command "start transaction read write";
Command "update TBL set f = 3 where f = 2";
Command "update TBL set g = TIMESTAMP '1234-10-09 08:07:06' where i between 1 and 2";
Command "update TBL set h = TIMESTAMP '1234-12-13 14:15:16' where i between 3 and 4";
Command "update TBL set i = 25 where i = 15";
Command "rollback";
Command "select f,i,case when g < DATE '2000-01-01' then g else '<current>' end,case when h < DATE '2000-01-01' then h when g < DATE '2000-01-01' then '<current>' when h = g then '<current>' else '<updated>' end from TBL";
TerminateSession;

#recovery

End;
