Changeset: ee995fa7b15b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ee995fa7b15b
Added Files:
sql/test/BugTracker-2026/Tests/7872-exp-type-check-failed.test
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:
fixes for issue #7872, properly check return of expression type checking
diffs (68 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
@@ -361,19 +361,28 @@ rel_with_query(sql_query *query, symbol
/* down cast the recursive side (on errors
users should add casts on the base side) */
list *nrs = new_exp_list(sql->sa);
- if(!nrs)
+ if(!nrs) {
+ stack_pop_frame(sql);
return NULL;
+ }
for (node *n = ls->h, *m = rs->h; n && m; n =
n->next, m = m->next) {
sql_subtype *t = exp_subtype(n->data);
- append(nrs, exp_check_type(sql, t,
nrel, m->data, type_equal));
+ sql_exp *e = exp_check_type(sql, t,
nrel, m->data, type_equal);
+ if (!e) {
+ stack_pop_frame(sql);
+ return NULL;
+ }
+ append(nrs, e);
}
nrel = rel_project(sql->sa, nrel, nrs);
nrel = rel_setop_n_ary(sql->sa,
append(append(sa_list(sql->sa), base_rel), nrel), op_munion);
set_recursive(nrel);
}
- if (!nrel)
+ if (!nrel) {
+ stack_pop_frame(sql);
return NULL;
+ }
if (recursive_distinct)
set_distinct(nrel);
rel_setop_n_ary_set_exps(sql, nrel,
rel_projections(sql, nrel, NULL, 0, 1), false);
diff --git a/sql/test/BugTracker-2026/Tests/7872-exp-type-check-failed.test
b/sql/test/BugTracker-2026/Tests/7872-exp-type-check-failed.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7872-exp-type-check-failed.test
@@ -0,0 +1,20 @@
+statement error 42000!types decimal(9,6) and boolean(1,0) are not equal for
column 'row_number'
+SELECT x , CASE WHEN x > 12 THEN 1 ELSE 0 END AS x
+FROM (
+ SELECT 10 AS x
+ UNION SELECT 11 AS x GROUP BY CUBE ( x , x )
+ UNION SELECT 12 AS x
+ UNION SELECT 3.141593 AS x
+)
+WHERE x IN (
+ WITH RECURSIVE x ( row_number ) AS (
+ SELECT AVG ( CAST( NULL AS INT ) ) OVER ( ORDER BY 3 NULLS LAST ) !=
955
+ UNION
+ SELECT x + 1 FROM x WHERE x < 20
+ )
+ SELECT x FROM x
+ WHERE x NOT IN ( 8 , 12 , CAST( 0.000000 AS FLOAT ) , 24 , 32 )
+ OR x = 512
+ GROUP BY x
+ HAVING NOT x = '2'
+)
diff --git a/sql/test/BugTracker-2026/Tests/All
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -62,3 +62,4 @@ KNOWNFAIL?7774-insert-into-renamed-table
KNOWNFAIL?7862-rel_has_freevar-crash
7865-unnest-cte-crash
7867-push-groupby-down
+7872-exp-type-check-failed
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]