Changeset: eb363793e319 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eb363793e319
Modified Files:
sql/common/sql_types.c
sql/server/rel_select.c
sql/server/sql_semantic.c
sql/test/SQLancer/Tests/sqlancer01.sql
sql/test/analytics/Tests/analytics07.stable.err
sql/test/analytics/Tests/analytics07.stable.out
Branch: Jun2020
Log Message:
Making SQLancer happy. When printing a SQL type string, don't print the number
digits for fixed width types such as INT, else we get non recognizable types
such as int(32).
diffs (164 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
@@ -418,10 +418,10 @@ subtype2string2(sql_subtype *tpe) //dist
switch (tpe->type->eclass) {
case EC_SEC:
- snprintf(buf, BUFSIZ, "BIGINT");
+ snprintf(buf, BUFSIZ, "INTERVAL SECOND");
break;
case EC_MONTH:
- snprintf(buf, BUFSIZ, "INT");
+ snprintf(buf, BUFSIZ, "INTERVAL MONTH");
break;
case EC_CHAR:
case EC_STRING:
diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -4715,7 +4715,7 @@ calculate_window_bound(sql_query *query,
if (!(bclass == EC_NUM || EC_INTERVAL(bclass) || bclass ==
EC_DEC || bclass == EC_FLT))
return sql_error(sql, 02, SQLSTATE(42000) "%s offset
must be of a countable SQL type", bound_desc);
if ((frame_type == FRAME_ROWS || frame_type == FRAME_GROUPS) &&
bclass != EC_NUM) {
- char *err = subtype2string(bt);
+ char *err = subtype2string2(bt);
if (!err)
return sql_error(sql, 02, SQLSTATE(HY013)
MAL_MALLOC_FAIL);
(void) sql_error(sql, 02, SQLSTATE(42000) "Values on %s
boundary on %s frame can't be %s type", bound_desc,
@@ -4733,7 +4733,7 @@ calculate_window_bound(sql_query *query,
if (bclass != EC_DEC && iet->type->eclass == EC_DEC)
return sql_error(sql, 02, SQLSTATE(42000)
"Values on %s boundary aren't decimals while on input are", bound_desc);
if (bclass != EC_SEC && iet->type->eclass == EC_TIME) {
- char *err = subtype2string(iet);
+ char *err = subtype2string2(iet);
if (!err)
return sql_error(sql, 02,
SQLSTATE(HY013) MAL_MALLOC_FAIL);
(void) sql_error(sql, 02, SQLSTATE(42000) "For
%s input the %s boundary must be an interval type up to the day", err,
bound_desc);
@@ -4741,7 +4741,7 @@ calculate_window_bound(sql_query *query,
return NULL;
}
if (EC_INTERVAL(bclass) && !EC_TEMP(iet->type->eclass))
{
- char *err = subtype2string(iet);
+ char *err = subtype2string2(iet);
if (!err)
return sql_error(sql, 02,
SQLSTATE(HY013) MAL_MALLOC_FAIL);
(void) sql_error(sql, 02, SQLSTATE(42000) "For
%s input the %s boundary must be an interval type", err, bound_desc);
diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -461,7 +461,7 @@ symbol2string(mvc *sql, symbol *se, int
dlist *dl = se->data.lval;
char *val = NULL, *tpe = NULL, *res;
- if (!(val = symbol2string(sql, dl->h->data.sym, expression,
err)) || !(tpe = subtype2string(&dl->h->next->data.typeval))) {
+ if (!(val = symbol2string(sql, dl->h->data.sym, expression,
err)) || !(tpe = subtype2string2(&dl->h->next->data.typeval))) {
_DELETE(val);
_DELETE(tpe);
return NULL;
diff --git a/sql/test/SQLancer/Tests/sqlancer01.sql
b/sql/test/SQLancer/Tests/sqlancer01.sql
--- a/sql/test/SQLancer/Tests/sqlancer01.sql
+++ b/sql/test/SQLancer/Tests/sqlancer01.sql
@@ -228,6 +228,10 @@ SELECT v0.c0 FROM v0 WHERE (v0.c1) NOT B
--empty
ROLLBACK;
+START TRANSACTION;
+CREATE TABLE t0 (c0 integer DEFAULT CAST(0 AS INT));
+ROLLBACK;
+
DROP TABLE tbl_ProductSales;
DROP TABLE another_T;
DROP TABLE integers;
diff --git a/sql/test/analytics/Tests/analytics07.stable.err
b/sql/test/analytics/Tests/analytics07.stable.err
--- a/sql/test/analytics/Tests/analytics07.stable.err
+++ b/sql/test/analytics/Tests/analytics07.stable.err
@@ -34,7 +34,7 @@ ERROR = !The PRECEDING boundary must be
CODE = 42000
MAPI = (monetdb) /var/tmp/mtest-4630/.s.monetdb.34662
QUERY = select count(*) over (order by aa range between interval '3' month
preceding and interval '5' month following) from testintervals3; --error, for
time columns month intervals are not allowed
-ERROR = !For time(1) input the PRECEDING boundary must be an interval type up
to the day
+ERROR = !For time input the PRECEDING boundary must be an interval type up to
the day
CODE = 42000
# 11:59:18 >
diff --git a/sql/test/analytics/Tests/analytics07.stable.out
b/sql/test/analytics/Tests/analytics07.stable.out
--- a/sql/test/analytics/Tests/analytics07.stable.out
+++ b/sql/test/analytics/Tests/analytics07.stable.out
@@ -43,8 +43,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa range between interval '1' month preceding
and current row),
# count(*) over (order by aa range between current row and interval
'30000' second following),
# count(*) over (order by aa range between unbounded preceding and
unbounded following) from testintervals;
-% sys.%11, sys.%14, sys.%17, sys.%22, sys.%25,
sys.%30 # table_name
-% %11, %14, %17, %22, %25, %30 # name
+% sys.%10, sys.%20, sys.%30, sys.%40, sys.%50,
sys.%60 # table_name
+% %10, %20, %30, %40, %50, %60 # name
% bigint, bigint, bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1, 1, 1 # length
[ 1, 1, 7, 1, 1, 7 ]
@@ -59,8 +59,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa range between interval '2' month preceding
and interval '1' month following),
# count(*) over (order by aa range between interval '0' second preceding
and interval '0' second following),
# count(*) over (order by aa range between interval '2629800' second
preceding and interval '2629800' second following),
-% sys.%11, sys.%14, sys.%17, sys.%22, sys.%25,
sys.%30 # table_name
-% %11, %14, %17, %22, %25, %30 # name
+% sys.%10, sys.%20, sys.%30, sys.%40, sys.%50,
sys.%60 # table_name
+% %10, %20, %30, %40, %50, %60 # name
% bigint, bigint, bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1, 1, 1 # length
[ 1, 1, 1, 1, 1, 1 ]
@@ -75,8 +75,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa desc range between interval '2' month
preceding and interval '1' month following),
# count(*) over (order by aa desc range between interval '0' second
preceding and interval '0' second following),
# count(*) over (order by aa desc range between interval '2629800'
second preceding and interval '2629800' second following),
-% sys.%11, sys.%14, sys.%17, sys.%22, sys.%25,
sys.%30 # table_name
-% %11, %14, %17, %22, %25, %30 # name
+% sys.%10, sys.%20, sys.%30, sys.%40, sys.%50,
sys.%60 # table_name
+% %10, %20, %30, %40, %50, %60 # name
% bigint, bigint, bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1, 1, 1 # length
[ 1, 1, 1, 1, 1, 1 ]
@@ -91,8 +91,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa range between interval '2' month preceding
and interval '1' month following),
# count(*) over (order by aa range between interval '0' second preceding
and interval '0' second following),
# count(*) over (order by aa range between interval '2629800' second
preceding and interval '2629800' second following),
-% sys.%11, sys.%14, sys.%17, sys.%22, sys.%25,
sys.%30 # table_name
-% %11, %14, %17, %22, %25, %30 # name
+% sys.%10, sys.%20, sys.%30, sys.%40, sys.%50,
sys.%60 # table_name
+% %10, %20, %30, %40, %50, %60 # name
% bigint, bigint, bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1, 1, 1 # length
[ 1, 1, 1, 1, 1, 1 ]
@@ -107,8 +107,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa desc range between interval '2' month
preceding and interval '1' month following),
# count(*) over (order by aa desc range between interval '0' second
preceding and interval '0' second following),
# count(*) over (order by aa desc range between interval '2629800'
second preceding and interval '2629800' second following),
-% sys.%11, sys.%14, sys.%17, sys.%22, sys.%25,
sys.%30 # table_name
-% %11, %14, %17, %22, %25, %30 # name
+% sys.%10, sys.%20, sys.%30, sys.%40, sys.%50,
sys.%60 # table_name
+% %10, %20, %30, %40, %50, %60 # name
% bigint, bigint, bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1, 1, 1 # length
[ 1, 1, 1, 1, 1, 1 ]
@@ -122,8 +122,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa range between interval '3' hour preceding
and interval '3' hour following),
# count(*) over (order by aa range between interval '60' minute
preceding and interval '60' minute following),
# count(*) over (order by aa range between current row and current row)
from testintervals3;
-% sys.%7, sys.%12, sys.%15, sys.%20 # table_name
-% %7, %12, %15, %20 # name
+% sys.%10, sys.%20, sys.%30, sys.%40 # table_name
+% %10, %20, %30, %40 # name
% bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1 # length
[ 1, 2, 1, 1 ]
@@ -137,8 +137,8 @@ stdout of test 'analytics07` in director
# count(*) over (order by aa desc range between interval '3' hour
preceding and interval '3' hour following),
# count(*) over (order by aa desc range between interval '60' minute
preceding and interval '60' minute following),
# count(*) over (order by aa desc range between current row and current
row) from testintervals3;
-% sys.%7, sys.%12, sys.%15, sys.%20 # table_name
-% %7, %12, %15, %20 # name
+% sys.%10, sys.%20, sys.%30, sys.%40 # table_name
+% %10, %20, %30, %40 # name
% bigint, bigint, bigint, bigint # type
% 1, 1, 1, 1 # length
[ 1, 2, 2, 1 ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list