Changeset: c0d9d579e3d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c0d9d579e3d8
Modified Files:
        sql/server/rel_select.c
        sql/test/SQLancer/Tests/sqlancer04.sql
        sql/test/SQLancer/Tests/sqlancer04.stable.out
Branch: Jun2020
Log Message:

Making SQLancer happy. Save session status before computing a grouping column


diffs (54 lines):

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
@@ -4048,15 +4048,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/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
@@ -41,3 +41,8 @@ else r'*' end then 0.8 end when sql_min(
 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.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
@@ -38,6 +38,14 @@ stdout of test 'sqlancer04` in directory
 #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."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to