Changeset: c9458c92b57e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c9458c92b57e
Modified Files:
        sql/server/rel_optimize_proj.c
        sql/server/rel_select.c
        sql/server/rel_unnest.c
        sql/test/BugTracker-2026/Tests/All
Branch: default
Log Message:

Merge with Dec2025 branch.


diffs (182 lines):

diff --git a/license.txt b/LICENSE
rename from license.txt
rename to LICENSE
diff --git a/MacOSX/MonetDB.pkgproj b/MacOSX/MonetDB.pkgproj
--- a/MacOSX/MonetDB.pkgproj
+++ b/MacOSX/MonetDB.pkgproj
@@ -696,7 +696,7 @@
                                                <key>VALUE</key>
                                                <dict>
                                                        <key>PATH</key>
-                                                       
<string>../license.txt</string>
+                                                       
<string>../LICENSE</string>
                                                        <key>PATH_TYPE</key>
                                                        <integer>1</integer>
                                                </dict>
diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py
--- a/misc/python/fixlicense.py
+++ b/misc/python/fixlicense.py
@@ -116,7 +116,7 @@ suffixrules = {
     'Makefile': ('', '', '# ', '', True),
     '.merovingian_properties': ('', '', '# ', '', True),
     'copyright': ('', '', '', '', True),
-    'license.txt': ('', '', '', '', True),
+    'LICENSE': ('', '', '', '', True),
     }
 
 def getcomments(file, pre=None, post=None, start=None, end=None, nl=True):
diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -2155,7 +2155,7 @@ gen_push_groupby_down(mvc *sql, sql_rel 
                                list *args = ce->l;
 
                                /* check args are part of left/right */
-                               if (!list_empty(args) && rel_has_exps(cl, args, 
false) == 0)
+                               if (!list_empty(args) && rel_has_exps(cr, args, 
false) != 0)
                                        return rel;
                                if (rel->op != op_join && exp_aggr_is_count(ce))
                                        ce->p = prop_create(sql->sa, 
PROP_COUNT, ce->p);
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
@@ -362,19 +362,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/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1737,6 +1737,8 @@ push_up_munion(mvc *sql, sql_rel *rel, l
                        if (rec) {
                                sql_rel *sl = rlist->h->data;
                                set_has_freevar(sl);
+                               if (!is_simple_project(sl->op))
+                                       sl = rel_inplace_project(sql->sa, sl, 
NULL, rel_projections(sql, sl, NULL, 1, 1));
                                list *exps = exps_copy(sql, ad);
                                for(node *n = exps->h; n; n = n->next) {
                                        sql_exp *e = n->data;
diff --git a/sql/test/BugTracker-2026/Tests/7865-unnest-cte-crash.test 
b/sql/test/BugTracker-2026/Tests/7865-unnest-cte-crash.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7865-unnest-cte-crash.test
@@ -0,0 +1,17 @@
+query I
+SELECT 1
+FROM (SELECT 1) as x(x)
+WHERE x IN
+(
+    WITH RECURSIVE t(row_number) AS
+    (
+        SELECT 1
+        EXCEPT
+        SELECT 2
+        UNION
+        SELECT 1 AS x WHERE EXISTS (SELECT * FROM t WHERE x = x)
+    )
+    SELECT x FROM t
+)
+----
+1
diff --git a/sql/test/BugTracker-2026/Tests/7867-push-groupby-down.test 
b/sql/test/BugTracker-2026/Tests/7867-push-groupby-down.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7867-push-groupby-down.test
@@ -0,0 +1,32 @@
+query I
+SELECT x
+FROM
+(
+    SELECT 1 AS x
+    UNION
+    SELECT 1
+    FROM
+       (
+               SELECT 1 AS x
+               UNION
+               SELECT 1 AS x
+       )
+       GROUP BY x
+       HAVING COUNT(*) >
+       (
+               SELECT 1
+        WHERE x IN
+               (
+                       SELECT *
+                       FROM
+                       (
+                               WITH y AS (SELECT 1)
+                               SELECT 1
+                               FROM y
+                               ORDER BY CASE WHEN x THEN x < ANY (x < (WITH z 
AS (SELECT 1) SELECT * FROM z)) END
+                       )
+               )
+       )
+) AS x
+----
+1
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
@@ -59,4 +59,7 @@ KNOWNFAIL?7774-insert-into-renamed-table
 7855-ntile
 7856-crash-exp-match
 7857-rollup-crash
-7862-rel_has_freevar-crash
+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]

Reply via email to