Changeset: 2e5a531609c7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e5a531609c7 Modified Files: sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.sql sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.err sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.out Branch: typing Log Message:
Approved output diffs (193 lines): diff --git a/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.sql b/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.sql --- a/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.sql +++ b/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.sql @@ -26,10 +26,30 @@ SELECT INTERVAL '5' SECOND * cast(1.0 as SELECT cast(2.56 as double) * INTERVAL '5' MONTH; -- 13 SELECT cast(3.1 as real) * INTERVAL '3' SECOND; -- 9.300 -SELECT INTERVAL '1' MONTH / cast(2.0 as double); -- 0 -SELECT INTERVAL '1' MONTH / cast(1.5 as double); -- 0 +SELECT INTERVAL '1' MONTH / cast(2.0 as double); -- 1 +SELECT INTERVAL '1' MONTH / cast(1.5 as double); -- 1 SELECT INTERVAL '1' MONTH / cast(1.0 as double); -- 1 +SELECT INTERVAL '-10' MONTH / cast(2.0 as real); -- -5 +SELECT INTERVAL '7' MONTH / cast(1.5 as real); -- 5 +SELECT INTERVAL '9' YEAR / cast(1.0 as real); -- 108 + SELECT INTERVAL '1' SECOND / cast(2.0 as double); -- 0.500 SELECT INTERVAL '5' SECOND / cast(1.5 as double); -- 3.330 SELECT INTERVAL '5' SECOND / cast(1.0 as double); -- 5.000 + +SELECT INTERVAL '-100' DAY / cast(23.34 as real); -- -370179.936 +SELECT INTERVAL '32' MINUTE / cast(45.5677 as real); -- 42.135 +SELECT INTERVAL '67' MINUTE / cast(1.57 as real); -- 2560.510 + +SELECT INTERVAL '-10.34' SECOND / cast(-1.8 as real); -- 5.744 +SELECT INTERVAL '-10.34' SECOND / -1.8; -- 5.740 + +SELECT INTERVAL '42' DAY / cast(0 as real); -- division by zero +SELECT INTERVAL '-6' YEAR / 0.0; -- division by zero + +SELECT x, y, x * y from (values(interval '0' month),(interval '-3' month),(interval '6' month)) as x(x), (values(1.1),(3.4),(-7)) as y(y); +SELECT x, y, x / y from (values(interval '0' second),(interval '-56' day),(interval '67' minute)) as x(x), (values(1.1),(3.4),(-7)) as y(y); + +SELECT x, y, x * y from (values(interval '0' month),(interval '-3' month),(interval '6' month)) as x(x), (values(cast(1.1 as double)),(cast(3.4 as real)),(cast(-7 as double))) as y(y); +SELECT x, y, x / y from (values(interval '0' second),(interval '-56' day),(interval '67' minute)) as x(x), (values(cast(1.1 as double)),(cast(3.4 as real)),(cast(-7 as double))) as y(y); diff --git a/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.err b/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.err --- a/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.err +++ b/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.err @@ -17,6 +17,14 @@ MAPI = (monetdb) /var/tmp/mtest-37742/. QUERY = SELECT 1 / INTERVAL '2' MONTH; --error on typing branch, cannot divide an integer by an interval ERROR = !SELECT: no such binary operator 'sql_div(smallint,month_interval)' CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-42027/.s.monetdb.32199 +QUERY = SELECT INTERVAL '42' DAY / cast(0 as real); -- division by zero +ERROR = !division by zero. +CODE = 22012 +MAPI = (monetdb) /var/tmp/mtest-42027/.s.monetdb.32199 +QUERY = SELECT INTERVAL '-6' YEAR / 0.0; -- division by zero +ERROR = !division by zero. +CODE = 22012 # 12:56:20 > # 12:56:20 > "Done." diff --git a/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.out b/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.out --- a/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.out +++ b/sql/test/BugTracker-2020/Tests/interval-math.Bug-6935.stable.out @@ -131,6 +131,42 @@ stdout of test 'interval-math.Bug-6935` % sec_interval # type % 5 # length [ 9.300 ] +#SELECT INTERVAL '1' MONTH / cast(2.0 as double); -- 1 +% .%2 # table_name +% %2 # name +% month_interval # type +% 1 # length +[ 1 ] +#SELECT INTERVAL '1' MONTH / cast(1.5 as double); -- 1 +% .%2 # table_name +% %2 # name +% month_interval # type +% 1 # length +[ 1 ] +#SELECT INTERVAL '1' MONTH / cast(1.0 as double); -- 1 +% .%2 # table_name +% %2 # name +% month_interval # type +% 1 # length +[ 1 ] +#SELECT INTERVAL '-10' MONTH / cast(2.0 as real); -- -5 +% .%2 # table_name +% %2 # name +% month_interval # type +% 2 # length +[ -5 ] +#SELECT INTERVAL '7' MONTH / cast(1.5 as real); -- 5 +% .%2 # table_name +% %2 # name +% month_interval # type +% 1 # length +[ 5 ] +#SELECT INTERVAL '9' YEAR / cast(1.0 as real); -- 108 +% .%2 # table_name +% %2 # name +% month_interval # type +% 3 # length +[ 108 ] #SELECT INTERVAL '1' SECOND / cast(2.0 as double); -- 0.500 % .%2 # table_name % %2 # name @@ -149,6 +185,92 @@ stdout of test 'interval-math.Bug-6935` % sec_interval # type % 5 # length [ 5.000 ] +#SELECT INTERVAL '-100' DAY / cast(23.34 as real); -- -370179.936 +% .%2 # table_name +% %2 # name +% day_interval # type +% 11 # length +[ -370179.936 ] +#SELECT INTERVAL '32' MINUTE / cast(45.5677 as real); -- 42.135 +% .%2 # table_name +% %2 # name +% sec_interval # type +% 6 # length +[ 42.135 ] +#SELECT INTERVAL '67' MINUTE / cast(1.57 as real); -- 2560.510 +% .%2 # table_name +% %2 # name +% sec_interval # type +% 8 # length +[ 2560.510 ] +#SELECT INTERVAL '-10.34' SECOND / cast(-1.8 as real); --5.744 +% .%3 # table_name +% %3 # name +% sec_interval # type +% 5 # length +[ 5.744 ] +#SELECT INTERVAL '-10.34' SECOND / -1.8; --5.740 +% .%2 # table_name +% %2 # name +% sec_interval # type +% 5 # length +[ 5.740 ] +#SELECT x, y, x * y from (values(interval '0' month),(interval '-3' month),(interval '6' month)) as x(x), (values(1.1),(3.4),(-7)) as y(y); +% .x, .y, .%11 # table_name +% x, y, %11 # name +% month_interval, decimal, month_interval # type +% 2, 4, 3 # length +[ 0, 1.1, 0 ] +[ 0, 3.4, 0 ] +[ 0, -7.0, 0 ] +[ -3, 1.1, -3 ] +[ -3, 3.4, -10 ] +[ -3, -7.0, 21 ] +[ 6, 1.1, 7 ] +[ 6, 3.4, 20 ] +[ 6, -7.0, -42 ] +#SELECT x, y, x / y from (values(interval '0' second),(interval '-56' day),(interval '67' minute)) as x(x), (values(1.1),(3.4),(-7)) as y(y); +% .x, .y, .%11 # table_name +% x, y, %11 # name +% sec_interval, decimal, sec_interval # type +% 12, 4, 12 # length +[ 0.000, 1.1, 0.000 ] +[ 0.000, 3.4, 0.000 ] +[ 0.000, -7.0, 0.000 ] +[ -4838400.000, 1.1, -4398545.450 ] +[ -4838400.000, 3.4, -1423058.820 ] +[ -4838400.000, -7.0, 691200.000 ] +[ 4020.000, 1.1, 3654.540 ] +[ 4020.000, 3.4, 1182.350 ] +[ 4020.000, -7.0, -574.280 ] +#SELECT x, y, x * y from (values(interval '0' month),(interval '-3' month),(interval '6' month)) as x(x), (values(cast(1.1 as double)),(cast(3.4 as real)),(cast(-7 as double))) as y(y); +% .x, .y, .%12 # table_name +% x, y, %12 # name +% month_interval, double, month_interval # type +% 2, 24, 3 # length +[ 0, 1.1, 0 ] +[ 0, 3.400000095, 0 ] +[ 0, -7, 0 ] +[ -3, 1.1, -3 ] +[ -3, 3.400000095, -10 ] +[ -3, -7, 21 ] +[ 6, 1.1, 7 ] +[ 6, 3.400000095, 20 ] +[ 6, -7, -42 ] +#SELECT x, y, x / y from (values(interval '0' second),(interval '-56' day),(interval '67' minute)) as x(x), (values(cast(1.1 as double)),(cast(3.4 as real)),(cast(-7 as double))) as y(y); +% .x, .y, .%12 # table_name +% x, y, %12 # name +% sec_interval, double, sec_interval # type +% 12, 24, 12 # length +[ 0.000, 1.1, 0.000 ] +[ 0.000, 3.400000095, 0.000 ] +[ 0.000, -7, 0.000 ] +[ -4838400.000, 1.1, -4398545.455 ] +[ -4838400.000, 3.400000095, -1423058.784 ] +[ -4838400.000, -7, 691200.000 ] +[ 4020.000, 1.1, 3654.545 ] +[ 4020.000, 3.400000095, 1182.353 ] +[ 4020.000, -7, -574.286 ] # 10:13:31 > # 10:13:31 > "Done." _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list