Changeset: 971928a74d87 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/971928a74d87
Modified Files:
        monetdb5/modules/kernel/algebra.c
        sql/backends/monet5/generator/generator.c
        sql/test/BugTracker-2026/Tests/7815-ALGmarkselect-crash.test
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

fixed generator.projection for projections of (void) oid-nil (ie resulting from 
outer-joins)


diffs (68 lines):

diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -389,6 +389,7 @@ ALGmarkselect(Client ctx, bat *r1, bat *
                throw(MAL, "algebra.markselect", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
        BUN nr = BATcount(g), q = 0;
+       assert (nr == BATcount(m) && nr == BATcount(p)); 
 
        if ((res1 = COLnew(0, TYPE_oid, nr, TRANSIENT)) == NULL || (res2 = 
COLnew(0, TYPE_bit, nr, TRANSIENT)) == NULL) {
                BBPreclaim(g);
diff --git a/sql/backends/monet5/generator/generator.c 
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -1244,8 +1244,17 @@ VLTgenerator_projection(Client cntxt, Ma
        }
 
        cnt = BATcount(b);
-       if ( b->ttype == TYPE_void)
+       if ( b->ttype == TYPE_void) {
                o = b->tseqbase;
+               if (is_oid_nil(o)) {    
+                       tpe = getArgType(mb,p,1);
+                       BAT *bn = BATconstant(b->hseqbase, tpe, 
ATOMnilptr(tpe), cnt, TRANSIENT);
+                       BBPunfix(b->batCacheid);
+                       *getArgReference_bat(stk,pci,0) = bn->batCacheid;
+                       BBPkeepref(bn);
+                       return MAL_SUCCEED;
+               }
+       }
        else
                ol = (oid*) Tloc(b,0);
 
diff --git a/sql/test/BugTracker-2026/Tests/7815-ALGmarkselect-crash.test 
b/sql/test/BugTracker-2026/Tests/7815-ALGmarkselect-crash.test
--- a/sql/test/BugTracker-2026/Tests/7815-ALGmarkselect-crash.test
+++ b/sql/test/BugTracker-2026/Tests/7815-ALGmarkselect-crash.test
@@ -57,7 +57,9 @@ FROM (
 ) AS x
 
 -- adjusted the query by removing one ( from the 4th line. It now should 
return error:
-statement error GDK reported error: project1_bte: does not match always
+--statement error GDK reported error: project1_bte: does not match always
+query I
+select count(*) from (
 SELECT CAST( CAST( '-0.0' AS NUMERIC ) AS BIGINT )
 FROM (
   SELECT CAST(
@@ -102,7 +104,9 @@ FROM (
     UNION
     SELECT DISTINCT * FROM generate_series( CAST( '616263' AS BIGINT ), 5 )
   )
-) AS x
+) AS x ) as c
+----
+616259
 
 -- Program terminated with signal SIGSEGV, Segmentation fault.
 -- #0  0x00007f641ad953da in ALGmarkselect (ctx=0x35e0b490, r1=0x7f63841e7870, 
r2=0x7f63841e7890, gid=0x7f63841e7670, mid=0x7f63841e77d0, pid=0x7f63841e7830, 
Any=0x7f63841e7750 "\001") at MonetDB/monetdb5/modules/kernel/algebra.c:412
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
@@ -31,5 +31,5 @@ KNOWNFAIL?7801-assertion-failure
 7805-orderby-all-bug
 7806-numeric-no-prec-no-scale
 7813_push_down_topn
-KNOWNFAIL?7815-ALGmarkselect-crash
+7815-ALGmarkselect-crash
 7816-table-returning-function-crash
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to