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

Look for possible errors and and small cleanup


diffs (72 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
@@ -3872,7 +3872,9 @@ do_complex_case(sql_query *query, node *
        sql_exp *r = n->data;
        if (n->next)
                r = do_complex_case(query, n, func, restype);
-       else if (!(r = exp_check_type(query->sql, restype, NULL, r, 
type_equal)))
+       else
+               r = exp_check_type(query->sql, restype, NULL, r, type_equal);
+       if (!r)
                return NULL;
        return rel_binop_(query->sql, NULL, l, r, NULL, func, card_value);
 }
@@ -3901,24 +3903,8 @@ rel_complex_case(sql_query *query, sql_r
        }
        if (!restype)
                return sql_error(query->sql, 02, SQLSTATE(42000) "Result type 
missing");
-
-       /*
-       sql_exp *cur = NULL;
-       for (node *n = args->h; n; n = n->next) {
-               sql_exp *a = n->data;
-
-               if (!(a = exp_check_type(query->sql, restype, rel ? *rel : 
NULL, a, type_equal)))
-                       return NULL;
-               if (!cur)
-                       cur = a;
-               else {
-                       cur = rel_binop_(query->sql, NULL, cur, a, NULL, func, 
card_value);
-                       if (!cur)
-                               return NULL;
-               }
-       }
-       return cur;
-       */
+       if (restype->type->localtype == TYPE_void) /* NULL */
+               restype = sql_bind_localtype("str");
        return do_complex_case(query, args->h, func, restype);
 }
 
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
@@ -80,3 +80,12 @@ CREATE TABLE t0(c0 INTERVAL SECOND, UNIQ
 CREATE TABLE t1(c2 BLOB, FOREIGN KEY (c2) REFERENCES t0(c0) MATCH FULL, 
PRIMARY KEY(c2)); --error, foreign key from blob to interval second not allowed
 CREATE TABLE t1(c2 TIME, FOREIGN KEY (c2) REFERENCES t0(c0) MATCH FULL, 
PRIMARY KEY(c2)); --error, foreign key from time to interval second not allowed
 DROP TABLE t0;
+
+START TRANSACTION;
+CREATE TABLE "sys"."t0" ("c0" DOUBLE NOT NULL,CONSTRAINT "t0_c0_pkey" PRIMARY 
KEY ("c0"));
+CREATE TABLE "sys"."t1" ("c0" DOUBLE);
+create view v1(c0, c1) as (select distinct 
(((t0.c0)=(((1357695262)^(-922564194))))) = false, cast(coalesce(coalesce(0.3, 
0.4), "second"(timestamp '1970-01-10 11:54:13')) as double) from t0);
+create view v2(c0) as (select distinct coalesce(abs(interval '-1976292283' 
month), cast(greatest(r'Dnwxjm4btQ9cp&\c''a_', r'(y7,{q?][NHU,') as interval 
month)) from t1, t0 where ((upper(r''))not ilike(lower(r'''wAg_ z 
''PPxXßgrd⍮G'))));
+select all v2.c0 from v2 right outer join v1 on 
((r'8*By1q)*Oc<n')like(substr(r'', 1151312829, 406714197))) 
+where (case v1.c0 when v1.c0 then interval '104279220' second end) in 
(interval '2129103763' second) group by timestamp '1970-01-21 14:05:46';
+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
@@ -38,6 +38,11 @@ MAPI  = (monetdb) /var/tmp/mtest-42538/.
 QUERY = CREATE TABLE t1(c2 TIME, FOREIGN KEY (c2) REFERENCES t0(c0) MATCH 
FULL, PRIMARY KEY(c2)); --error, foreign key from time to interval second not 
allowed
 ERROR = !CONSTRAINT FOREIGN KEY: the type of the FOREIGN KEY column 'c2' 
time(1) is not compatible with the referenced UNIQUE KEY column type 
sec_interval(13)
 CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-217740/.s.monetdb.38224
+QUERY = select all v2.c0 from v2 right outer join v1 on 
((r'8*By1q)*Oc<n')like(substr(r'', 1151312829, 406714197))) 
+        where (case v1.c0 when v1.c0 then interval '104279220' second end) in 
(interval '2129103763' second) group by timestamp '1970-01-21 14:05:46';
+ERROR = !Wrong format (Dnwxjm4btQ9cp&\c'a_)
+CODE  = 42000
 
 # 09:44:50 >  
 # 09:44:50 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to