# 障害票0742
# 四則演算、集合関数のNullのテスト

Begin;

SetSystemParameter "Execution_OverflowNull" "false";

Initialize;
InitializeSession "TESTDB";

# int
#
Command "create database TESTDB";

Command "create table T1(C1 int, C2 int, C3 int, C4 int, C5 int, C6 int, C7 int)";
Command "create index I1 on T1(C1)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (48752, 56874, 6453, 75415326, 3554625, null)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (4852, 527, 612, 729, 5, null)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (444, 55555555, 6666, 777777, 88888888, null)";
Command "select * from T1";
Command "select AVG(C1), AVG(C2), AVG(C3), AVG(C4), AVG(C5), AVG(C6) from T1";
Command "select SUM(C1), SUM(C2), SUM(C3), SUM(C4), SUM(C5), AVG(C6) from T1";
Command "select MAX(C1), MAX(C2), MAX(C3), MAX(C4), MAX(C5), MAX(C6) from T1";
Command "select MIN(C1), MIN(C2), MIN(C3), MIN(C4), MIN(C5), MIN(C6) from T1";
Command "select C1, C3 , (C1 + C3) from T1";
Command "select C2, C3 , (C2 - C3) from T1";
Command "select C1, C3 , (C1 * C3) from T1";
Command "select C2, C5 , (C2 / C5) from T1";

# null
Command "select C1, C6 , (C1 + C6) from T1";
Command "select C1, C6 , (C1 - C6) from T1";
Command "select C1, C6 , (C1 * C6) from T1";
Command "select C1, C6 , (C1 / C6) from T1";
Command "select count(*) FROM T1";
Command "select count(C1) FROM T1";
Command "select count(C7) FROM T1";
Command "select * from T1";

Command "drop table T1";


# bigint
#
Command "create table T1(C1 bigint, C2 bigint, C3 bigint, C4 bigint, C5 bigint, C6 bigint, C7 bigint)";
Command "create index I1 on T1(C1)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (847865160, 767589432, 639365455, 547845123, 421546872, null)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (123456789, 123456789, 123456789, 123456789, 123456789, null)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (888888888, 777777777, 666666666, 555555555, 444444444, null)";
Command "select * from T1";
Command "select AVG(C1), AVG(C2), AVG(C3), AVG(C4), AVG(C5), AVG(C6) from T1";
Command "select SUM(C1), SUM(C2), SUM(C3), SUM(C4), SUM(C5), AVG(C6) from T1";
Command "select MAX(C1), MAX(C2), MAX(C3), MAX(C4), MAX(C5), MAX(C6) from T1";
Command "select MIN(C1), MIN(C2), MIN(C3), MIN(C4), MIN(C5), MIN(C6) from T1";
Command "select C1, C3 , (C1 + C3) from T1";
Command "select C2, C3 , (C2 - C3) from T1";
Command "select C1, C3 , (C1 * C3) from T1";
Command "select C2, C5 , (C2 / C5) from T1";

# null
Command "select C1, C6 , (C1 + C6) from T1";
Command "select C1, C6 , (C1 - C6) from T1";
Command "select C1, C6 , (C1 * C6) from T1";
Command "select C1, C6 , (C1 / C6) from T1";
Command "select count(*) FROM T1";
Command "select count(C1) FROM T1";
Command "select count(C6) FROM T1";
Command "select count(C7) FROM T1";

Command "drop table T1";


# float
#
Command "create table T1(C1 float, C2 float, C3 float, C4 float, C5 float, C6 float, C7 float)";
Command "create index I1 on T1(C1)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (3.141592, 2.718281, 1.414213, 4.351257, 5.132648, null)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (3.475621, 2.156378, 1.568723, 4.125676, 5.451327, null)";
Command "insert into T1 (C1, C2, C3, C4, C5, C6) values (3.121354, 2.485766, 1.236759, 4.721534, 5.457868, null)";
Command "select * from T1";
Command "select AVG(C1), AVG(C2), AVG(C3), AVG(C4), AVG(C5), AVG(C6) from T1";
Command "select SUM(C1), SUM(C2), SUM(C3), SUM(C4), SUM(C5), AVG(C6) from T1";
Command "select MAX(C1), MAX(C2), MAX(C3), MAX(C4), MAX(C5), MAX(C6) from T1";
Command "select MIN(C1), MIN(C2), MIN(C3), MIN(C4), MIN(C5), MIN(C6) from T1";
Command "select C1, C3 , (C1 + C3) from T1";
Command "select C2, C3 , (C2 - C3) from T1";
Command "select C1, C3 , (C1 * C3) from T1";
Command "select C2, C5 , (C2 / C5) from T1";

# null
Command "select C1, C6 , (C1 + C6) from T1";
Command "select C1, C6 , (C1 - C6) from T1";
Command "select C1, C6 , (C1 * C6) from T1";
Command "select C1, C6 , (C1 / C6) from T1";
Command "select count(*) FROM T1";
Command "select count(C1) FROM T1";
Command "select count(C6) FROM T1";
Command "select count(C7) FROM T1";

Command "drop table T1";

TerminateSession;
# DBの後始末
InitializeSession "";
Command "drop database TESTDB";
TerminateSession;
Terminate;
End;