Changeset: d99ad520c8de for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d99ad520c8de Modified Files: sql/server/rel_dump.c sql/server/rel_select.c sql/test/BugTracker-2020/Tests/All Branch: oscar Log Message:
Merge with Jun2020 branch. diffs (212 lines): diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -1059,9 +1059,11 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re if (zero_if_empty) set_zero_if_empty(exp); } else { + int nops = list_length(exps); list *ops = sa_list(sql->sa); for( n = exps->h; n; n = n->next) append(ops, exp_subtype(n->data)); + f = sql_bind_func_(sql->sa, s, cname, ops, F_FUNC); if (!f) f = sql_bind_func_(sql->sa, s, cname, ops, F_ANALYTIC); @@ -1100,7 +1102,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re if (f) exp = exp_op( sql->sa, exps, f); else - return sql_error(sql, -1, SQLSTATE(42000) "Function '%s%s%s %d' not found\n", tname ? tname : "", tname ? "." : "", cname, list_length(ops)); + return sql_error(sql, -1, SQLSTATE(42000) "Function '%s%s%s %d' not found\n", tname ? tname : "", tname ? "." : "", cname, nops); } } 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 @@ -3617,6 +3617,7 @@ static sql_exp * sql_exp *r = exps->h->next->data, *or = r; sql_subtype *t2 = exp_subtype(r); + a = NULL; /* reset a */ if (rel_convert_types(sql, *rel, *rel, &l, &r, 1/*fix scale*/, type_equal) >= 0){ list *tps = sa_list(sql->sa); @@ -4019,15 +4020,18 @@ rel_group_column(sql_query *query, sql_r if (!e) { char buf[ERRSIZE]; + int status = sql->session->status; + strcpy(buf, sql->errstr); /* reset error */ sql->session->status = 0; - strcpy(buf, sql->errstr); sql->errstr[0] = '\0'; e = rel_selection_ref(query, rel, grp, selection); if (!e) { - if (sql->errstr[0] == 0) + if (sql->errstr[0] == 0) { + sql->session->status = status; strcpy(sql->errstr, buf); + } return NULL; } } diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -15,4 +15,4 @@ select-and.Bug-6878 copy-decimal-with-space.Bug-6917 isauuid.Bug-6934 tpch-cube.Bug-6938 -HAVE_PYMONETDB?remote-table-like.Bug-6641 +HAVE_PYMONETDB?remote-table-like.Bug-6841 diff --git a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.py rename from sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.py rename to sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.py diff --git a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.err b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.stable.err rename from sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.err rename to sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.stable.err --- a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.err +++ b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.stable.err @@ -1,4 +1,4 @@ -stderr of test 'remote-table-like.Bug-6641` in directory 'sql/test/BugTracker-2020` itself: +stderr of test 'remote-table-like.Bug-6841` in directory 'sql/test/BugTracker-2020` itself: # 10:29:34 > diff --git a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.stable.out rename from sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out rename to sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.stable.out --- a/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6641.stable.out +++ b/sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.stable.out @@ -1,4 +1,4 @@ -stdout of test 'remote-table-like.Bug-6641` in directory 'sql/test/BugTracker-2020` itself: +stdout of test 'remote-table-like.Bug-6841` in directory 'sql/test/BugTracker-2020` itself: # 10:29:34 > diff --git a/sql/test/SQLancer/Tests/sqlancer04.sql b/sql/test/SQLancer/Tests/sqlancer04.sql --- a/sql/test/SQLancer/Tests/sqlancer04.sql +++ b/sql/test/SQLancer/Tests/sqlancer04.sql @@ -20,3 +20,29 @@ HAVING NOT (MIN(ALL ((r'946496923')LIKE( UNION ALL SELECT ALL SUM(ALL 0.12830007105673624234754015560611151158) FROM t0 WHERE ((sql_min(t0.c0, t0.c0))<>(COALESCE (t0.c0, sql_min(abs(t0.c0), nullif(t0.c0, t0.c0))))) GROUP BY 0.1 HAVING (MIN(ALL ((r'946496923')LIKE(CAST(nullif(0.5, 0.03) AS STRING(538)))))) IS NULL; ROLLBACK; + +SELECT covar_samp(1, - (COALESCE(1, 2)||5)); --error on default, covar_samp between integer and string not possible + +START TRANSACTION; +CREATE TABLE "sys"."t0"("c0" DATE, "c1" DATE, "c2" INTERVAL SECOND NOT NULL,"c3" TIME NOT NULL); + +select case covar_samp(all - (coalesce (cast(-5 as int), coalesce (((cast(0.4 as int))-(coalesce (5, 5))), + +(case -3 when 0.5 then 5 else 3 end)))), - (- (((coalesce (cast(0.2 as int), +coalesce (5, 3, -747176383), ((6)%(3)), ((-2)<<(3))))||(-5))))) when case t0.c0 when +case coalesce (coalesce (0.2, 0.3, 0.7), 0.5, +cast(t0.c2 as decimal)) when cast(interval '-4' month as interval second) then cast(case 0.3 when t0.c1 then 0.6 +when interval '-3' month then 0.3 end as interval second) end then coalesce (abs(0.6), +cast(lower(r'') as decimal), 0.4) end then abs(0.5) when abs(-1.4) +then coalesce (sql_min(case t0.c0 when t0.c1 then 0.5 else 0.4 end, +case 0.5 when t0.c2 then 0.6 when 0.5 then 0.2 else 0.7 end), abs(coalesce (0.3, 0.5, 0.3))) +else coalesce (case coalesce (dayofmonth(timestamp '1970-01-15 10:08:18'), coalesce (-5, 3, 5)) when coalesce (cast(timestamp '1970-01-18 00:15:34' as double), +cast(t0.c3 as double)) then case least(t0.c1, t0.c1) when case t0.c2 when interval '5' month then r'*pf6/+}öq壚,j2\302\205K]sNKk,_%Tu' when 1016331084 then r'0.4' +else r'*' end then 0.8 end when sql_min(t0.c3, t0.c3) then coalesce (cast(t0.c2 as decimal), "second"(t0.c3), cast(t0.c2 as decimal), +0.9) when coalesce (cast(t0.c1 as double), 0.2) then 0.0 else 0.0 end, 0.2) end from t0 where (interval '6' month) +is not null group by cast(dayofmonth(t0.c0) as string(679)), 0.2; --error, on Jun2020 t0.c0 is not aggregated, on default +ROLLBACK; + +START TRANSACTION; +CREATE TABLE "sys"."t0" ("c0" INTERVAL SECOND NOT NULL); +SELECT CASE '5'^3 WHEN COUNT(TRUE) THEN 1 END FROM t0 GROUP BY 2 IN ((CAST(INTERVAL '-2' SECOND AS INT))%2); --error on default: types sec_interval(13,0) and int(32,0) are not equal +ROLLBACK; diff --git a/sql/test/SQLancer/Tests/sqlancer04.stable.err b/sql/test/SQLancer/Tests/sqlancer04.stable.err --- a/sql/test/SQLancer/Tests/sqlancer04.stable.err +++ b/sql/test/SQLancer/Tests/sqlancer04.stable.err @@ -5,6 +5,15 @@ stderr of test 'sqlancer04` in directory # 09:44:50 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-36890" "--port=30177" # 09:44:50 > +MAPI = (monetdb) /var/tmp/mtest-297969/.s.monetdb.30789 +QUERY = select case covar_samp(all - (coalesce (cast(-5 as int), coalesce (((cast(0.4 as int))-(coalesce (5, 5))), + + (case -3 when 0.5 then 5 else 3 end)))), - (- (((coalesce (cast(0.2 as int), + coalesce (5, 3, -747176383), ((6)%(3)), ((-2)<<(3))))||(-5))))) when case t0.c0 when + case coalesce (coalesce (0.2, 0.3, 0.7), 0.5, + cast(t0.c2 as decimal)) when cast(interval '-4' month as interval second) then cast(case 0.3 when t0.c1 then 0.6 + when interval '-3' month then 0.3 end as interval second) end then coalesce (abs(0.6), +ERROR = !SELECT: cannot use non GROUP BY column 't0.c0' in query results without an aggregate function +CODE = 42000 # 09:44:50 > # 09:44:50 > "Done." diff --git a/sql/test/SQLancer/Tests/sqlancer04.stable.out b/sql/test/SQLancer/Tests/sqlancer04.stable.out --- a/sql/test/SQLancer/Tests/sqlancer04.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer04.stable.out @@ -29,6 +29,23 @@ stdout of test 'sqlancer04` in directory % double # type % 24 # length #ROLLBACK; +#SELECT covar_samp(1, - (COALESCE(1, 2)||5)); --error on default, covar_samp between integer and string not possible +% .%1 # table_name +% %1 # name +% double # type +% 24 # length +[ NULL ] +#START TRANSACTION; +#CREATE TABLE "sys"."t0"("c0" DATE, "c1" DATE, "c2" INTERVAL SECOND NOT NULL,"c3" TIME NOT NULL); +#ROLLBACK; +#START TRANSACTION; +#CREATE TABLE "sys"."t0" ("c0" INTERVAL SECOND NOT NULL); +#SELECT CASE '5'^3 WHEN COUNT(TRUE) THEN 1 END FROM t0 GROUP BY 2 IN ((CAST(INTERVAL '-2' SECOND AS INT))%2); +% .%7 # table_name +% %7 # name +% tinyint # type +% 1 # length +#ROLLBACK; # 09:44:50 > # 09:44:50 > "Done." diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py --- a/testing/sqllogictest.py +++ b/testing/sqllogictest.py @@ -29,12 +29,12 @@ class SQLLogicSyntaxError(Exception): pass class SQLLogic: - def __init__(self, database=None, out=sys.stdout): + def __init__(self, report=None, out=sys.stdout): self.dbh = None self.crs = None self.out = out self.res = None - self.dbs = database + self.rpt = report def connect(self, username='monetdb', password='monetdb', hostname='localhost', port=None, database='demo'): @@ -109,8 +109,8 @@ class SQLLogic: return ndata def query_error(self, query, message, exception=None): - if self.dbs is not None: - print('On database {}:'.format(self.dbs), file=self.out) + if self.rpt: + print(self.rpt, file=self.out) print(message, file=self.out) if exception: print(exception.rstrip('\n'), file=self.out) @@ -280,10 +280,12 @@ if __name__ == '__main__': parser.add_argument('--results', action='store', type=argparse.FileType('w'), help='file to store results of queries') + parser.add_argument('--report', action='store', default='', + help='information to add to any error messages') parser.add_argument('tests', nargs='*', help='tests to be run') opts = parser.parse_args() args = opts.tests - sql = SQLLogic(database=opts.database) + sql = SQLLogic(report=opts.report) sql.res = opts.results sql.connect(hostname=opts.host, port=opts.port, database=opts.database) for test in args: _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list