Changeset: f3e0a5ece36c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f3e0a5ece36c
Modified Files:
        clients/Tests/MAL-signatures-hge.test
        clients/Tests/MAL-signatures.test
Branch: ustr
Log Message:

Merge with default branch.


diffs (287 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -47114,11 +47114,6 @@ command inspect.getAtomSizes():bat[:int]
 INSPECTatom_sizes
 Collect a BAT with the atom sizes.
 inspect
-getAtomSuper
-command inspect.getAtomSuper():bat[:str]
-INSPECTatom_sup_names
-Collect a BAT with the atom names.
-inspect
 getComment
 pattern inspect.getComment(X_0:str, X_1:str):bat[:str]
 INSPECTgetComment
diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -35614,11 +35614,6 @@ command inspect.getAtomSizes():bat[:int]
 INSPECTatom_sizes
 Collect a BAT with the atom sizes.
 inspect
-getAtomSuper
-command inspect.getAtomSuper():bat[:str]
-INSPECTatom_sup_names
-Collect a BAT with the atom names.
-inspect
 getComment
 pattern inspect.getComment(X_0:str, X_1:str):bat[:str]
 INSPECTgetComment
diff --git a/monetdb5/mal/mal_listing.c b/monetdb5/mal/mal_listing.c
--- a/monetdb5/mal/mal_listing.c
+++ b/monetdb5/mal/mal_listing.c
@@ -65,7 +65,7 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk, 
        char *bufend = buf;
        int nameused = 0;
        str tpe;
-       int showtype = 0, closequote = 0;
+       bool showtype = false, closequote = false;
        int varid = getArg(p, idx);
 
        // show the name when required or is used
@@ -105,7 +105,7 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk, 
                        if (!isaBatType(getVarType(mb, varid))
                                && getBatType(getVarType(mb, varid)) >= 
TYPE_date
                                && getBatType(getVarType(mb, varid)) != 
TYPE_str) {
-                               closequote = 1;
+                               closequote = true;
                                bufend = stpcpy(bufend, "\"");
                        }
                        size_t cv_len = strlen(cv);
@@ -123,7 +123,7 @@ renderTerm(MalBlkPtr mb, MalStkPtr stk, 
                        if (closequote) {
                                bufend = stpcpy(bufend, "\"");
                        }
-                       showtype = showtype || closequote > TYPE_str ||
+                       showtype = showtype ||
                                ((isVarTypedef(mb, varid) ||
                                  (flg & (LIST_MAL_REMOTE | LIST_MAL_TYPE))) && 
isVarConstant(mb, varid)) ||
                                (isaBatType(getVarType(mb, varid)) && idx < 
p->retc);
diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c
--- a/monetdb5/modules/kernel/batstr.c
+++ b/monetdb5/modules/kernel/batstr.c
@@ -82,9 +82,9 @@ do_batstr_int(Client cntxt, MalBlkPtr mb
        bool nils = false;
        struct canditer ci1 = { 0 };
        oid off1;
-       bat *res = getArgReference_bat(stk, pci, 0),
-               bid = *getArgReference_bat(stk, pci, 1),
-               *sid1 = pci->argc == 3 ? getArgReference_bat(stk, pci, 2) : 
NULL;
+       bat *res = getArgReference_bat(stk, pci, 0);
+       bat bid = *getArgReference_bat(stk, pci, 1);
+       bat sid = pci->argc == 3 ? *getArgReference_bat(stk, pci, 2) : 0;
 
        (void) cntxt;
        (void) mb;
@@ -93,7 +93,7 @@ do_batstr_int(Client cntxt, MalBlkPtr mb
                                                          SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
-       if (sid1 && !is_bat_nil(*sid1) && !(bs = BATdescriptor(*sid1))) {
+       if (!is_bat_nil(sid) && !(bs = BATdescriptor(sid))) {
                msg = createException(MAL, name,
                                                          SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
diff --git a/monetdb5/modules/mal/calc.c b/monetdb5/modules/mal/calc.c
--- a/monetdb5/modules/mal/calc.c
+++ b/monetdb5/modules/mal/calc.c
@@ -570,7 +570,7 @@ CALCmin(Client cntxt, MalBlkPtr mb, MalS
        if (t != getArgType(mb, pci, 2))
                return mythrow(MAL, "calc.min", SEMANTIC_TYPE_MISMATCH);
        nil = ATOMnilptr(t);
-       if (t >= TYPE_str && ATOMstorage(t) >= TYPE_str) {
+       if (ATOMstorage(t) >= TYPE_str) {
                p1 = *(ptr *) p1;
                p2 = *(ptr *) p2;
        }
@@ -596,7 +596,7 @@ CALCmin_no_nil(Client cntxt, MalBlkPtr m
        if (t != getArgType(mb, pci, 2))
                return mythrow(MAL, "calc.min", SEMANTIC_TYPE_MISMATCH);
        nil = ATOMnilptr(t);
-       if (t >= TYPE_str && ATOMstorage(t) >= TYPE_str) {
+       if (ATOMstorage(t) >= TYPE_str) {
                p1 = *(ptr *) p1;
                p2 = *(ptr *) p2;
        }
@@ -608,7 +608,7 @@ CALCmin_no_nil(Client cntxt, MalBlkPtr m
                        if (t != getArgType(mb, pci, i))
                                return mythrow(MAL, "calc.min", 
SEMANTIC_TYPE_MISMATCH);
                        ptr p2 = getArgReference(stk, pci, i);
-                       if (t >= TYPE_str && ATOMstorage(t) >= TYPE_str)
+                       if (ATOMstorage(t) >= TYPE_str)
                                p2 = *(ptr *) p2;
                        if (ATOMeq(t, p1, nil) ||
                                (!ATOMeq(t, p2, nil) && ATOMcmp(t, p1, p2) > 0))
@@ -633,7 +633,7 @@ CALCmax(Client cntxt, MalBlkPtr mb, MalS
        if (t != getArgType(mb, pci, 2))
                return mythrow(MAL, "calc.max", SEMANTIC_TYPE_MISMATCH);
        nil = ATOMnilptr(t);
-       if (t >= TYPE_str && ATOMstorage(t) >= TYPE_str) {
+       if (ATOMstorage(t) >= TYPE_str) {
                p1 = *(ptr *) p1;
                p2 = *(ptr *) p2;
        }
@@ -692,7 +692,7 @@ CALCmax_no_nil(Client cntxt, MalBlkPtr m
        if (t != getArgType(mb, pci, 2))
                return mythrow(MAL, "calc.max", SEMANTIC_TYPE_MISMATCH);
        nil = ATOMnilptr(t);
-       if (t >= TYPE_str && ATOMstorage(t) >= TYPE_str) {
+       if (ATOMstorage(t) >= TYPE_str) {
                p1 = *(ptr *) p1;
                p2 = *(ptr *) p2;
        }
@@ -704,7 +704,7 @@ CALCmax_no_nil(Client cntxt, MalBlkPtr m
                        if (t != getArgType(mb, pci, i))
                                return mythrow(MAL, "calc.max", 
SEMANTIC_TYPE_MISMATCH);
                        ptr p2 = getArgReference(stk, pci, i);
-                       if (t >= TYPE_str && ATOMstorage(t) >= TYPE_str)
+                       if (ATOMstorage(t) >= TYPE_str)
                                p2 = *(ptr *) p2;
                        if (ATOMeq(t, p1, nil) ||
                                (!ATOMeq(t, p2, nil) && ATOMcmp(t, p1, p2) < 0))
diff --git a/monetdb5/modules/mal/inspect.c b/monetdb5/modules/mal/inspect.c
--- a/monetdb5/modules/mal/inspect.c
+++ b/monetdb5/modules/mal/inspect.c
@@ -525,31 +525,6 @@ INSPECTgetDatabaseName(Client ctx, str *
 }
 
 static str
-INSPECTatom_sup_names(Client ctx, bat *ret)
-{
-       (void) ctx;
-       int i, k;
-       BAT *b = COLnew(0, TYPE_str, 256, TRANSIENT);
-
-       if (b == 0)
-               throw(MAL, "inspect.getAtomSuper", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
-
-       for (i = 0; i < GDKatomcnt; i++) {
-               for (k = ATOMstorage(i); k > TYPE_str; k = ATOMstorage(k)) ;
-               if (BUNappend(b, ATOMname(k), false) != GDK_SUCCEED)
-                       goto bailout;
-       }
-
-       *ret = b->batCacheid;
-       BBPkeepref(b);
-
-       return MAL_SUCCEED;
-  bailout:
-       BBPreclaim(b);
-       throw(MAL, "inspect.getAtomSuper", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-}
-
-static str
 INSPECTatom_sizes(Client ctx, bat *ret)
 {
        (void) ctx;
@@ -671,7 +646,6 @@ static mel_func inspect_init_funcs[] = {
  pattern("inspect", "getType", INSPECTtypeName, false, "Return the concrete 
type of a variable (expression).", args(1,2, arg("",str),argany("v",1))),
  pattern("inspect", "equalType", INSPECTequalType, false, "Return true if both 
operands are of the same type", args(1,3, 
arg("",bit),argany("l",0),argany("r",0))),
  command("inspect", "getAtomNames", INSPECTatom_names, false, "Collect a BAT 
with the atom names.", args(1,1, batarg("",str))),
- command("inspect", "getAtomSuper", INSPECTatom_sup_names, false, "Collect a 
BAT with the atom names.", args(1,1, batarg("",str))),
  command("inspect", "getAtomSizes", INSPECTatom_sizes, false, "Collect a BAT 
with the atom sizes.", args(1,1, batarg("",int))),
  command("inspect", "getEnvironment", INSPECTgetEnvironment, false, "Collect 
the environment variables.", args(2,2, batarg("k",str),batarg("v",str))),
  command("inspect", "getEnvironment", INSPECTgetEnvironmentKey, false, "Get 
the value of an environment variable", args(1,2, arg("",str),arg("k",str))),
diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -305,13 +305,13 @@ OPTpushselectImplementation(Client ctx, 
                                int var = getArg(p, 1);
                                InstrPtr q = mb->stmt[vars[var]];       /* 
BEWARE: the optimizer may not add or remove statements ! */
 
-                               if (q && isLikeOp(q) && 
!isaBatType(getArgType(mb, q, 2)) && isVarConstant(mb, getArg(q, 2)) && /* 
pattern is a value */
+                               if (q && isLikeOp(q) && 
!isaBatType(getArgType(mb, q, 2)) &&
+                                       isVarConstant(mb, getArg(q, 2)) &&      
/* pattern is a value */
                                        isVarConstant(mb, getArg(q, 3)) &&      
/* escape is a value */
                                        isVarConstant(mb, getArg(q, 4)) &&      
/* isensitive flag is a value */
-                                       getArg(q, 0) == getArg(p,
-                                                                               
   1)
+                                       getArg(q, 0) == getArg(p, 1)
                                        /* the output variable from 
batalgebra.like is the input one for [theta]select */
-                                       ) {
+                                  ) {
                                        int has_cand = (getArgType(mb, p, 2) == 
newBatType(TYPE_oid)),
                                                offset = 0, anti = 
(getFunctionId(q)[0] == 'n');
                                        bit ignore_case = *(bit *) 
getVarValue(mb, getArg(q, 4)),
diff --git a/sql/test/BugTracker-2026/Tests/7960-isLikeOp-crash.test 
b/sql/test/BugTracker-2026/Tests/7960-isLikeOp-crash.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7960-isLikeOp-crash.test
@@ -0,0 +1,18 @@
+statement error 42S02!SELECT: no such table 't1'
+SELECT log , COUNT ( * ) FROM t1 GROUP BY log
+ UNION
+SELECT log , n FROM t1 WHERE n = 7 ORDER BY COUNT ( * ) , log
+
+statement error 42000!syntax error, unexpected STRING in: "select null union 
all select null union all select 1 union all select 2 as 'x'"
+SELECT NULL UNION ALL SELECT NULL UNION ALL SELECT 1 UNION ALL SELECT 2 AS 'x' 
ORDER BY x
+
+statement error 22018!conversion of string to type bte failed.
+WITH RECURSIVE x ( x ) AS ( SELECT 1 UNION ALL SELECT x + 1 FROM x WHERE x < 8 
) SELECT x FROM x WHERE x = '<your_schema_name>' AND x = '<your_table_name>' 
AND x = 'YES'
+
+# next query crashes in isLikeOp (p=0x0) at 
monetdb5/optimizer/opt_support.c:462 because p = 0x0
+# It is called from OPTpushselectImplementation (ctx=0x3a647510, 
mb=0x7f6a6c2147f0, stk=0x0, pci=0x7f6a6c14bfd0) at 
monetdb5/optimizer/opt_pushselect.c:308
+statement error 22018!conversion of string to type bte failed.
+SELECT x LIKE '%51%' FROM (
+WITH RECURSIVE x ( x ) AS ( SELECT 1 UNION ALL SELECT x + 1 FROM x WHERE x < 8 
) SELECT x FROM x WHERE x = '<your_schema_name>' AND x = '<your_table_name>' 
AND x = 'YES'
+) AS temp
+
diff --git a/sql/test/BugTracker-2026/Tests/7961-list_empty-crash.test 
b/sql/test/BugTracker-2026/Tests/7961-list_empty-crash.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7961-list_empty-crash.test
@@ -0,0 +1,44 @@
+statement error 42000!SELECT: subquery must return only one column
+SELECT ( 1 , 2 , 3 ) = ( 1 , 2 , 3 )
+
+statement error 42000!SELECT: subquery must return only one column
+SELECT ( 1 , 2 , 3 ) < ( 1 , 2 , 3 )
+
+statement error 42000!SELECT: subquery must return only one column
+SELECT NOT ( ( 1 , 2 , 3 ) = ( 1 , 2 , 3 ) )
+
+statement error 42000!Cannot match a tuple to a single value
+SELECT ( 1 , 2 , 3 ) IN ( ( 1 ) , ( 2 ) , ( 3 ) )
+
+statement error 42000!Subquery has too few columns
+SELECT ( 1 , 2 , 3 ) IN ( SELECT 1 UNION SELECT 2 UNION SELECT 3 )
+
+statement error 42000!SELECT: subquery must return only one column
+SELECT NOT ( ( 1 , 2 , 3 ) = ( 1 , 2 , 3 ) )
+
+statement error 42000!SELECT: subquery must return only one column
+SELECT ( SELECT 1 AS x , 2 AS x , 3 AS x ) = ( SELECT 1 AS x , 2 AS x , 3 AS x 
)
+
+statement error 42000!SELECT: subquery must return only one column
+SELECT ( 1 , 0 , 3 ) = ( 1 , 2 , 3 )
+
+statement error 42000!SELECT: subquery must return only one column
+SELECT ( 1 , 0 , 3 ) != ( 1 , 2 , 3 )
+
+statement error 42000!SELECT: identifier 'x' unknown
+SELECT coalesce ( NULL , 2 , 'b' , COUNT ( - 14 - - CASE - - 1 WHEN - - 82 
THEN - - 23 END / 46 - - not_like ( 'ab#c' , '_b_' , '#' , FALSE ) ^ 52 ) = 0 ) 
GROUP BY cube ( x , x , x ) UNION SELECT 2 AS x UNION SELECT 3 AS x
+
+query T nosort
+SELECT COUNT ( * ) = 0 AS x
+  FROM ( SELECT 1 AS x UNION SELECT 0 AS x UNION SELECT 3 AS x )
+----
+False
+
+query T nosort
+SELECT COUNT ( * ) = 0 AS x
+  FROM ( SELECT 1 AS x UNION SELECT 0 AS x UNION SELECT 3 AS x )
+ WHERE x NOT IN ( SELECT coalesce ( NULL , 2 , 'b' , COUNT ( - 14 - - CASE - - 
1 WHEN - - 82 THEN - - 23 END / 46 - - not_like ( 'ab#c' , '_b_' , '#' , FALSE 
) ^ 52 ) = 0 )
+                   GROUP BY cube ( x , x , x ) UNION SELECT 2 AS x UNION 
SELECT 3 AS x )
+----
+False
+
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
@@ -145,3 +145,5 @@ KNOWNFAIL?7955-rel_setop_get_statistics-
 KNOWNFAIL?7956-rel_remove_const_aggr-crash
 KNOWNFAIL?7957-tail_type-crash
 7959-double-function-destroy
+7960-isLikeOp-crash
+KNOWNFAIL?7961-list_empty-crash
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to