Changeset: 55c29a5b9c97 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/55c29a5b9c97
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/server/rel_dump.c
        sql/server/rel_rel.c
        sql/test/BugTracker-2025/Tests/7729-tail_type-crash.test
        sql/test/BugTracker-2025/Tests/All
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Solved issue #7729, ie only rename expressions in rel_projections when no name 
is set.
Solved issues #7891, #7892, #7893, #7894 and #7895, improved and/or code 
generation.


diffs (97 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -714,7 +714,7 @@ exp_bin_conjunctive(backend *be, sql_exp
                        sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true, true);
                        assert(f);
                        s = stmt_binop(be, sin, s, NULL, f);
-               } else if (!reduce && !sin && sel1 && sel1->nrcols == 0 && 
s->nrcols == 0) {
+               } else if (!reduce && !sin && sel1 && sel1->nrcols == 0) {
                        sql_subfunc *f = sql_bind_func(be->mvc, "sys", 
anti?"or":"and", bt, bt, F_FUNC, true, true);
                        assert(f);
                        s = stmt_binop(be, sel1, s, sin, f);
@@ -733,6 +733,8 @@ exp_bin_conjunctive(backend *be, sql_exp
                                predicate = stmt_const(be, predicate, 
stmt_bool(be, 1));
                                s = stmt_uselect(be, predicate, s, cmp_equal, 
sel1, anti, is_semantics(c));
                        }
+               } else if (reduce && anti && sel1) {
+                       s = stmt_tunion(be, s, sel1);
                }
                sel1 = s;
        }
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -118,6 +118,8 @@ exp_or_print(mvc *sql, stream *fout, nod
        sql_exp *r = n->next->data;
 
        if (l->type == e_cmp && l->flag == cmp_con) {
+               if (is_anti(l))
+                       mnstr_printf(fout, " !");
                exps_print(sql, fout, l->l, depth, refs, 0, 1, decorate, 0);
        } else {
                mnstr_printf(fout, "(");
@@ -134,6 +136,8 @@ exp_or_print(mvc *sql, stream *fout, nod
                mnstr_printf(fout, ")");
        } else {
                if (r->type == e_cmp && r->flag == cmp_con) {
+                       if (is_anti(r))
+                               mnstr_printf(fout, " !");
                        exps_print(sql, fout, r->l, depth, refs, 0, 1, 
decorate, 0);
                } else {
                        mnstr_printf(fout, "(");
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -1337,8 +1337,8 @@ _rel_projections(mvc *sql, sql_rel *rel,
                                if (basecol && !is_basecol(e))
                                        continue;
                                if (intern || !is_intern(e)) {
-                                       if (!e->alias.label || (exp_is_rel(e) 
&& e->alias.name == NULL))
-                                               en->data = e = 
exp_label(sql->sa, e, ++sql->label);
+                                       if (exp_is_rel(e) && e->alias.name == 
NULL && e->alias.rname && exp_name(e))
+                                               e->alias.name = exp_name(e);
                                        sql_exp *ne = exp_ref(sql, e);
                                        if (settname && tname)
                                                exp_setname(sql, ne, tname, 
exp_name(e));
diff --git a/sql/test/BugTracker-2025/Tests/7729-tail_type-crash.test 
b/sql/test/BugTracker-2025/Tests/7729-tail_type-crash.test
--- a/sql/test/BugTracker-2025/Tests/7729-tail_type-crash.test
+++ b/sql/test/BugTracker-2025/Tests/7729-tail_type-crash.test
@@ -1,5 +1,3 @@
 -- Segmentation fault in tail_type (st=0x0) at 
sql/backends/monet5/sql_statement.c:4647  switch (st->type) {
-query I
+statement error 22018!conversion of string to type bte failed.
 SELECT ( WITH x ( x ) AS ( SELECT DISTINCT 1 ) SELECT ( SELECT x FROM x WHERE 
x = ( SELECT ( CASE WHEN x THEN x END ) WHERE ( SELECT x FROM x WHERE ( x , ( 
SELECT ( WITH x ( x ) AS ( SELECT DISTINCT 1 ) SELECT ( SELECT x FROM x WHERE x 
= ( SELECT ( CASE WHEN x THEN x END ) WHERE 1 + 1 + 1 + 1 + 1 + 1 + 1 + 
9223372036854775808.000000 + 1 + 1 = ( SELECT x FROM x ) AND x GROUP BY 1 
HAVING ( - 'x' >= x IS NOT NULL = ( 1 < x AND x < 'x' ) AND x = 8 ) ) GROUP BY 
x HAVING ( 9 = -1 AND x = 8 ) ) FROM x ) LIMIT 10 OFFSET 0 ) ) NOT IN ( SELECT 
x , x FROM x WHERE x > 1 ) ) AND x ) ) FROM x )
-----
-
diff --git a/sql/test/BugTracker-2025/Tests/All 
b/sql/test/BugTracker-2025/Tests/All
--- a/sql/test/BugTracker-2025/Tests/All
+++ b/sql/test/BugTracker-2025/Tests/All
@@ -69,7 +69,7 @@ HAVE_HGE?7637_str_to_decimal
 7724-sql_ref_inc-error
 7725-crash-find-rel-ref
 7726-commonterms
-KNOWNFAIL?7729-tail_type-crash
+7729-tail_type-crash
 7730-generate-series-month-int
 7732-table-exp-issue
 7734-epoch-missing-cast
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
@@ -77,10 +77,10 @@ KNOWNFAIL?7774-insert-into-renamed-table
 7888-or-false-write
 7889-delete-with-union-intersect
 7890-insert-exists-issue
-KNOWNFAIL?7891-update-issue
-KNOWNFAIL?7892-where-subqueries-sum-bug
-KNOWNFAIL?7893-where-subqueries-sum-bug
-KNOWNFAIL?7894-subquery-where-not-bug
-KNOWNFAIL?7895-subquery-where-not-bug
+7891-update-issue
+7892-where-subqueries-sum-bug
+7893-where-subqueries-sum-bug
+7894-subquery-where-not-bug
+7895-subquery-where-not-bug
 KNOWNFAIL?7896-where-ascii-comparison-bug
 KNOWNFAIL?7906-rel2bin_join-assertion-failure
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to