Changeset: bef4cd78aef6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bef4cd78aef6
Modified Files:
        sql/server/rel_optimize_others.c
        sql/test/BugTracker-2025/Tests/7643_select_0_optimizer_bug.test
Branch: Mar2025
Log Message:

small fix for 7643, only push down topn if the expressions for the order by 
exists also at that layer.


diffs (23 lines):

diff --git a/sql/server/rel_optimize_others.c b/sql/server/rel_optimize_others.c
--- a/sql/server/rel_optimize_others.c
+++ b/sql/server/rel_optimize_others.c
@@ -1398,7 +1398,7 @@ rel_push_topn_and_sample_down_(visitor *
                                        pe = exps_find_exp(rp->exps, pe);
                                if (pe)
                                        pe = rel_find_exp(l, pe);
-                               if (pe) {
+                               if (pe && pe->type == e_column) {
                                        if (exp_is_atom(pe))
                                                return rel;
                                        pe = exp_ref(v->sql, pe);
diff --git a/sql/test/BugTracker-2025/Tests/7643_select_0_optimizer_bug.test 
b/sql/test/BugTracker-2025/Tests/7643_select_0_optimizer_bug.test
--- a/sql/test/BugTracker-2025/Tests/7643_select_0_optimizer_bug.test
+++ b/sql/test/BugTracker-2025/Tests/7643_select_0_optimizer_bug.test
@@ -66,7 +66,6 @@ 1.1
 -- query with the added '(select 0)' query parts, fails.
 -- server crash: sql/backends/monet5/rel_bin.c:1858: exp_bin: Assertion `s' 
failed.
 -- Something wrong with the MAL optimizer, run the query with EXPLAIN
-skipif knownfail
 query TTTIIR nosort
 SELECT acol1,
 acol2,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to