Changeset: 48a906e98df7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/48a906e98df7
Modified Files:
        sql/server/rel_exp.c
        sql/server/rel_unnest.c
        sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
Branch: Dec2023
Log Message:

Fix query 15 and 17 of #7390 + enable tests.


diffs (77 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -322,9 +322,11 @@ sql_exp *
 exp_compare_func(mvc *sql, sql_exp *le, sql_exp *re, const char *compareop, 
int quantifier)
 {
        sql_subfunc *cmp_func = sql_bind_func(sql, "sys", compareop, 
exp_subtype(le), exp_subtype(le), F_FUNC, true);
-       sql_exp *e;
-
-       assert(cmp_func);
+       sql_exp *e = NULL;
+
+       if (cmp_func == NULL)
+               return NULL;
+
        e = exp_binop(sql->sa, le, re, cmp_func);
        if (e) {
                e->flag = quantifier;
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -3186,7 +3186,6 @@ rewrite_compare(visitor *v, sql_rel *rel
                        if (!is_tuple && !lsq && !rsq) { /* trivial case, just 
re-write into a comparison */
                                e->flag = 0; /* remove quantifier */
 
-                               rel_bind_var(v->sql, rel, re);
                                if (rel_convert_types(v->sql, NULL, NULL, &le, 
&re, 1, type_equal) < 0)
                                        return NULL;
                                if (depth == 0 && is_select(rel->op)) {
diff --git a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test 
b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
--- a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
+++ b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
@@ -217,15 +217,15 @@ UPDATE v0 SET v1 = v1 % (WITH v0 (v1) AS
 statement ok
 DROP TABLE v0
 
--- -- 15.sql
--- statement ok
--- CREATE TABLE v0(v1 SMALLINT)
+-- 15.sql
+statement ok
+CREATE TABLE v0(v1 SMALLINT)
 
--- statement ok
--- UPDATE v0 SET v1 = v1 <= (WITH v0 (v1) AS (SELECT (CASE WHEN 59 THEN (0 * 
(('x' < v1 = 255 > v1 - v1))) END)) SELECT v1 > 16 OR v1 > 2147483647 AND v1 >= 
27 AS v4 FROM v0 ORDER BY v1 > v1 % v1 % (v1) NULLS LAST) OR v1 > -1
+statement ok
+UPDATE v0 SET v1 = v1 <= (WITH v0 (v1) AS (SELECT (CASE WHEN 59 THEN (0 * 
(('x' < v1 = 255 > v1 - v1))) END)) SELECT v1 > 16 OR v1 > 2147483647 AND v1 >= 
27 AS v4 FROM v0 ORDER BY v1 > v1 % v1 % (v1) NULLS LAST) OR v1 > -1
 
--- statement ok
--- DROP TABLE v0
+statement ok
+DROP TABLE v0
 
 -- 16.sql
 statement ok
@@ -241,15 +241,14 @@ statement ok
 DROP TABLE v0
 
 -- 17.sql
--- statement ok
--- CREATE TABLE v0(v1 INT)
+statement ok
+CREATE TABLE v0(v1 INT)
 
--- statement ok
--- UPDATE v0 SET v1 = (WITH v0 AS (SELECT 42039652.000000) SELECT STDDEV_POP 
(96) OVER (ORDER BY v1) FROM v0, v0 LIMIT 37 OFFSET 62) = 8
--- sql/server/rel_exp.c:327: exp_compare_func: Assertion `cmp_func' failed.
+statement error
+UPDATE v0 SET v1 = (WITH v0 AS (SELECT 42039652.000000) SELECT STDDEV_POP (96) 
OVER (ORDER BY v1) FROM v0, v0 LIMIT 37 OFFSET 62) = 8
 
--- statement ok
--- DROP TABLE v0
+statement ok
+DROP TABLE v0
 
 -- -- 18.sql
 -- statement ok
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to