Changeset: 29f26ee98e36 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=29f26ee98e36
Modified Files:
sql/common/sql_types.c
sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
sql/test/SQLancer/Tests/sqlancer09.sql
sql/test/SQLancer/Tests/sqlancer10.sql
sql/test/analytics/Tests/analytics02.stable.out
sql/test/analytics/Tests/analytics03.stable.out
sql/test/subquery/Tests/subquery6.stable.out
Branch: Oct2020
Log Message:
If the result type of the function is any, override the output number of digits
with the input type. But there's another sqlancer bug with cast between strings
and decimals :(
diffs (119 lines):
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -569,7 +569,7 @@ sql_dup_subfunc(sql_allocator *sa, sql_f
} else if (r->scale)
scale = r->scale;
}
- if (member && f->fix_scale == INOUT)
+ if (member && (f->fix_scale == INOUT ||
r->type->eclass == EC_ANY))
digits = member->digits;
if (IS_ANALYTIC(f) && mscale)
scale = mscale;
diff --git
a/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
b/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
--- a/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
+++ b/sql/test/BugTracker-2019/Tests/outer-join-varchar.Bug-6776.stable.out
@@ -78,7 +78,7 @@ stdout of test 'outer-join-varchar.Bug-6
% table_name, column_name, type, type_digits # name
% varchar, varchar, varchar, int # type
% 6, 4, 7, 2 # length
-[ "dummy6", "key", "varchar", 0 ]
+[ "dummy6", "key", "varchar", 32 ]
[ "dummy6", "val4", "int", 32 ]
[ "dummy6", "val5", "int", 32 ]
#create table dummy7 as select "key", val as "val4", val as "val5" from dummy4
natural full outer join dummy5;
@@ -88,7 +88,7 @@ stdout of test 'outer-join-varchar.Bug-6
% table_name, column_name, type, type_digits # name
% varchar, varchar, varchar, int # type
% 6, 4, 7, 2 # length
-[ "dummy7", "key", "varchar", 0 ]
+[ "dummy7", "key", "varchar", 32 ]
[ "dummy7", "val4", "int", 32 ]
[ "dummy7", "val5", "int", 32 ]
#create table dummy8 as select dummy4."key" as "key4", dummy5."key" as "key5",
dummy4.val as "val4", dummy5.val as "val5" from dummy4 full outer join dummy5
ON dummy4."key" = dummy5."key";
diff --git a/sql/test/SQLancer/Tests/sqlancer09.sql
b/sql/test/SQLancer/Tests/sqlancer09.sql
--- a/sql/test/SQLancer/Tests/sqlancer09.sql
+++ b/sql/test/SQLancer/Tests/sqlancer09.sql
@@ -184,7 +184,7 @@ 239480113 NULL NULL
create view v2(vc0, vc1, vc2) as (values (((((+
(0.51506835))&(-2)))<<(scale_down(least(31552,
0.3), cast(1500294098 as int)))),
-((- (((44257622)-(0.6))))>=(least(-15958291, -1534974396))), case -
(sql_min(0.632858,
+((- (((44257622)-(0.6))))>=(least(-3, -4))), case - (sql_min(0.632858,
0.3)) when ((((0.5)^(0.4)))+(((0.4)/(5))))
then sql_max(cast(5293 as decimal), ((0.5)-
(0.5))) end),(charindex(r'934079707', r'35305325'), not (false),
diff --git a/sql/test/SQLancer/Tests/sqlancer10.sql
b/sql/test/SQLancer/Tests/sqlancer10.sql
--- a/sql/test/SQLancer/Tests/sqlancer10.sql
+++ b/sql/test/SQLancer/Tests/sqlancer10.sql
@@ -53,6 +53,12 @@ select 1 from v6, v2 join (values (0.54)
ROLLBACK;
START TRANSACTION;
+create view v3(vc0, vc1) as (values (0.67,NULL),(18.50, 3),(0.70, 6));
+create view v7(vc0) as (values (8505133838.114197),(NULL));
+(select v3.vc0 from v3) intersect (select greatest('-1115800120', v7.vc0) from
v7);
+ROLLBACK;
+
+START TRANSACTION;
CREATE TABLE t1(c0 int);
CREATE VIEW v4(vc0) AS ((SELECT NULL FROM t1 AS l0t1) UNION ALL (SELECT true));
INSERT INTO t1(c0) VALUES(12), (2), (6), (3), (1321), (10), (8), (1), (2),
(3), (9);
diff --git a/sql/test/analytics/Tests/analytics02.stable.out
b/sql/test/analytics/Tests/analytics02.stable.out
--- a/sql/test/analytics/Tests/analytics02.stable.out
+++ b/sql/test/analytics/Tests/analytics02.stable.out
@@ -58,8 +58,8 @@ stdout of test 'analytics02` in director
% .prepare, .prepare, .prepare, .prepare, .prepare,
.prepare # table_name
% type, digits, scale, schema, table, column # name
% varchar, int, int, str, str, str # type
-% 7, 2, 1, 0, 2, 2 # length
-[ "varchar", 0, 0, "", "%7", "%7" ]
+% 7, 3, 1, 0, 2, 2 # length
+[ "varchar", 64, 0, "", "%7", "%7" ]
[ "bigint", 64, 0, NULL, NULL, NULL ]
#exec 13(2);
% sys.%7 # table_name
diff --git a/sql/test/analytics/Tests/analytics03.stable.out
b/sql/test/analytics/Tests/analytics03.stable.out
--- a/sql/test/analytics/Tests/analytics03.stable.out
+++ b/sql/test/analytics/Tests/analytics03.stable.out
@@ -255,8 +255,8 @@ stdout of test 'analytics03` in director
# floor(avg(aa) over (order by bb range between current row and
unbounded following)),
# floor(avg(aa) over (partition by bb order by bb rows unbounded
preceding)),
# floor(avg(aa) over (partition by bb order by bb range unbounded
preceding)) from overflowme;
-% sys.%65, sys.%66, sys.%67, sys.%70, sys.%71,
sys.%72 # table_name
-% %65, %66, %67, %70, %71, %72 # name
+% sys.%53, sys.%54, sys.%55, sys.%56, sys.%57,
sys.%60 # table_name
+% %53, %54, %55, %56, %57, %60 # name
% double, double, double, double, double, double # type
% 24, 24, 24, 24, 24, 24 # length
[ 2147483645, 2147483645, 2147483645, 2147483645, 2147483644,
2147483645 ]
@@ -282,8 +282,8 @@ stdout of test 'analytics03` in director
% .%12 # table_name
% %12 # name
% time # type
-% 15 # length
-[ 10:10:00.000000 ]
+% 8 # length
+[ 10:10:00 ]
#drop table rowsvsrangevsgroups;
# 17:06:35 >
diff --git a/sql/test/subquery/Tests/subquery6.stable.out
b/sql/test/subquery/Tests/subquery6.stable.out
--- a/sql/test/subquery/Tests/subquery6.stable.out
+++ b/sql/test/subquery/Tests/subquery6.stable.out
@@ -318,13 +318,13 @@ stdout of test 'subquery6` in directory
% .%4, .%11, .%16, .%24, .%32 # table_name
% %4, %11, %16, %24, %32 # name
% char, char, char, char, char # type
-% 0, 0, 3, 3, 3 # length
+% 3, 3, 3, 3, 3 # length
[ NULL, NULL, "bug", "oth", "bug" ]
#select lead('bug') over (), lead('bug', 1) over (), lead('bug', 0) over (),
lead('bug', 1, 'oth') over (), lead('bug', 0, 'oth') over (), max(TotalSales)
from tbl_ProductSales;
% .%4, .%11, .%16, .%24, .%32, sys.%33 # table_name
% %4, %11, %16, %24, %32, %33 # name
% char, char, char, char, char, int # type
-% 0, 0, 3, 3, 3, 3 # length
+% 3, 3, 3, 3, 3, 3 # length
[ NULL, NULL, "bug", "oth", "bug", 500 ]
#select (select sum(i1.i + i2.i) in (select sum(i1.i + i2.i)) from integers
i2) from integers i1;
% .%4 # table_name
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list