MonetDB: ascii-flag - Merge with default branch.

2024-05-13 Thread Sjoerd Mullender via checkin-list
Changeset: 48157ba5cd44 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/48157ba5cd44
Modified Files:
common/stream/CMakeLists.txt
common/stream/monetdb-stream.pc.in
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 2231 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -826,3 +826,4 @@ dcc8c702e685a4faf21ccf663028d1bc3d1165d1
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release
 9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_9
+9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_SP3_release
diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@
 # This file is updated with Maddlog
 
 * Wed May  8 2024 Sjoerd Mullender 
+- The shared library (.dll aka .so files) now have the version number
+  as part of the name.  This should allow the building of compatibility
+  versions that can be installed in parallel to the latest version.
 - Some of the Debian/Ubuntu packages have been renamed.  The old monetdb5
   names have been changed to plain monetdb, and libmonetdb5-server-*
   packages have been renamed monetdb-*.
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -176,7 +176,7 @@ more client packages.
 %files
 %license COPYING
 %defattr(-,root,root)
-%{_libdir}/libbat.so.*
+%{_libdir}/libbat*.so.*
 
 %package devel
 Summary: MonetDB development files
@@ -202,7 +202,7 @@ functionality of MonetDB.
 %{_includedir}/monetdb/mstring.h
 %exclude %{_includedir}/monetdb/monetdbe.h
 %{_includedir}/monetdb/monet*.h
-%{_libdir}/libbat.so
+%{_libdir}/libbat*.so
 %{_libdir}/pkgconfig/monetdb-gdk.pc
 
 %package stream
@@ -223,7 +223,7 @@ various other components.
 %files stream
 %license COPYING
 %defattr(-,root,root)
-%{_libdir}/libstream.so.*
+%{_libdir}/libstream*.so.*
 
 %package stream-devel
 Summary: MonetDB stream library
@@ -245,7 +245,7 @@ library.
 %files stream-devel
 %defattr(-,root,root)
 %dir %{_includedir}/monetdb
-%{_libdir}/libstream.so
+%{_libdir}/libstream*.so
 %{_includedir}/monetdb/stream.h
 %{_includedir}/monetdb/stream_socket.h
 %{_libdir}/pkgconfig/monetdb-stream.pc
@@ -273,7 +273,7 @@ you will very likely need this package.
 %files client-lib
 %license COPYING
 %defattr(-,root,root)
-%{_libdir}/libmapi.so.*
+%{_libdir}/libmapi*.so.*
 
 %package client
 Summary: MonetDB - Monet Database Management System Client Programs
@@ -298,8 +298,8 @@ MonetDB, you will very likely need this 
 %files client
 %license COPYING
 %defattr(-,root,root)
-%{_bindir}/mclient
-%{_bindir}/msqldump
+%{_bindir}/mclient*
+%{_bindir}/msqldump*
 %{_mandir}/man1/mclient.1*
 %{_mandir}/man1/msqldump.1*
 
@@ -321,7 +321,7 @@ This package contains the files needed t
 %files client-devel
 %defattr(-,root,root)
 %dir %{_includedir}/monetdb
-%{_libdir}/libmapi.so
+%{_libdir}/libmapi*.so
 %{_includedir}/monetdb/mapi*.h
 %{_includedir}/monetdb/msettings.h
 %{_libdir}/pkgconfig/monetdb-mapi.pc
@@ -433,7 +433,7 @@ extensions for %{name}-server.
 
 %files geom
 %defattr(-,root,root)
-%{_libdir}/monetdb5/lib_geom.so
+%{_libdir}/monetdb5*/lib_geom.so
 %endif
 
 %if %{with rintegration}
@@ -457,8 +457,8 @@ install it.
 
 %files R
 %defattr(-,root,root)
-%{_libdir}/monetdb5/rapi.R
-%{_libdir}/monetdb5/lib_rapi.so
+%{_libdir}/monetdb5*/rapi.R
+%{_libdir}/monetdb5*/lib_rapi.so
 %endif
 
 %if %{with py3integration}
@@ -483,7 +483,7 @@ install it.
 
 %files python3
 %defattr(-,root,root)
-%{_libdir}/monetdb5/lib_pyapi3.so
+%{_libdir}/monetdb5*/lib_pyapi3.so
 %endif
 
 %if %{with fits}
@@ -503,7 +503,7 @@ format.
 
 %files cfitsio
 %defattr(-,root,root)
-%{_libdir}/monetdb5/lib_fits.so
+%{_libdir}/monetdb5*/lib_fits.so
 %endif
 
 %package libs
@@ -528,14 +528,14 @@ embedded library (%{name}-embedded).
 
 %files libs
 %defattr(-,root,root)
-%{_libdir}/libmonetdb5.so.*
-%{_libdir}/libmonetdbsql.so*
-%dir %{_libdir}/monetdb5
+%{_libdir}/libmonetdb5*.so.*
+%{_libdir}/libmonetdbsql*.so*
+%dir %{_libdir}/monetdb5%{version}
 %if %{with cintegration}
-%{_libdir}/monetdb5/lib_capi.so
+%{_libdir}/monetdb5*/lib_capi.so
 %endif
-%{_libdir}/monetdb5/lib_csv.so
-%{_libdir}/monetdb5/lib_generator.so
+%{_libdir}/monetdb5*/lib_csv.so
+%{_libdir}/monetdb5*/lib_generator.so
 
 %package server
 Summary: MonetDB - Monet Database Management System
@@ -590,7 +590,7 @@ exit 0
 %attr(2750,monetdb,monetdb) %dir %{_localstatedir}/lib/monetdb
 %attr(2770,monetdb,monetdb) %dir %{_localstatedir}/monetdb5
 %attr(2770,monetdb,monetdb) %dir %{_localstatedir}/monetdb5/dbfarm
-%{_bindir}/mserver5
+%{_bindir}/mserver5*
 %{_mandir}/man1/mserver5.1*
 %dir %{_datadir}/doc/MonetDB
 %docdir %{_datadir}/doc/MonetDB
@@ -618,7 +618,7 @@ used from the MAL level.
 %defattr(-,root,root)
 %{_includedir}/monetdb/mal*.h
 %{_includedir}/monetdb/mel.h
-%{_libdir}/libmonetdb5.so
+%{_libdir}/libmonetdb5*.so
 %{_libdir}/pkgconfig/monetdb5.pc
 
 %package SQL
@@ -653,8 +653,7 @@ configuration.
 
 

MonetDB: ascii-flag - Merge with default branch.

2024-05-13 Thread Sjoerd Mullender via checkin-list
Changeset: a3396b4096a6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a3396b4096a6
Modified Files:
gdk/gdk.h
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 1876 to 300 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Wed May  8 2024 Sjoerd Mullender 
+- Some of the Debian/Ubuntu packages have been renamed.  The old monetdb5
+  names have been changed to plain monetdb, and libmonetdb5-server-*
+  packages have been renamed monetdb-*.
+- The names of some of the provided RPM files have been changed.
+  References to the old MonetDB5 name have been removed.  All packages
+  are now just MonetDB.
+
+* Wed May  8 2024 Niels Nes 
+- Add support for select exp, count(*) group by 1 order by 1; ie. using
+  numeric references Added support for group by all and order by all. The
+  later is ordering on all columns of the selection.  The group by all
+  finds all expressions from the selections which aren't aggregations
+  and groups on those.  All can also be replaced by '*'.
+
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -57,7 +57,7 @@
 # available.  However, the geos library is available in the Extra
 # Packages for Enterprise Linux (EPEL).
 %if %{fedpkgs} && (0%{?rhel} != 7) && (0%{?rhel} != 8)
-# By default create the MonetDB-geom-MonetDB5 package on Fedora and RHEL 7
+# By default create the MonetDB-geom package on Fedora and RHEL 7
 %bcond_without geos
 %endif
 
@@ -154,8 +154,8 @@ BuildRequires: pkgconfig(libR)
 # BuildRequires: pkgconfig(valgrind)# -DWITH_VALGRIND=ON
 
 %if (0%{?fedora} >= 22)
-Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-Recommends: MonetDB5-server%{?_isa} = %{version}-%{release}
+Recommends: %{name}-SQL%{?_isa} = %{version}-%{release}
+Recommends: %{name}-server%{?_isa} = %{version}-%{release}
 Suggests: %{name}-client%{?_isa} = %{version}-%{release}
 %endif
 
@@ -167,8 +167,8 @@ accelerators.  It also has an SQL front 
 
 This package contains the core components of MonetDB in the form of a
 single shared library.  If you want to use MonetDB, you will certainly
-need this package, but you will also need at least the MonetDB5-server
-package, and most likely also %{name}-SQL-server5, as well as one or
+need this package, but you will also need at least the %{name}-server
+package, and most likely also %{name}-SQL, as well as one or
 more client packages.
 
 %ldconfig_scriptlets
@@ -254,8 +254,8 @@ library.
 Summary: MonetDB - Monet Database Management System Client Programs
 Group: Applications/Databases
 %if (0%{?fedora} >= 22)
-Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-Recommends: MonetDB5-server%{?_isa} = %{version}-%{release}
+Recommends: %{name}-SQL%{?_isa} = %{version}-%{release}
+Recommends: %{name}-server%{?_isa} = %{version}-%{release}
 %endif
 
 %description client-lib
@@ -280,8 +280,8 @@ Summary: MonetDB - Monet Database Manage
 Group: Applications/Databases
 Requires: %{name}-client-lib%{?_isa} = %{version}-%{release}
 %if (0%{?fedora} >= 22)
-Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-Recommends: MonetDB5-server%{?_isa} = %{version}-%{release}
+Recommends: %{name}-SQL%{?_isa} = %{version}-%{release}
+Recommends: %{name}-server%{?_isa} = %{version}-%{release}
 %endif
 
 %description client
@@ -368,14 +368,14 @@ fi
 %package client-tests
 Summary: MonetDB Client tests package
 Group: Applications/Databases
-Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
+Requires: %{name}-server%{?_isa} = %{version}-%{release}
 Requires: %{name}-client%{?_isa} = %{version}-%{release}
 Requires: %{name}-client-odbc%{?_isa} = %{version}-%{release}
 %if (0%{?fedora} >= 22)
 Recommends: perl-DBD-monetdb >= 1.0
 Recommends: php-monetdb >= 1.0
 %endif
-Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
+Requires: %{name}-server%{?_isa} = %{version}-%{release}
 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} > 7
 Recommends: python3dist(lz4)
 Recommends: python3dist(scipy)
@@ -414,21 +414,24 @@ developer.
 %{_bindir}/sqlsample.pl
 
 %if %{with geos}
-%package geom-MonetDB5
-Summary: MonetDB5 SQL GIS support module
+%package geom
+Summary: SQL GIS support module for MonetDB
 Group: Applications/Databases
-Requires: MonetDB5-server%{?_isa} = %{version}-%{release}
+Requires: %{name}-server%{?_isa} = %{version}-%{release}
+Obsoletes: MonetDB-geom-MonetDB5 < 11.50.0
+Provides: %{name}-geom-MonetDB5 = %{version}-%{release}
+Provides: %{name}-geom-MonetDB5%{?_isa} = %{version}-%{release}
 
-%description geom-MonetDB5
+%description geom
 MonetDB is a database management system that is developed from a
 main-memory perspective with use of a fully decomposed storage model,
 automatic index management, extensibility of data types and search
 accelerators.  It also has an SQL front end.
 
 This package contains the GIS (Geographic 

MonetDB: ascii-flag - Merge with default branch.

2024-05-07 Thread Sjoerd Mullender via checkin-list
Changeset: 8e2d926b65bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8e2d926b65bf
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 3634 to 300 lines):

diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c
--- a/monetdb5/modules/mal/clients.c
+++ b/monetdb5/modules/mal/clients.c
@@ -479,9 +479,11 @@ CLTqueryTimeout(Client cntxt, MalBlkPtr 
lng timeout_micro = ATOMIC_GET() & FORCEMITOMASK
&& qto == 1 ? 1000 : (lng) qto * 100;
mal_clients[idx].querytimeout = timeout_micro;
-   QryCtx *qry_ctx = MT_thread_get_qry_ctx();
-   if (qry_ctx) {
-   qry_ctx->endtime = qry_ctx->starttime && timeout_micro 
? qry_ctx->starttime + timeout_micro : 0;
+   if (timeout_micro != 1000) {
+   QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+   if (qry_ctx) {
+   qry_ctx->endtime = qry_ctx->starttime && 
timeout_micro ? qry_ctx->starttime + timeout_micro : 0;
+   }
}
}
MT_lock_unset(_contextLock);
diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit 
b/sql/test/emptydb/Tests/check.stable.out.32bit
--- a/sql/test/emptydb/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb/Tests/check.stable.out.32bit
@@ -39,7 +39,7 @@ select 'sys.objects', o.name, case when 
 --  schemas
 select 'default schema of user', s.name, u.name from sys.schemas s, sys.users 
u where s.id = u.default_schema order by s.name, u.name;
 --  tables
-select 'grant on table', t.name, a.name, pc.privilege_code_name, g.name, 
p.grantable from sys._tables t, sys.privileges p left outer join sys.auths g on 
p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = 
pc.privilege_code_id, sys.auths a where t.id = p.obj_id and p.auth_id = a.id 
order by t.name, a.name;
+select 'grant on table', t.name, a.name, pc.privilege_code_name, g.name, 
p.grantable from sys._tables t, sys.privileges p left outer join sys.auths g on 
p.grantor = g.id left outer join sys.privilege_codes pc on p.privileges = 
pc.privilege_code_id, sys.auths a where t.id = p.obj_id and p.auth_id = a.id 
order by t.name, a.name, g.name nulls first;
 --  columns
 select 'grant on column', t.name, c.name, a.name, pc.privilege_code_name, 
g.name, p.grantable from sys._tables t, sys._columns c, sys.privileges p left 
outer join sys.auths g on p.grantor = g.id left outer join sys.privilege_codes 
pc on p.privileges = pc.privilege_code_id, sys.auths a where c.id = p.obj_id 
and c.table_id = t.id and p.auth_id = a.id order by t.name, c.name, a.name;
 --  functions
@@ -433,7 +433,7 @@ select 'null in fkeys.delete_action_id',
 select 'null in fkeys.delete_action', delete_action, * from sys.fkeys where 
delete_action is null;
 % .%1, .s, .,  .,  .s, . # table_name
 % %1,  name,   authorization,  owner,  system, comment # name
-% char,varchar,varchar,varchar,boolean,
varchar # type
+% varchar, varchar,varchar,varchar,boolean,
varchar # type
 % 11,  18, 8,  7,  5,  28 # length
 [ "sys.schemas",   "information_schema",   "monetdb",  "monetdb",  
true,   "ISO/IEC 9075-11 SQL/Schemata"  ]
 [ "sys.schemas",   "json", "monetdb",  "monetdb",  true,   NULL
]
@@ -443,8 +443,8 @@ select 'null in fkeys.delete_action', de
 [ "sys.schemas",   "tmp",  "sysadmin", "monetdb",  true,   NULL
]
 % .%25,.s, .t, .,  .,  .t, .,  .,  . # 
table_name
 % %25, name,   name,   query,  type,   system, commit_action,  access, comment 
# name
-% char,varchar,varchar,char,   varchar,
boolean,char,   char,   varchar # type
-% 11,  18, 34, 6812,   5,  5,  8,  10, 0 # length
+% varchar, varchar,varchar,varchar,varchar,
boolean,varchar,varchar,varchar # type
+% 11,  18, 34, 6812,   5,  5,  8,  8,  0 # length
 [ "sys._tables",   "information_schema",   "character_sets",   "create 
view information_schema.character_sets as select cast(null as varchar(1)) as 
character_set_catalog, cast(null as varchar(1)) as character_set_schema, 
cast('UTF-8' as varchar(16)) as character_set_name, cast('ISO/IEC 10646:2021' 
as varchar(20)) as character_repertoire, cast('UTF-8' as varchar(16)) as 
form_of_use, cast(null as varchar(1)) as default_collate_catalog, cast(null as 
varchar(1)) as default_collate_schema, cast(null as varchar(1)) as 
default_collate_name;",  "VIEW", true,   "COMMIT",   "WRITABLE", NULL   
 ]
 [ "sys._tables",   "information_schema",   "check_constraints","create 
view information_schema.check_constraints as select cast(null as varchar(1)) as 
constraint_catalog, 

MonetDB: ascii-flag - Merge with default branch.

2024-05-07 Thread Sjoerd Mullender via checkin-list
Changeset: 63728d9503e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/63728d9503e3
Modified Files:
clients/Tests/exports.stable.out
monetdb5/modules/atoms/str.c
monetdb5/modules/kernel/batstr.c
monetdb5/modules/mal/pcre.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 4713 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -811,9 +811,9 @@ str QLOGcatalog(BAT **r);
 str QLOGdisable(void *ret);
 str QLOGempty(void *ret);
 str QLOGenable(void *ret);
-str QLOGenableThreshold(void *ret, int *threshold);
+str QLOGenableThreshold(void *ret, const int *threshold);
 int QLOGisset(void);
-str RMTdisconnect(void *ret, str *conn);
+str RMTdisconnect(void *ret, const char *const *conn);
 BUN SQLload_file(Client cntxt, Tablet *as, bstream *b, stream *out, const char 
*csep, const char *rsep, char quote, lng skip, lng maxrow, int best, bool 
from_stdin, const char *tabnam, bool escape);
 str TABLETcollect(BAT **bats, Tablet *as);
 str TABLETcreate_bats(Tablet *as, BUN est);
diff --git a/monetdb5/modules/atoms/batxml.c b/monetdb5/modules/atoms/batxml.c
--- a/monetdb5/modules/atoms/batxml.c
+++ b/monetdb5/modules/atoms/batxml.c
@@ -760,7 +760,7 @@ BATXMLroot(bat *ret, const bat *bid, con
  *standalone);
snprintf(buf + i, len - i, "?>%s", t + 1);
buf++;
-   XMLisdocument(, );/* check 
well-formedness */
+   XMLisdocument(, &(const char *){buf});/* 
check well-formedness */
buf--;
if (!isdoc) {
err = XML_NOT_WELL_FORMED;
diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c
--- a/monetdb5/modules/atoms/blob.c
+++ b/monetdb5/modules/atoms/blob.c
@@ -130,7 +130,7 @@ BLOBnitems_bulk(Client cntxt, MalBlkPtr 
 }
 
 static str
-BLOBtoblob(blob **retval, str *s)
+BLOBtoblob(blob **retval, const char *const *s)
 {
size_t len = strLen(*s);
blob *b = (blob *) GDKmalloc(blobsize(len));
@@ -144,7 +144,7 @@ BLOBtoblob(blob **retval, str *s)
 }
 
 static str
-BLOBblob_blob(blob **d, blob **s)
+BLOBblob_blob(blob **d, const blob *const*s)
 {
size_t len = blobsize((*s)->nitems);
blob *b;
@@ -238,7 +238,7 @@ BLOBblob_blob_bulk(bat *res, const bat *
 }
 
 static str
-BLOBblob_fromstr(blob **b, const char **s)
+BLOBblob_fromstr(blob **b, const char *const*s)
 {
size_t len = 0;
 
diff --git a/monetdb5/modules/atoms/identifier.c 
b/monetdb5/modules/atoms/identifier.c
--- a/monetdb5/modules/atoms/identifier.c
+++ b/monetdb5/modules/atoms/identifier.c
@@ -93,7 +93,7 @@ IDtoString(char **retval, size_t *len, c
  * to parse the string.
  */
 static str
-IDentifier(identifier *retval, str *in)
+IDentifier(identifier *retval, const char *const *in)
 {
size_t len = 0;
 
diff --git a/monetdb5/modules/atoms/inet.c b/monetdb5/modules/atoms/inet.c
--- a/monetdb5/modules/atoms/inet.c
+++ b/monetdb5/modules/atoms/inet.c
@@ -229,7 +229,7 @@ INETtoString(str *retval, size_t *len, c
  * to parse the string.
  */
 static str
-INETnew(inet *retval, str *in)
+INETnew(inet *retval, const char *const *in)
 {
ssize_t pos;
size_t len = sizeof(inet);
@@ -787,7 +787,7 @@ INET_inet(inet *d, const inet *s)
 }
 
 static str
-INET_fromstr(inet *ret, str *s)
+INET_fromstr(inet *ret, const char *const *s)
 {
size_t len = sizeof(inet);
if (INETfromString(*s, , (void **) , false) < 0)
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -233,7 +233,7 @@ JSONtoStorageString(JSON *jt, int idx, j
return msg;
 }
 
-static str JSONstr2json(json *ret, const char **j);
+static str JSONstr2json(json *ret, const char *const*j);
 
 static ssize_t
 JSONfromString(const char *src, size_t *len, void **J, bool external)
@@ -338,7 +338,7 @@ JSONtoString(str *s, size_t *len, const 
 }
 
 static BAT *
-JSONdumpInternal(JSON *jt, int depth)
+JSONdumpInternal(const JSON *jt, int depth)
 {
int i, idx;
JSONterm *je;
@@ -464,7 +464,7 @@ JSONdump(Client cntxt, MalBlkPtr mb, Mal
(void) cntxt;
 
bat *ret = getArgReference_bat(stk, pci, 0);
-   json *val = (json *) getArgReference(stk, pci, 1);
+   const json *val = (json *) getArgReference(stk, pci, 1);
JSON *jt = JSONparse(*val);
 
CHECK_JSON(jt);
@@ -503,7 +503,7 @@ JSON2json(json *ret, const json *j)
 }
 
 static str
-JSONstr2json(json *ret, const char **j)
+JSONstr2json(json *ret, const char *const*j)
 {
str msg = MAL_SUCCEED;
json buf = NULL;
@@ -541,7 +541,7 @@ JSONstr2json(json *ret, const char **j)
 }
 
 static str
-JSONisvalid(bit *ret, 

MonetDB: ascii-flag - Merge with default branch.

2024-05-03 Thread Sjoerd Mullender via checkin-list
Changeset: 2a557cc30013 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2a557cc30013
Modified Files:
gdk/gdk_bat.c
gdk/gdk_bbp.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 2467 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -825,3 +825,4 @@ dcc8c702e685a4faf21ccf663028d1bc3d1165d1
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release
+9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_9
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -91,7 +91,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP2/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP3/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -916,6 +916,25 @@ fi
 %endif
 
 %changelog
+* Thu May 02 2024 Sjoerd Mullender  - 11.49.9-20240502
+- Rebuilt.
+- GH#7422: Aggregate functions with variadic arguments
+- GH#7472: MonetDB server crashes in `tail_type`
+- GH#7473: MonetDB server crashes in `SQLunionfunc`
+- GH#7478: MonetDB server crashes in `exp_equal`
+- GH#7496: Query on view fails to produce a resultset. Assertion triggered
+  in rel2bin_select.
+- GH#7499: create schema + set schema inside a transaction that is rolled
+  back causes the connection to be aborted
+- GH#7501: files remain in backup causing problems at restart
+- GH#7503: MonetDB server crashes using `WHEN MATCHED THEN UPDATE`
+- GH#7504: possible deadlock when a bat is made persistent when it is also
+  getting unloaded
+- GH#7506: MonetDB Dec2023-SP2 crashes at `rel_value_exp2`
+- GH#7507: BBPextend: ERROR: trying to extend BAT pool beyond the limit
+  (16384)
+- GH#7508: MonetDB Dec2023-SP2 crashes at `exp_ref`
+
 * Tue Apr 09 2024 Sjoerd Mullender  - 11.49.7-20240409
 - Rebuilt.
 - GH#7469: Crash when using `CONTAINS`
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1777,6 +1777,11 @@ mapi_new(msettings *settings)
Mapi mid;
static ATOMIC_TYPE index = ATOMIC_VAR_INIT(0);
 
+   if (!ATOMIC_TAS(_initialized)) {
+   if (mnstr_init() < 0)
+   return NULL;
+   }
+
mid = malloc(sizeof(*mid));
if (mid == NULL)
return NULL;
@@ -1885,11 +1890,6 @@ mapi_mapiuri(const char *url, const char
 {
Mapi mid;
 
-   if (!ATOMIC_TAS(_initialized)) {
-   if (mnstr_init() < 0)
-   return NULL;
-   }
-
mid = mapi_new(NULL);
if (mid == NULL)
return NULL;
@@ -1944,11 +1944,6 @@ mapi_mapi(const char *host, int port, co
 {
Mapi mid;
 
-   if (!ATOMIC_TAS(_initialized)) {
-   if (mnstr_init() < 0)
-   return NULL;
-   }
-
mid = mapi_new(NULL);
if (mid == NULL)
return NULL;
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -44,19 +44,19 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M
 # common/options and common/utils)
 set(GDK_VERSION_MAJOR "28")
 set(GDK_VERSION_MINOR "1")
-set(GDK_VERSION_PATCH "2")
+set(GDK_VERSION_PATCH "3")
 set(GDK_VERSION 
"${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}")
 
 # version of the MAPI library (subdirectory clients/mapilib)
 set(MAPI_VERSION_MAJOR "26")
 set(MAPI_VERSION_MINOR "2")
-set(MAPI_VERSION_PATCH "1")
+set(MAPI_VERSION_PATCH "2")
 set(MAPI_VERSION 
"${MAPI_VERSION_MAJOR}.${MAPI_VERSION_MINOR}.${MAPI_VERSION_PATCH}")
 
 # version of the MONETDB5 library (subdirectory monetdb5, not including extras 
or sql)
 set(MONETDB5_VERSION_MAJOR "35")
 set(MONETDB5_VERSION_MINOR "0")
-set(MONETDB5_VERSION_PATCH "3")
+set(MONETDB5_VERSION_PATCH "4")
 set(MONETDB5_VERSION 
"${MONETDB5_VERSION_MAJOR}.${MONETDB5_VERSION_MINOR}.${MONETDB5_VERSION_PATCH}")
 
 # version of the MONETDBE library (subdirectory tools/monetdbe)
@@ -74,5 +74,5 @@ set(STREAM_VERSION "${STREAM_VERSION_MAJ
 # version of the SQL library (subdirectory sql)
 set(SQL_VERSION_MAJOR "14")
 set(SQL_VERSION_MINOR "1")
-set(SQL_VERSION_PATCH "3")
+set(SQL_VERSION_PATCH "4")
 set(SQL_VERSION 
"${SQL_VERSION_MAJOR}.${SQL_VERSION_MINOR}.${SQL_VERSION_PATCH}")
diff --git a/common/utils/GenerateVersionHeader.cmake 
b/common/utils/GenerateVersionHeader.cmake
--- a/common/utils/GenerateVersionHeader.cmake
+++ b/common/utils/GenerateVersionHeader.cmake
@@ -18,34 +18,34 @@ elseif(EXISTS "${DIR}/.hg")
   find_package(Hg)
   if(HG_FOUND)
 message("hg 

MonetDB: ascii-flag - Merge with default branch.

2024-04-26 Thread Sjoerd Mullender via checkin-list
Changeset: 182cc9a91af4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/182cc9a91af4
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_align.c
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_bbp.c
monetdb5/modules/mal/pcre.c
monetdb5/modules/mal/tablet.c
sql/backends/monet5/sql_result.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 9493 to 300 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -48,7 +48,12 @@ jobs:
   ref: ${{ github.ref }}
 
   - name: install pymonetdb cryptography
-run: pip3 install pymonetdb cryptography
+run: pip3 install --user --upgrade pymonetdb cryptography
+if: runner.os != 'macOS'
+
+  - name: install pymonetdb cryptography
+run: pip3 install --user --break-system-packages --upgrade pymonetdb 
cryptography
+if: runner.os == 'macOS'
 
   - name: make MonetDB on linux
 run: |
@@ -83,7 +88,23 @@ jobs:
 -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison \
 -DCMAKE_SUMMARY=ON
   make install -j3
-if: runner.os == 'macOS'
+if: runner.os == 'macOS' && runner.arch == 'x64'
+
+  - name: make MonetDB on macos
+run: |
+  mkdir build
+  cd build 
+  cmake .. \
+-DCMAKE_INSTALL_PREFIX=$HOME/MDB \
+-DPY3INTEGRATION=OFF \
+-DRINTEGRATION=OFF  \
+-DCMAKE_BUILD_TYPE=Release \
+-DASSERT=OFF \
+-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
+-DBISON_EXECUTABLE=/opt/homebrew/opt/bison/bin/bison \
+-DCMAKE_SUMMARY=ON
+  make install -j3
+if: runner.os == 'macOS' && runner.arch == 'arm64'
 
   - name: choco packages
 run: |
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -823,3 +823,5 @@ 1230526af30f40eeea30fb87c47c3e414920561f
 95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 Dec2023_3
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_5
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release
+d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
+d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -91,7 +91,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP1/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP2/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -151,7 +151,6 @@ BuildRequires: pkgconfig(libR)
 # BuildRequires: pkgconfig(gdal)# -DSHP=ON
 # BuildRequires: pkgconfig(netcdf)  # -DNETCDF=ON
 # BuildRequires: pkgconfig(proj)# -DWITH_PROJ=ON
-# BuildRequires: pkgconfig(snappy)  # -DWITH_SNAPPY=ON
 # BuildRequires: pkgconfig(valgrind)# -DWITH_VALGRIND=ON
 
 %if (0%{?fedora} >= 22)
@@ -868,7 +867,6 @@ sed -i 's/1\.2/1.1/' misc/selinux/monetd
 -DWITH_PCRE=ON \
 -DWITH_PROJ=OFF \
 -DWITH_READLINE=ON \
--DWITH_SNAPPY=OFF \
 -DWITH_VALGRIND=OFF \
 -DWITH_XML2=ON \
 -DWITH_ZLIB=ON
@@ -895,9 +893,6 @@ install -d -m 0775 %{buildroot}%{_locals
 install -d -m 0775 %{buildroot}%{_rundir}/monetdb
 
 # remove unwanted stuff
-# .la files
-rm -f %{buildroot}%{_libdir}/*.la
-rm -f %{buildroot}%{_libdir}/monetdb5/*.la
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_opt_sql_append.so
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_microbenchmark*.so
 rm -f %{buildroot}%{_libdir}/monetdb5/lib_udf*.so
@@ -921,6 +916,31 @@ fi
 %endif
 
 %changelog
+* Tue Apr 09 2024 Sjoerd Mullender  - 11.49.7-20240409
+- Rebuilt.
+- GH#7469: Crash when using `CONTAINS`
+- GH#7479: MonetDB server crashes in `exp_ref`
+- GH#7490: commonTerms optimizer no longer works
+- GH#7495: Crash when simultaneously querying and updating a string column.
+
+* Thu Mar 28 2024 Sjoerd Mullender  - 11.49.7-20240409
+- gdk: Threads have their own list of free bats.  The list was not returned
+  to the system when a thread exited, meaning that the free bats that
+  were in the list would not be reused by any thread.  This has been
+  fixed.
+
+* Tue Mar 19 2024 Sjoerd Mullender  - 11.49.7-20240409
+- monetdb5: Fixed interaction between mserver5 and remote mserver5 when only 
one
+  of the two has 128 bit integer support.
+
+* Tue Mar 19 2024 Sjoerd Mullender  - 11.49.7-20240409
+- sql: Fixed issue where equal column aliases were created. When those
+  aliases were parsed on the remote side it could give 

MonetDB: ascii-flag - Merge with default branch.

2024-04-08 Thread Sjoerd Mullender via checkin-list
Changeset: b955590aeba4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b955590aeba4
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_bbp.c
gdk/gdk_string.c
monetdb5/modules/kernel/batstr.c
sql/backends/monet5/sql_result.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 164856 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -679,7 +679,6 @@ This package contains files needed to de
 
 %files SQL-server5-devel
 %defattr(-,root,root)
-%{_includedir}/monetdb/exception_buffer.h
 %{_includedir}/monetdb/opt_backend.h
 %{_includedir}/monetdb/rel_*.h
 %{_includedir}/monetdb/sql*.h
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -187,7 +187,7 @@ def main():
 print(r'')
 print(r'  ')
 id = comp(extend, id, 16,
-  sorted([r'include\monetdb\{}'.format(x) for x in filter(lambda 
x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal') or 
x.startswith('sql') or x.startswith('rel') or x.startswith('store') or 
x.startswith('exception') or x.startswith('opt_backend')) and x.endswith('.h'), 
os.listdir(os.path.join(sys.argv[3], 'include', 'monetdb')))] +
+  sorted([r'include\monetdb\{}'.format(x) for x in filter(lambda 
x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal') or 
x.startswith('sql') or x.startswith('rel') or x.startswith('store') or 
x.startswith('opt_backend')) and x.endswith('.h'), 
os.listdir(os.path.join(sys.argv[3], 'include', 'monetdb')))] +
  [r'include\monetdb\copybinary.h',
   r'include\monetdb\mapi.h',
   r'include\monetdb\mapi_querytype.h',
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
@@ -5,34707 +5,34387 @@ select * from sys.malfunctions() order b
 
 aggr
 Collect
-command aggr.Collect(X_0:bat[:wkb]):wkb 
+command aggr.Collect(X_0:bat[:wkb]):wkb
 wkbCollectAggr;
 TODO
 aggr
 MakeLine
-command aggr.MakeLine(X_0:bat[:wkb]):wkb 
+command aggr.MakeLine(X_0:bat[:wkb]):wkb
 wkbMakeLineAggr;
 Gets a BAT with point or linestring geometries and returns a single linestring 
geometry
 aggr
 all
-command aggr.all(X_0:bat[:any_1]):any_1 
+command aggr.all(X_0:bat[:any_1]):any_1
 SQLall;
 if all values in b are equal return this, else nil
 aggr
 allnotequal
-pattern aggr.allnotequal(X_0:bat[:any_1], X_1:bat[:any_1]):bit 
+pattern aggr.allnotequal(X_0:bat[:any_1], X_1:bat[:any_1]):bit
 SQLallnotequal;
 if all values in r are not equal to l, return true, else if r has nil, return 
nil, else return false
 aggr
 anyequal
-pattern aggr.anyequal(X_0:any_1, X_1:any_1):bit 
+pattern aggr.anyequal(X_0:any_1, X_1:any_1):bit
 CMDvarEQ;
 (empty)
 aggr
 anyequal
-pattern aggr.anyequal(X_0:bat[:any_1], X_1:bat[:any_1]):bit 
+pattern aggr.anyequal(X_0:bat[:any_1], X_1:bat[:any_1]):bit
 SQLanyequal;
 if any value in r is equal to l, return true, else if r has nil, return nil, 
else return false
 aggr
 avg
-command aggr.avg(X_0:bat[:bte], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:bte], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on bte
 aggr
 avg
-command aggr.avg(X_0:bat[:dbl], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:dbl], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on dbl
 aggr
 avg
-command aggr.avg(X_0:bat[:flt], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:flt], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on flt
 aggr
 avg
-command aggr.avg(X_0:bat[:hge], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:hge], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on hge
 aggr
 avg
-command aggr.avg(X_0:bat[:int], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:int], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on int
 aggr
 avg
-command aggr.avg(X_0:bat[:lng], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:lng], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on lng
 aggr
 avg
-command aggr.avg(X_0:bat[:sht], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl] 
+command aggr.avg(X_0:bat[:sht], X_1:bat[:oid], X_2:bat[:any_1]):bat[:dbl]
 AGGRavg13_dbl;
 Grouped tail average on sht
 aggr
 avg
-command aggr.avg(X_0:bat[:bte], X_1:bat[:oid], X_2:bat[:any_1], 
X_3:int):bat[:dbl] 
+command aggr.avg(X_0:bat[:bte], X_1:bat[:oid], X_2:bat[:any_1], 
X_3:int):bat[:dbl]
 AGGRavg14_dbl;
 

MonetDB: ascii-flag - Merge with default branch.

2024-03-29 Thread Sjoerd Mullender via checkin-list
Changeset: c59e436f941c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c59e436f941c
Modified Files:
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_bbp.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 5458 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -808,9 +808,7 @@ do
   /usr/sbin/semodule -s ${selinuxvariant} -i \
 %{_datadir}/selinux/${selinuxvariant}/monetdb.pp &> /dev/null || :
 done
-# use /var/run/monetdb since that's what it says in the monetdb.fc file
-# it says that because /run/monetdb for some reason doesn't work
-/sbin/restorecon -R %{_localstatedir}/monetdb5 %{_localstatedir}/log/monetdb 
/var/run/monetdb %{_bindir}/monetdbd %{_bindir}/mserver5 
%{_unitdir}/monetdbd.service &> /dev/null || :
+/sbin/restorecon -R %{_localstatedir}/monetdb5 %{_localstatedir}/log/monetdb 
%{_rundir}/monetdb %{_bindir}/monetdbd %{_bindir}/mserver5 
%{_unitdir}/monetdbd.service &> /dev/null || :
 /usr/bin/systemctl try-restart monetdbd.service
 
 %postun selinux
@@ -839,6 +837,13 @@ fi
 %setup -q
 
 %build
+# from Fedora 40, selinux uses /run where before it used /var/run
+# the code is now for Fedora 40 but needs a patch for older versions
+%if (0%{?fedora} < 40)
+sed -i 
's;@CMAKE_INSTALL_FULL_RUNSTATEDIR@/monetdb;@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/run/monetdb;'
 misc/selinux/monetdb.fc.in
+sed -i 's/1\.2/1.1/' misc/selinux/monetdb.te
+%endif
+
 %cmake3 \
 -DCMAKE_INSTALL_RUNSTATEDIR=/run \
 -DRELEASE_VERSION=ON \
diff --git a/gdk/ChangeLog b/gdk/ChangeLog
--- a/gdk/ChangeLog
+++ b/gdk/ChangeLog
@@ -1,6 +1,14 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Tue Mar 26 2024 Sjoerd Mullender 
+- Made some changes to how BAT descriptors are allocated.  They are now
+  allocated in bulk, meaning fewer malloc/free calls during processing.
+- Removed macro BBP_cache and its associated code.  Checking whether a
+  BAT is cached (loaded in memory) can be done by checking the BBPLOADED
+  bit in the BBP_status value.  Getting a pointer to the BAT descriptor
+  can be done by using BBP_desc.
+
 * Tue Feb  6 2024 Sjoerd Mullender 
 - The SQL transaction ID is no longer saved in the BBP.dir file.
 
diff --git a/gdk/ChangeLog.Dec2023 b/gdk/ChangeLog.Dec2023
--- a/gdk/ChangeLog.Dec2023
+++ b/gdk/ChangeLog.Dec2023
@@ -1,6 +1,12 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Thu Mar 28 2024 Sjoerd Mullender 
+- Threads have their own list of free bats.  The list was not returned
+  to the system when a thread exited, meaning that the free bats that
+  were in the list would not be reused by any thread.  This has been
+  fixed.
+
 * Mon Mar 18 2024 Sjoerd Mullender 
 - Fixed a couple of deadlock situations, one actually observed, one
   never observed.
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -958,10 +958,9 @@ gdk_export void HEAPincref(Heap *h);
  * field.
  */
 typedef struct {
-   BAT *cache; /* if loaded: BAT* handle */
char *logical;  /* logical name (may point at bak) */
char bak[16];   /* logical name backup (tmp_%o) */
-   BAT *desc;  /* the BAT descriptor */
+   BAT descr;  /* the BAT descriptor */
char *options;  /* A string list of options */
 #if SIZEOF_VOID_P == 4
char physical[20];  /* dir + basename for storage */
@@ -995,19 +994,18 @@ gdk_export BBPrec *BBP[N_BBPINIT];
 
 /* fast defines without checks; internal use only  */
 #define BBP_record(i)  BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)]
-#define BBP_cache(i)   BBP_record(i).cache
 #define BBP_logical(i) BBP_record(i).logical
 #define BBP_bak(i) BBP_record(i).bak
 #define BBP_next(i)BBP_record(i).next
 #define BBP_physical(i)BBP_record(i).physical
 #define BBP_options(i) BBP_record(i).options
-#define BBP_desc(i)BBP_record(i).desc
+#define BBP_desc(i)(_record(i).descr)
 #define BBP_refs(i)BBP_record(i).refs
 #define BBP_lrefs(i)   BBP_record(i).lrefs
 #define BBP_status(i)  ((unsigned) ATOMIC_GET(_record(i).status))
 #define BBP_pid(i) BBP_record(i).pid
 #define BATgetId(b)BBP_logical((b)->batCacheid)
-#define BBPvalid(i)(BBP_logical(i) != NULL && *BBP_logical(i) != '.')
+#define BBPvalid(i)(BBP_logical(i) != NULL)
 
 #define BBPRENAME_ALREADY  (-1)
 #define BBPRENAME_ILLEGAL  (-2)
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3675,7 +3675,6 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
if ((pb == NULL || bi.count == BATcount(pb)) &&
BATcheckimprints(b)) {
if (pb != NULL) {
-   BAT *pb = 
BBP_cache(VIEWtparent(b));
MT_lock_set(>batIdxLock);
  

MonetDB: ascii-flag - Merge with default branch.

2024-03-22 Thread Sjoerd Mullender via checkin-list
Changeset: f5d791884514 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f5d791884514
Removed Files:
monetdb5/modules/atoms/Tests/asciify.test
monetdb5/modules/atoms/Tests/endswith.test
monetdb5/modules/kernel/Tests/batstr_asciify.test
Modified Files:
monetdb5/modules/atoms/Tests/All
monetdb5/modules/kernel/Tests/All
sql/test/strings/Tests/All
sql/test/strings/Tests/asciify.test
sql/test/strings/Tests/batstr_asciify.test
sql/test/strings/Tests/endswith.test
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 1030 to 300 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1206,6 +1206,9 @@ BATrange(BATiter *bi, const void *tl, co
if (tl == NULL && th == NULL)
return range_contains; /* looking for everything */
 
+   if (VIEWtparent(bi->b))
+   pb = BATdescriptor(VIEWtparent(bi->b));
+
/* keep locked while we look at the property values */
MT_lock_set(>b->theaplock);
if (bi->minpos != BUN_NONE)
@@ -1221,8 +1224,7 @@ BATrange(BATiter *bi, const void *tl, co
}
bool keep = false;  /* keep lock on parent bat? */
if (minprop == NULL || maxprop == NULL) {
-   if (VIEWtparent(bi->b) &&
-   (pb = BATdescriptor(VIEWtparent(bi->b))) != NULL) {
+   if (pb != NULL) {
MT_lock_set(>theaplock);
if (minprop == NULL && (minprop = BATgetprop_nolock(pb, 
GDK_MIN_BOUND)) != NULL) {
keep = true;
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -280,15 +280,16 @@ dump_threads(void)
char buf[1024];
thread_lock();
for (struct mtthread *t = mtthreads; t; t = t->next) {
+   MT_Lock *lk = t->lockwait;
+   MT_Sema *sm = t->semawait;
+   MT_Cond *cn = t->condwait;
+   struct mtthread *jn = t->joinwait;
int pos = snprintf(buf, sizeof(buf),
-  "%s, tid %zu, waiting for %s, working on 
%.200s",
+  "%s, tid %zu, waiting for %s%s, working on 
%.200s",
   t->threadname,
   t->tid,
-  t->lockwait ? t->lockwait->name :
-  t->semawait ? t->semawait->name :
-  t->condwait ? t->condwait->name :
-  t->joinwait ? t->joinwait->threadname :
-  "nothing",
+  lk ? "lock " : sm ? "semaphore " : cn ? 
"condvar " : jn ? "thread " : "",
+  lk ? lk->name : sm ? sm->name : cn ? 
cn->name : jn ? jn->threadname : "nothing",
   ATOMIC_GET(>exited) ? "exiting" :
   t->working ? t->working : "nothing");
 #ifdef LOCK_OWNER
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -498,7 +498,6 @@ typedef struct MT_Lock {
 
 #define MT_lock_try(l) (pthread_mutex_trylock(&(l)->lock) == 0 && 
(_DBG_LOCK_LOCKER(l), true))
 
-#ifdef LOCK_STATS
 #define MT_lock_set(l) \
do {\
_DBG_LOCK_COUNT_0(l);   \
@@ -511,14 +510,6 @@ typedef struct MT_Lock {
_DBG_LOCK_LOCKER(l);\
_DBG_LOCK_COUNT_2(l);   \
} while (0)
-#else
-#define MT_lock_set(l) \
-   do {\
-   pthread_mutex_lock(&(l)->lock); \
-   _DBG_LOCK_LOCKER(l);\
-   } while (0)
-#endif
-
 #define MT_lock_unset(l)   \
do {\
_DBG_LOCK_UNLOCKER(l);  \
diff --git a/monetdb5/modules/atoms/Tests/All b/monetdb5/modules/atoms/Tests/All
--- a/monetdb5/modules/atoms/Tests/All
+++ b/monetdb5/modules/atoms/Tests/All
@@ -33,13 +33,3 @@ jsonrender
 
 uuid00
 strappend
-
-startswith
-endswith
-contains
-asciify
-startswith_join
-endswith_join
-contains_join
-
-ts_and_tstz_to_str_bug
diff --git a/monetdb5/modules/kernel/Tests/All 
b/monetdb5/modules/kernel/Tests/All
--- a/monetdb5/modules/kernel/Tests/All
+++ b/monetdb5/modules/kernel/Tests/All
@@ -3,8 +3,3 @@ TriBool
 batstr
 math
 select
-
-batstr_asciify
-batstr_startswith
-batstr_endswith
-batstr_contains
diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All
--- a/monetdb5/modules/mal/Tests/All
+++ b/monetdb5/modules/mal/Tests/All
@@ -52,6 +52,3 @@ orderidx00
 

MonetDB: ascii-flag - Merge with default branch.

2024-03-19 Thread Sjoerd Mullender via checkin-list
Changeset: ed974500fda7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ed974500fda7
Modified Files:
gdk/gdk.h
gdk/gdk_bat.c
gdk/gdk_batop.c
gdk/gdk_project.c
gdk/gdk_string.c
monetdb5/modules/atoms/str.c
monetdb5/modules/mal/pcre.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 1835 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -822,3 +822,4 @@ 1230526af30f40eeea30fb87c47c3e414920561f
 1230526af30f40eeea30fb87c47c3e414920561f Dec2023_release
 95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 Dec2023_3
 dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_5
+dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_SP1_release
diff --git a/clients/odbc/driver/README b/clients/odbc/driver/README
--- a/clients/odbc/driver/README
+++ b/clients/odbc/driver/README
@@ -19,12 +19,8 @@ ODBC is chosen to be implemented first b
 - it can be implemented as a C library (same programming language as MonetDB)
 - its driver manager is available on all platforms where MonetDB is ported
   (on UNIX/Linux we use unixODBC as the driver manager)
-- there are JDBC-ODBC bridge drivers available (i.e. Sun) which provide
-  a JDBC driver implementation on top of an ODBC driver. This is not
-  optimal for performance and stability but we don't have to build it
-  ourselves to get this functionality now.
-Update 2016: the JDBC-ODBC bridge driver is no longer needed nor supported in 
JRE.
-We provide a 100% pure (type 4) JDBC driver implementation for MonetDB.
+
+Since 2009 we also provide a 100% pure (type 4) JDBC driver implementation for 
MonetDB.
 See: https://www.monetdb.org/downloads/Java/
 
 Tip:
@@ -40,7 +36,7 @@ For compilation you need the ODBC API in
sqlext.h/* ODBC extension (level 1 and 2) API functions */
sqlucode.h  /* Unicode versions of the ODBC API functions */
 We use the ones distributed with unixODBC.
-At CWI these are located in /usr/include/
+On Linux these are located in /usr/include/
 
 
 Files organization (in clients/odbc/driver/*):
@@ -68,8 +64,7 @@ In the implementation section below it i
 For convenience there is also an ODBCUtil.[ch] which contains
  general ODBC specific utility functions.
 
-Of course there is a Makefile. Because we use autoconf and automake
-the source file is Makefile.ag.
+We use CMake, so there is a CMakeLists.txt file.
 
 Lastly there is this README documentation file:
 
@@ -86,10 +81,9 @@ be defined before the ODBC header files 
 In ODBC the API functions can be grouped in several ways:
 a) ODBC 1 or 2 API compliance (Core, extension level 1, extension level 2)
 b) ODBC 3 API compliance (ISO 92, X/Open, ODBC, Deprecated)
-c) handle type (environment, connection, statement, descriptor)
-I chose to use the handle type organization and created new files
-ODBC*[ch] to define the structs and functions for the first three handle
-types. Descriptor handles are currently not supported.
+c) handle type (Environment, Connection, Statement, Descriptor)
+We chose to use the handle type organization and created new files
+ODBC*[ch] to define the structs and functions for the handle types.
 
 In ODBC multiple environments (each application uses its own environment),
  multiple database connections (an application can open multiple database
@@ -193,8 +187,9 @@ The next ODBC API functions always retur
 - SQLPutData()
 - SQLGetCursorName()
 - SQLSetCursorName()
-- SQLSetScrollOptions()
-- SQLSetParam()  It is mapped to SQLBindParameter(..., 
SQL_PARAM_INPUT_OUTPUT, ...).
+- SQLSetScrollOptions()deprecated in ODBC 3.0 (replaced by SQLSetStmtAttr()
+- SQLSetParam()  It is mapped to SQLBindParameter(..., 
SQL_PARAM_INPUT_OUTPUT, ...)
+ which will return SQL_ERROR, Output parameters are not 
supported.
 - SQLDrivers()   Note on MS Windows this is implemented by the ODBC Driver 
Manager
 - SQLDataSources()   Note on MS Windows this is implemented by the ODBC Driver 
Manager
 
@@ -228,5 +223,5 @@ Most important are:
 
 TODO 2) No performance analysis or tuning is done yet.
  On the ODBC level not much performance tuning can be done as ODBC is
- a thin wrapper around the Monet SQL frontend API.
+ a thin wrapper around the MonetDB mapi protocol API.
 
diff --git a/gdk/ChangeLog.Dec2023 b/gdk/ChangeLog.Dec2023
--- a/gdk/ChangeLog.Dec2023
+++ b/gdk/ChangeLog.Dec2023
@@ -1,3 +1,7 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Mon Mar 18 2024 Sjoerd Mullender 
+- Fixed a couple of deadlock situations, one actually observed, one
+  never observed.
+
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2388,10 +2388,10 @@ gdk_export BAT *BATsample_with_seed(BAT 
 static inline void
 TIMEOUT_ERROR(QryCtx *qc, const char *file, const char *func, int lineno)
 {
-   if (GDKexiting())
+   if (GDKexiting()) {
GDKtracer_log(file, func, lineno, M_ERROR, GDK, NULL,

MonetDB: ascii-flag - Merge with default branch.

2024-03-13 Thread Sjoerd Mullender via checkin-list
Changeset: 8ed6141e4936 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8ed6141e4936
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 834 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -821,3 +821,4 @@ c9e6096e7519636a4e840c7a0c2e27cccb7dc0fe
 1230526af30f40eeea30fb87c47c3e414920561f Dec2023_1
 1230526af30f40eeea30fb87c47c3e414920561f Dec2023_release
 95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 Dec2023_3
+dcc8c702e685a4faf21ccf663028d1bc3d1165d1 Dec2023_5
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -917,6 +917,26 @@ fi
 %endif
 
 %changelog
+* Tue Mar 12 2024 Sjoerd Mullender  - 11.49.5-20240312
+- Rebuilt.
+- GH#7390: Some MonetDB Server crashes found
+- GH#7465: Unexpected result when using `NULL` in `BETWEEN`
+
+* Fri Mar  8 2024 Sjoerd Mullender  - 11.49.5-20240312
+- gdk: The internal hash function for floating point types has been changed.
+  It is now no longer based on the bit representation, but on the value,
+  meaning that +0 and -0 (yes, they both exist in floating point) now
+  hash to the same value.
+
+* Thu Mar  7 2024 Lucas Pereira  - 
11.49.5-20240312
+- sql: performance improvement of 'startswith' and 'endswith' filter functions
+  for join operators
+
+* Wed Mar  6 2024 Sjoerd Mullender  - 11.49.5-20240312
+- clients: Fixed an issue where mclient wouldn't exit if the server it had
+  connected to exited for whatever reason while the client was waiting
+  for a query result.
+
 * Mon Mar 04 2024 Sjoerd Mullender  - 11.49.3-20240304
 - Rebuilt.
 - GH#6800: Please add information_schema (ANSI SQL norm)
diff --git a/clients/ChangeLog-Archive b/clients/ChangeLog-Archive
--- a/clients/ChangeLog-Archive
+++ b/clients/ChangeLog-Archive
@@ -1,6 +1,11 @@
 # DO NOT EDIT THIS FILE -- MAINTAINED AUTOMATICALLY
 # This file contains past ChangeLog entries
 
+* Wed Mar  6 2024 Sjoerd Mullender  - 11.49.5-20240312
+- Fixed an issue where mclient wouldn't exit if the server it had
+  connected to exited for whatever reason while the client was waiting
+  for a query result.
+
 * Tue Jun 20 2023 Sjoerd Mullender  - 11.47.3-20230622
 - The COPY INTO from file ON CLIENT was extended to also look for a
   relative path name relative to the file from which the query was read.
diff --git a/clients/ChangeLog.Dec2023 b/clients/ChangeLog.Dec2023
--- a/clients/ChangeLog.Dec2023
+++ b/clients/ChangeLog.Dec2023
@@ -1,8 +1,3 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
-* Wed Mar  6 2024 Sjoerd Mullender 
-- Fixed an issue where mclient wouldn't exit if the server it had
-  connected to exited for whatever reason while the client was waiting
-  for a query result.
-
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -44,19 +44,19 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M
 # common/options and common/utils)
 set(GDK_VERSION_MAJOR "28")
 set(GDK_VERSION_MINOR "1")
-set(GDK_VERSION_PATCH "0")
+set(GDK_VERSION_PATCH "1")
 set(GDK_VERSION 
"${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}")
 
 # version of the MAPI library (subdirectory clients/mapilib)
 set(MAPI_VERSION_MAJOR "26")
 set(MAPI_VERSION_MINOR "2")
-set(MAPI_VERSION_PATCH "0")
+set(MAPI_VERSION_PATCH "1")
 set(MAPI_VERSION 
"${MAPI_VERSION_MAJOR}.${MAPI_VERSION_MINOR}.${MAPI_VERSION_PATCH}")
 
 # version of the MONETDB5 library (subdirectory monetdb5, not including extras 
or sql)
 set(MONETDB5_VERSION_MAJOR "35")
 set(MONETDB5_VERSION_MINOR "0")
-set(MONETDB5_VERSION_PATCH "1")
+set(MONETDB5_VERSION_PATCH "2")
 set(MONETDB5_VERSION 
"${MONETDB5_VERSION_MAJOR}.${MONETDB5_VERSION_MINOR}.${MONETDB5_VERSION_PATCH}")
 
 # version of the MONETDBE library (subdirectory tools/monetdbe)
@@ -74,5 +74,5 @@ set(STREAM_VERSION "${STREAM_VERSION_MAJ
 # version of the SQL library (subdirectory sql)
 set(SQL_VERSION_MAJOR "14")
 set(SQL_VERSION_MINOR "1")
-set(SQL_VERSION_PATCH "1")
+set(SQL_VERSION_PATCH "2")
 set(SQL_VERSION 
"${SQL_VERSION_MAJOR}.${SQL_VERSION_MINOR}.${SQL_VERSION_PATCH}")
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,35 @@
+monetdb (11.49.5) unstable; urgency=low
+
+  * Rebuilt.
+  * GH#7390: Some MonetDB Server crashes found
+  * GH#7465: Unexpected result when using `NULL` in `BETWEEN`
+
+ -- Sjoerd Mullender   Tue, 12 Mar 2024 10:20:32 +0100
+
+monetdb (11.49.5) unstable; urgency=low
+
+  * gdk: The internal hash function for floating point types has been changed.
+It is now no longer based on the bit representation, but on the value,
+meaning that +0 and -0 (yes, they both exist in floating point) now
+hash to the same value.
+
+ -- Sjoerd Mullender   Fri, 8 Mar 2024 10:20:32 +0100
+
+monetdb (11.49.5) unstable; urgency=low
+
+  * sql: performance improvement of 'startswith' and 'endswith' filter 
functions
+for join operators
+
+ 

MonetDB: ascii-flag - Merge with default branch.

2024-03-08 Thread Sjoerd Mullender via checkin-list
Changeset: cb725a3ee930 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cb725a3ee930
Modified Files:
monetdb5/modules/atoms/str.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (12 lines):

diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -815,6 +815,8 @@ str_is_isuffix(const char *s, const char
;
}
}
+   while ((*sf & 0xC0) == 0x80)
+   sf++;
return *sf != 0 || GDKstrcasecmp(e, suffix) != 0;
 }
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: ascii-flag - Merge with default branch.

2024-03-08 Thread Sjoerd Mullender via checkin-list
Changeset: f4a4f1e76e62 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f4a4f1e76e62
Modified Files:
monetdb5/modules/atoms/str.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (207 lines):

diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -799,41 +799,45 @@ str_is_suffix(const char *s, const char 
return strcmp(s + sl - sul, suffix);
 }
 
+/* case insensitive endswith check */
 int
 str_is_isuffix(const char *s, const char *suffix, int sul)
 {
-   int sl = str_strlen(s);
-
-   if (sl < sul)
-   return -1;
-   else
-   return GDKstrcasecmp(s + sl - sul, suffix);
+   const char *e = s + strlen(s);
+   const char *sf;
+
+   (void) sul;
+   /* note that the uppercase and lowercase forms of a character aren't
+* necessarily the same length in their UTF-8 encodings */
+   for (sf = suffix; *sf && e > s; sf++) {
+   if ((*sf & 0xC0) != 0x80) {
+   while ((*--e & 0xC0) == 0x80)
+   ;
+   }
+   }
+   return *sf != 0 || GDKstrcasecmp(e, suffix) != 0;
 }
 
 int
 str_contains(const char *h, const char *n, int nlen)
 {
(void) nlen;
-   /* 64bit: should return lng */
-   return strstr(h, n) ? 0 : 1;
+   return strstr(h, n) == NULL;
 }
 
 int
 str_icontains(const char *h, const char *n, int nlen)
 {
(void) nlen;
-   /* 64bit: should return lng */
-   return GDKstrcasestr(h, n) ? 0 : 1;
+   return GDKstrcasestr(h, n) == NULL;
 }
 
-#define STR_MAPARGS(STK, PCI, R, S1, S2, ICASE)
\
-   do{ 
\
-   R = getArgReference(STK, PCI, 0);   
\
-   S1 = *getArgReference_str(STK, PCI, 1); 
\
-   S2 = *getArgReference_str(STK, PCI, 2); 
\
-   icase = PCI->argc == 4 &&   
\
-   *getArgReference_bit(STK, PCI, 3) ? true : false;   
\
-   
\
+#define STR_MAPARGS(STK, PCI, R, S1, S2, ICASE)
\
+   do{ 
\
+   R = getArgReference(STK, PCI, 0);   
\
+   S1 = *getArgReference_str(STK, PCI, 1); 
\
+   S2 = *getArgReference_str(STK, PCI, 2); 
\
+   icase = PCI->argc == 4 && *getArgReference_bit(STK, PCI, 3);
\
} while(0)
 
 static str
@@ -932,8 +936,7 @@ STRstr_search(Client cntxt, MalBlkPtr mb
bit *res = getArgReference(stk, pci, 0);
const str *haystack = getArgReference(stk, pci, 1),
*needle = getArgReference(stk, pci, 2);
-   bit icase = pci->argc == 4
-   && *getArgReference_bit(stk, pci, 3) ? true : false;
+   bit icase = pci->argc == 4 && *getArgReference_bit(stk, pci, 3);
str s = *haystack, h = *needle, msg = MAL_SUCCEED;
if (strNil(s) || strNil(h)) {
*res = bit_nil;
@@ -988,8 +991,7 @@ STRrevstr_search(Client cntxt, MalBlkPtr
int *res = getArgReference_int(stk, pci, 0);
const str haystack = *getArgReference_str(stk, pci, 1);
const str needle = *getArgReference_str(stk, pci, 2);
-   bit icase = pci->argc == 4
-   && *getArgReference_bit(stk, pci, 3) ? true : false;
+   bit icase = pci->argc == 4 && *getArgReference_bit(stk, pci, 3);
 
if (strNil(haystack) || strNil(needle)) {
*res = bit_nil;
@@ -2205,9 +2207,9 @@ str_select(BAT *bn, BAT *b, BAT *s, stru
qry_ctx = qry_ctx ? qry_ctx : &(QryCtx) {.endtime = 0};
 
if (anti)   /* keep nulls ? (use 
false for now) */
-   scanloop_anti(v && *v != '\200' && str_cmp(v, key, klen) != 0, 
keep_nulls);
+   scanloop_anti(!strNil(v) && str_cmp(v, key, klen) != 0, 
keep_nulls);
else
-   scanloop(v && *v != '\200' && str_cmp(v, key, klen) == 0, 
keep_nulls);
+   scanloop(!strNil(v) && str_cmp(v, key, klen) == 0, keep_nulls);
 
   bailout:
bat_iterator_end();
@@ -2334,8 +2336,8 @@ STRselect(bat *r_id, const bat *b_id, co
B_ID = getArgReference(STK, PCI, 1);

MonetDB: ascii-flag - Merge with default branch.

2024-03-08 Thread Sjoerd Mullender via checkin-list
Changeset: d9691b2657a4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d9691b2657a4
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
monetdb5/modules/atoms/str.c
monetdb5/modules/atoms/str.h
monetdb5/modules/kernel/batstr.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 5629 to 300 lines):

diff --git a/clients/ChangeLog.Dec2023 b/clients/ChangeLog.Dec2023
--- a/clients/ChangeLog.Dec2023
+++ b/clients/ChangeLog.Dec2023
@@ -1,3 +1,8 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Mar  6 2024 Sjoerd Mullender 
+- Fixed an issue where mclient wouldn't exit if the server it had
+  connected to exited for whatever reason while the client was waiting
+  for a query result.
+
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
@@ -50692,17 +50692,7 @@ str
 contains
 pattern str.contains(X_0:str, X_1:str, X_2:bit):bit 
 STRcontains;
-Check if string chaystack contains string needle, icase flag.
-str
-containsjoin
-pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] 
-STRcontainsjoin1;
-The same as STRcontainsjoin, but only produce one output + icase.
-str
-containsjoin
-pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] 
-STRcontainsjoin1;
-The same as STRcontainsjoin, but only produce one output.
+Check if string haystack contains string needle, icase flag.
 str
 containsjoin
 pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit) (X_8:bat[:oid], 
X_9:bat[:oid]) 
@@ -50710,10 +50700,20 @@ STRcontainsjoin;
 Join the string bat L with the bat R if L contains the string of R@with 
optional candidate lists SL and SR@The result is two aligned bats with oids of 
matching rows + icase.
 str
 containsjoin
+pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] 
+STRcontainsjoin;
+The same as STRcontainsjoin, but only produce one output + icase.
+str
+containsjoin
 pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit) (X_7:bat[:oid], X_8:bat[:oid]) 
 STRcontainsjoin;
 Join the string bat L with the bat R if L contains the string of R@with 
optional candidate lists SL and SR@The result is two aligned bats with oids of 
matching rows.
 str
+containsjoin
+pattern str.containsjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] 
+STRcontainsjoin;
+The same as STRcontainsjoin, but only produce one output.
+str
 containsselect
 pattern str.containsselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, 
X_3:bit):bat[:oid] 
 STRcontainsselect;
@@ -50735,25 +50735,25 @@ STRendswith;
 Check if string ends with substring, icase flag.
 str
 endswithjoin
-pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] 
-STRendswithjoin1;
-The same as STRendswithjoin, but only produce one output + icase.
-str
-endswithjoin
-pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] 
-STRendswithjoin1;
-The same as STRendswithjoin, but only produce one output.
-str
-endswithjoin
 pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit) (X_8:bat[:oid], 
X_9:bat[:oid]) 
 STRendswithjoin;
 Join the string bat L with the suffix bat R@with optional candidate lists SL 
and SR@The result is two aligned bats with oids of matching rows + icase.
 str
 endswithjoin
+pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:bit], 
X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] 
+STRendswithjoin;
+The same as STRendswithjoin, but only produce one output + icase.
+str
+endswithjoin
 pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit) (X_7:bat[:oid], X_8:bat[:oid]) 
 STRendswithjoin;
 Join the string bat L with the suffix bat R@with optional candidate lists SL 
and SR@The result is two aligned bats with oids of matching rows.
 str
+endswithjoin
+pattern str.endswithjoin(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid], X_4:bit, X_5:lng, X_6:bit):bat[:oid] 
+STRendswithjoin;
+The same as STRendswithjoin, but only produce one output.
+str
 endswithselect
 pattern str.endswithselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, 
X_3:bit):bat[:oid] 
 STRendswithselect;
@@ -50900,25 +50900,25 @@ STRstartswith;
 Check if string starts with substring, icase flag.
 str
 

MonetDB: ascii-flag - Merge with default branch.

2024-03-06 Thread Sjoerd Mullender via checkin-list
Changeset: de7d55f07cb0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/de7d55f07cb0
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 2888 to 300 lines):

diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -1,3 +1,12 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Mar  6 2024 Yunus Koning 
+- SQL2023 feature: Introduce UNIQUE NULLS [NOT] DISTINCT syntax which
+  allows for NULLS to be treated as unique, i.e. a column with this
+  contraint can have one NULL value at most.
+
+- SQL2023 feature: Allow project and ORDER BY expressions on
+  UNIQUE constrained columns when the primary key column is
+  used in a GROUP BY expression.
+
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
@@ -4654,7 +4654,9 @@ insert_check_ukey(backend *be, list *ins
stmt_add_column_predicate(be, c->c);
 
col = stmt_col(be, c->c, dels, dels->partition);
-   if ((k->type == ukey) && stmt_has_null(col)) {
+   if (k->type == unndkey)
+   s = stmt_uselect(be, col, cs, 
cmp_equal, s, 0, 1);
+   else if ((k->type == ukey) && 
stmt_has_null(col)) {
stmt *nn = stmt_selectnonil(be, col, s);
s = stmt_uselect(be, col, cs, 
cmp_equal, nn, 0, 0);
} else {
@@ -4679,7 +4681,7 @@ insert_check_ukey(backend *be, list *ins
list_append(lje, col);
list_append(rje, cs);
}
-   s = releqjoin(be, lje, rje, NULL, 1 /* hash used */, 0, 
0);
+   s = releqjoin(be, lje, rje, NULL, 1 /* hash used */, 0, 
k->type == unndkey? 1: 0);
s = stmt_result(be, s, 0);
}
s = stmt_binop(be, stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1), 
stmt_atom_lng(be, 0), NULL, ne);
@@ -4743,12 +4745,12 @@ insert_check_ukey(backend *be, list *ins
s = stmt_project(be, nn, s);
}
if (h->nrcols) {
-   s = stmt_join(be, s, h, 0, cmp_equal, 0, 0, false);
+   s = stmt_join(be, s, h, 0, cmp_equal, 0, k->type == 
unndkey? 1: 0, false);
/* s should be empty */
s = stmt_result(be, s, 0);
s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
} else {
-   s = stmt_uselect(be, s, h, cmp_equal, NULL, 0, 0);
+   s = stmt_uselect(be, s, h, cmp_equal, NULL, 0, k->type 
== unndkey? 1: 0);
/* s should be empty */
s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
}
@@ -4855,7 +4857,7 @@ sql_insert_key(backend *be, list *insert
 *  insert values
 *  insert fkey/pkey index
 */
-   if (k->type == pkey || k->type == ukey) {
+   if (k->type == pkey || k->type == ukey || k->type == unndkey) {
return insert_check_ukey(be, inserts, k, idx_inserts);
} else {/* foreign keys */
return insert_check_fkey(be, inserts, k, idx_inserts, pin);
diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -6625,6 +6625,78 @@ sql_update_default(Client c, mvc *sql, s
"update sys.args set type_digits = 63 where 
type = 'bigint' and type_digits <> 63;\n"
"update sys.args set type_digits = 127 where 
type = 'hugeint' and type_digits <> 127;\n"
"update sys.args set type = 'varchar' where 
type in ('clob', 'char');\n"
+   "drop aggregate median(decimal);\n"
+   "drop aggregate median_avg(decimal);\n"
+   "drop aggregate quantile(decimal, double);\n"
+   "drop aggregate quantile_avg(decimal, 
double);\n"
+   "create aggregate median(val DECIMAL(2)) 
returns DECIMAL(2)\n"
+   " external name \"aggr\".\"median\";\n"
+   "GRANT EXECUTE ON AGGREGATE median(DECIMAL(2)) 
TO PUBLIC;\n"
+   "create aggregate median(val DECIMAL(4)) 
returns DECIMAL(4)\n"
+   " external name \"aggr\".\"median\";\n"
+   "GRANT EXECUTE ON AGGREGATE median(DECIMAL(4)) 
TO PUBLIC;\n"
+   "create aggregate median(val DECIMAL(9)) 

MonetDB: ascii-flag - Merge with default branch.

2024-03-04 Thread Sjoerd Mullender via checkin-list
Changeset: 050d3d67e2e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/050d3d67e2e5
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 468 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -820,3 +820,4 @@ c9e6096e7519636a4e840c7a0c2e27cccb7dc0fe
 c9e6096e7519636a4e840c7a0c2e27cccb7dc0fe Jun2023_SP3_release
 1230526af30f40eeea30fb87c47c3e414920561f Dec2023_1
 1230526af30f40eeea30fb87c47c3e414920561f Dec2023_release
+95d8feaa1167b5ba87bd99253c3f4e62ebf528a1 Dec2023_3
diff --git a/ChangeLog-Archive b/ChangeLog-Archive
--- a/ChangeLog-Archive
+++ b/ChangeLog-Archive
@@ -1,6 +1,12 @@
 # DO NOT EDIT THIS FILE -- MAINTAINED AUTOMATICALLY
 # This file contains past ChangeLog entries
 
+* Thu Jan 11 2024 Sjoerd Mullender  - 11.49.3-20240304
+- The copyright for the MonetDB software has been transferred to the newly
+  established MonetDB Foundation, a not-for-profit foundation with the
+  express goal of furthering the MonetDB database system.  The license
+  for the software does not change: MonetDB remains fully open source.
+
 * Fri Dec  1 2023 Sjoerd Mullender  - 11.49.1-20231221
 - All binary packages are now signed with a new key with key fingerprint
   DBCE 5625 94D7 1959 7B54  CE85 3F1A D47F 5521 A603.
diff --git a/ChangeLog.Dec2023 b/ChangeLog.Dec2023
--- a/ChangeLog.Dec2023
+++ b/ChangeLog.Dec2023
@@ -1,9 +1,3 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
-* Thu Jan 11 2024 Sjoerd Mullender 
-- The copyright for the MonetDB software has been transferred to the newly
-  established MonetDB Foundation, a not-for-profit foundation with the
-  express goal of furthering the MonetDB database system.  The license
-  for the software does not change: MonetDB remains fully open source.
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -91,7 +91,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Dec2023/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Dec2023-SP1/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -917,6 +917,69 @@ fi
 %endif
 
 %changelog
+* Mon Mar 04 2024 Sjoerd Mullender  - 11.49.3-20240304
+- Rebuilt.
+- GH#6800: Please add information_schema (ANSI SQL norm)
+- GH#7152: Occasional dbfarm corruption upon database restart
+- GH#7412: MonetDB server crashes in `vscanf`
+- GH#7415: MonetDB server crashes in `HEAP_malloc`
+- GH#7416: MonetDB server crashes in `atom_get_int`
+- GH#7417: MonetDB server crashes in `trimchars`.
+- GH#7418: MonetDB server crashes in `bind_col_exp`
+- GH#7420: Performance issue with lower(string)
+- GH#7425: The last statement, execution error, is a false positive?
+- GH#7426: Unexpected result for INNER JOIN with IS NOT NULL
+- GH#7428: Unexpected result when using BETWEEN operator
+- GH#7429: Unexpected result when using `CASE WHEN`
+- GH#7430: Unexpected result when using `AND` and `IS NOT NULL`
+- GH#7431: [bug] Error code found, please confirm
+- GH#7432: MonetDB server crashes in `dameraulevenshtein`
+- GH#7433: MonetDB server crashes in `exp_atom`
+- GH#7434: MonetDB server crashes in `exp_bin`
+- GH#7435: MonetDB server crashes in `exp_copy`
+- GH#7436: MonetDB server crashes in `exp_ref`
+- GH#7437: MonetDB server crashes in `exp_values_set_supertype`
+- GH#7438: MonetDB server crashes in `exps_bind_column`
+- GH#7439: MonetDB server crashes in `exps_card`
+- GH#7440: MonetDB server crashes in `gc_col`
+- GH#7441: MonetDB server crashes in `is_column_unique`
+- GH#7442: MonetDB server crashes in `mat_join2`
+- GH#7443: MonetDB server crashes in `merge_table_prune_and_unionize`
+- GH#7444: [bug] the table cannot be created because the reserved word is
+  incorrectly set
+- GH#7447: Unexpected result when using `BETWEEN` in `INNER JOIN`
+- GH#7448: Unexpected result when using `AND`/`OR` chain
+- GH#7450: Unexpected result when `CREATE VIEW` with `WHERE NULL`
+- GH#7451: Unexpected result when using `BETWEEN` and `CAST`
+- GH#7453: Cannot recover an msqldump
+- GH#7455: Unexpected result when using `BETWEEN` with `BOOLEAN` values
+- GH#7456: Crash when `INNER JOIN` with `VIEW`
+- GH#7457: Unexpected result when using `AND` with `INTEGER`
+- GH#7458: Unexpected result when using `SIGN`
+- GH#7461: Crash by potentially use of bad escape characters
+- GH#7462: Crash when using `BETWEEN AND`
+
+* Fri Mar  1 2024 Sjoerd Mullender  - 11.49.3-20240304
+- gdk: Fixed a regression where bats weren't always cleaned up when they
+  weren't needed anymore.  In particular, after a DELETE FROM table query
+  without a WHERE clause (which deletes all rows from the table), the
+  bats for the table get replaced by new ones, and the old, now unused,
+  bats weren't removed 

MonetDB: ascii-flag - Merge with default branch.

2024-03-04 Thread Sjoerd Mullender via checkin-list
Changeset: 64a8583dbdd5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/64a8583dbdd5
Modified Files:
monetdb5/modules/atoms/str.c
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 2307 to 300 lines):

diff --git a/ChangeLog.Dec2023 b/ChangeLog.Dec2023
--- a/ChangeLog.Dec2023
+++ b/ChangeLog.Dec2023
@@ -1,3 +1,9 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
+* Thu Jan 11 2024 Sjoerd Mullender 
+- The copyright for the MonetDB software has been transferred to the newly
+  established MonetDB Foundation, a not-for-profit foundation with the
+  express goal of furthering the MonetDB database system.  The license
+  for the software does not change: MonetDB remains fully open source.
+
diff --git a/gdk/ChangeLog.Dec2023 b/gdk/ChangeLog.Dec2023
--- a/gdk/ChangeLog.Dec2023
+++ b/gdk/ChangeLog.Dec2023
@@ -1,3 +1,10 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Fri Mar  1 2024 Sjoerd Mullender 
+- Fixed a regression where bats weren't always cleaned up when they
+  weren't needed anymore.  In particular, after a DELETE FROM table query
+  without a WHERE clause (which deletes all rows from the table), the
+  bats for the table get replaced by new ones, and the old, now unused,
+  bats weren't removed from the database.
+
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -217,6 +217,7 @@ HEAPalloc(Heap *h, size_t nitems, size_t
return GDK_FAIL;
}
GDKfree(nme);
+   TRC_DEBUG(HEAP, "%s %zu %p (mmap)\n", h->filename, size, 
h->base);
}
h->newstorage = h->storage;
return GDK_SUCCEED;
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1224,6 +1224,8 @@ log_read_transaction(logger *lg, uint32_
bool ok = true;
ATOMIC_BASE_TYPE dbg = ATOMIC_GET();
 
+   (void) maxupdated;  /* only used inside assert() */
+
if (!lg->flushing)
ATOMIC_AND(, ~CHECKMASK);
 
@@ -1251,16 +1253,40 @@ log_read_transaction(logger *lg, uint32_
if (updated && BAThash(lg->catalog_id) == GDK_SUCCEED) {
BATiter cni = bat_iterator(lg->catalog_id);
BUN p;
+   BUN posnew = BUN_NONE;
+   BUN posold = BUN_NONE;
MT_rwlock_rdlock(>thashlock);
HASHloop_int(cni, cni.b->thash, p, ) {
-   (void)maxupdated;
-   assert(p < maxupdated);
-   updated[p / 32] |= 1U << (p % 32);
-   /* there should only be one hit */
-   break;
+   lng lid = *(lng *) 
Tloc(lg->catalog_lid, p);
+   if (lid == lng_nil || lid > tr->tid)
+   posnew = p;
+   else if (lid == tr->tid)
+   posold = p;
}
MT_rwlock_rdunlock(>thashlock);
bat_iterator_end();
+   /* Normally at this point, posnew is the
+* location of the bat that this
+* transaction is working on, and posold
+* is the location of the previous
+* version of the bat.  If LOG_CREATE,
+* both are relevant, since the latter
+* is the new bat, and the former is the
+* to-be-destroyed bat.  For
+* LOG_DESTROY, only posnew should be
+* relevant, but for the other types, if
+* the table is destroyed later in the
+* same transaction, we need posold, and
+* else (the normal case) we need
+* posnew. */
+   if (posnew != BUN_NONE) {
+   assert(posnew < maxupdated);
+   updated[posnew / 32] |= 1U << (posnew % 
32);
+   }
+   if ((l.flag == LOG_CREATE || posnew == 
BUN_NONE) && posold != BUN_NONE) {
+   assert(posold < maxupdated);
+   updated[posold / 32] |= 1U << (posold % 
32);
+   }
}
break;
default:
@@ 

MonetDB: ascii-flag - Merge with default branch.

2024-03-04 Thread Sjoerd Mullender via checkin-list
Changeset: f813c624a736 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f813c624a736
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (183 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -4057,14 +4057,14 @@ stmt_Nop(backend *be, stmt *ops, stmt *s
q = pushArgument(mb, q, e1->nr);
pushInstruction(mb, q);
}
-   push_cands = can_push_cands(sel, mod, fimp);
+   push_cands = f->func->type == F_FUNC && can_push_cands(sel, 
mod, fimp);
}
if (q == NULL) {
if (backend_create_subfunc(be, f, ops->op4.lval) < 0)
goto bailout;
mod = sql_func_mod(f->func);
fimp = convertMultiplexFcn(backend_function_imp(be, f->func));
-   push_cands = can_push_cands(sel, mod, fimp);
+   push_cands = f->func->type == F_FUNC && can_push_cands(sel, 
mod, fimp);
default_nargs = (f->res && list_length(f->res) ? 
list_length(f->res) : 1) + list_length(ops->op4.lval) + (o && o->nrcols > 0 ? 6 
: 4);
if (rows) {
card = stmt_aggr(be, rows, NULL, NULL, 
sql_bind_func(be->mvc, "sys", "count", sql_bind_localtype("void"), NULL, 
F_AGGR, true, true), 1, 0, 1);
@@ -4124,7 +4124,7 @@ stmt_Nop(backend *be, stmt *ops, stmt *s
q = pushArgument(mb, q, op->nr);
}
/* push candidate lists if that's the case */
-   if (f->func->type == F_FUNC && push_cands) {
+   if (push_cands) {
for (node *n = ops->op4.lval->h; n; n = n->next) {
stmt *op = n->data;
 
diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -875,12 +875,12 @@ exps_merge_select_rse( mvc *sql, list *l
   le->flag == re->flag && le->flag <= cmp_lt) {
sql_exp *mine = NULL, *maxe = NULL;
 
-   if (!(mine = rel_binop_(sql, NULL, le->r, 
re->r, "sys", "sql_min", card_value, true))) {
+   if (!(mine = rel_binop_(sql, NULL, 
exp_copy(sql, le->r), exp_copy(sql, re->r), "sys", "sql_min", card_value, 
true))) {
sql->session->status = 0;
sql->errstr[0] = '\0';
continue;
}
-   if (!(maxe = rel_binop_(sql, NULL, le->f, 
re->f, "sys", "sql_max", card_value, true))) {
+   if (!(maxe = rel_binop_(sql, NULL, 
exp_copy(sql, le->f), exp_copy(sql, re->f), "sys", "sql_max", card_value, 
true))) {
sql->session->status = 0;
sql->errstr[0] = '\0';
continue;
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
@@ -1530,10 +1530,27 @@ push_join_exp(mvc *sql, sql_rel *rel, sq
 }
 
 static sql_rel *
+rel_select_push_filter_exp_down(mvc *sql, sql_rel *rel, sql_exp *e, list *l, 
list *r, int ff)
+{
+   sql_exp *ll, *rr;
+   if (exps_card(r) <= CARD_ATOM && (exps_are_atoms(r) || 
exps_have_freevar(sql, r) || exps_have_freevar(sql, l))) {
+   if (exps_card(l) == exps_card(r) || rel->processed)  /* bin 
compare op */
+   return rel_select(sql->sa, rel, e);
+   if ((ll = exps_find_one_multi_exp(l)))
+   return push_select_exp(sql, rel, e, ll, ff);
+   } else if ((ll = exps_find_one_multi_exp(l)) && (rr = 
exps_find_one_multi_exp(r))) { /* join */
+   return push_join_exp(sql, rel, e, ll, rr, NULL, ff);
+   }
+   if (is_outerjoin(rel->op))
+   return rel_select(sql->sa, rel, e);
+   return rel_select_add_exp(sql->sa, rel, e);
+}
+
+static sql_rel *
 rel_filter(mvc *sql, sql_rel *rel, list *l, list *r, char *sname, char 
*filter_op, int anti, int ff)
 {
node *n;
-   sql_exp *e = NULL, *ll, *rr;
+   sql_exp *e = NULL;
sql_subfunc *f = NULL;
list *tl = sa_list(sql->sa);
bool found = false;
@@ -1602,20 +1619,7 @@ rel_filter(mvc *sql, sql_rel *rel, list 
return sql_error(sql, ERR_GROUPBY, SQLSTATE(42000) 
"SELECT: cannot use non GROUP BY column in query results without an aggregate 
function");
}
}
-   if (!is_join(rel->op) && !is_select(rel->op))
-   return rel_select(sql->sa, rel, e);
-   if (exps_card(r) <= CARD_ATOM && (exps_are_atoms(r) || 
exps_have_freevar(sql, r) 

MonetDB: ascii-flag - Merge with default branch.

2024-02-23 Thread Sjoerd Mullender via checkin-list
Changeset: 15f3671d169e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/15f3671d169e
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 323 to 300 lines):

diff --git a/clients/examples/C/streamcat.c b/clients/examples/C/streamcat.c
--- a/clients/examples/C/streamcat.c
+++ b/clients/examples/C/streamcat.c
@@ -439,6 +439,10 @@ opener_rastream(char *filename)
 #ifdef HAVE_CURL
 #include 
 
+#ifndef CURL_WRITEFUNC_ERROR
+#define CURL_WRITEFUNC_ERROR 0
+#endif
+
 static size_t
 write_callback(char *buffer, size_t size, size_t nitems, void *userp)
 {
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3075,6 +3075,10 @@ doFile(Mapi mid, stream *fp, bool useins
 #ifdef HAVE_CURL
 #include 
 
+#ifndef CURL_WRITEFUNC_ERROR
+#define CURL_WRITEFUNC_ERROR 0
+#endif
+
 static size_t
 write_callback(char *buffer, size_t size, size_t nitems, void *userp)
 {
diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c
--- a/sql/server/sql_scan.c
+++ b/sql/server/sql_scan.c
@@ -1507,7 +1507,12 @@ sql_get_next_token(YYSTYPE *yylval, void
if (GDKstrFromStr((unsigned char *) str,
  (unsigned char *) 
yylval->sval + 2,
  lc->yycur-lc->yysval 
- 2, '\'') < 0) {
-   sql_error(c, 1, SQLSTATE(42000) "%s", 
GDKerrbuf);
+   char *err = GDKerrbuf;
+   if (strncmp(err, GDKERROR, strlen(GDKERROR)) == 
0)
+   err += strlen(GDKERROR);
+   else if (*err == '!')
+   err++;
+   sql_error(c, 1, SQLSTATE(42000) "%s", err);
return LEX_ERROR;
}
quote = '\'';
diff --git a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test 
b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
--- a/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
+++ b/sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
@@ -241,7 +241,7 @@ DROP TABLE v0
 statement ok
 CREATE TABLE v0(v1 INT)
 
-statement error
+statement error 42000!CATALOG: no such function 'sys'.'='
 UPDATE v0 SET v1 = (WITH v0 AS (SELECT 42039652.00) SELECT STDDEV_POP (96) 
OVER (ORDER BY v1) FROM v0, v0 LIMIT 37 OFFSET 62) = 8
 
 statement ok
@@ -420,15 +420,15 @@ DROP TABLE v0
 -- SELECT ALL ( SELECT - - - - - - - - - - 48 FROM ( SELECT NULL - - - - - - - 
- 89 FROM ( VALUES ( - - - - - - - - - - 74 ) , ( - - - - - 128 ) , ( - - - - - 
- 8 ) , ( - - - - 61 ) ) AS v1 ( v1 ) GROUP BY ( ) , GROUPING SETS ( GROUPING 
SETS ( GROUPING SETS ( ( ) ) ) ) , ( ) ORDER BY - - - - - - - - - - 255 LIKE v1 
/ CASE WHEN v1 IS NULL THEN - - 75 END DESC , v1 , v1 LIMIT 63 ) AS v1 UNION 
SELECT - - - - - - - - - - - - - 74 WHERE - v1 < - 89088397.00 ) FROM ( 
SELECT * FROM ( VALUES ( - - - - - - - 61 ) , ( - - - 42 ) ) AS v1 ( v1 ) ) AS 
v1 ( v1 )
 -- sql/server/rel_select.c:4614: rel_groupings: Assertion `next_set' failed.
 
--- -- 30.sql
--- statement ok
--- CREATE TABLE v0(v2 DOUBLE PRIMARY KEY, v1 VARCHAR(1))
+-- 30.sql
+statement ok
+CREATE TABLE v0(v2 DOUBLE PRIMARY KEY, v1 VARCHAR(1))
 
--- statement ok
--- DELETE FROM v0 WHERE (SELECT v2 FROM v0 WHERE v0.v2 = v0.v1 GROUP BY 
2.10, v1) IN (10.10, 10, 10 )
+statement ok
+DELETE FROM v0 WHERE (SELECT v2 FROM v0 WHERE v0.v2 = v0.v1 GROUP BY 2.10, 
v1) IN (10.10, 10, 10 )
 
--- statement ok
--- DROP TABLE v0
+statement ok
+DROP TABLE v0
 
 -- 31.sql
 statement error 22003!overflow ...
diff --git a/sql/test/BugTracker-2024/Tests/All 
b/sql/test/BugTracker-2024/Tests/All
--- a/sql/test/BugTracker-2024/Tests/All
+++ b/sql/test/BugTracker-2024/Tests/All
@@ -28,3 +28,5 @@ sign-issue-7458
 contains-between-issue-7459
 push_select_exp-issue-7460
 unicode-escape-7461
+exp-bin-Bug-7462
+contains-cast-7463
diff --git a/sql/test/BugTracker-2024/Tests/between-boolean-7451.test 
b/sql/test/BugTracker-2024/Tests/between-boolean-7451.test
--- a/sql/test/BugTracker-2024/Tests/between-boolean-7451.test
+++ b/sql/test/BugTracker-2024/Tests/between-boolean-7451.test
@@ -1,4 +1,3 @@
-
 statement ok
 CREATE TABLE t0(c0 VARCHAR, PRIMARY KEY(c0))
 
@@ -29,7 +28,7 @@ True
 True
 
 query IT
-SELECT t1.c1, t1.c2 FROM t1, t0 WHERE (NOT CAST((true BETWEEN t1.c2 AND t0.c0) 
AS VARCHAR));
+SELECT t1.c1, t1.c2 FROM t1, t0 WHERE (NOT CAST((true BETWEEN t1.c2 AND t0.c0) 
AS VARCHAR))
 
 0
 NULL
@@ -37,7 +36,7 @@ 0
 NULL
 
 query ITT
-SELECT * FROM t1, t0 WHERE (NOT CAST((true BETWEEN t1.c2 AND t0.c0) AS 
VARCHAR)); -- 2 rows
+SELECT * FROM t1, t0 WHERE (NOT CAST((true BETWEEN t1.c2 AND t0.c0) AS 
VARCHAR))
 
 0
 NULL
@@ -45,3 +44,10 @@ a
 0
 NULL
 false
+
+statement ok
+DROP TABLE t1
+
+statement ok
+DROP 

MonetDB: ascii-flag - Merge with default branch.

2024-02-21 Thread Sjoerd Mullender via checkin-list
Changeset: b35d66612032 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b35d66612032
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 2731 to 300 lines):

diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -43,7 +43,7 @@ jobs:
 runs-on: ${{ matrix.os }}
 steps:
   - name: Checkout
-uses: actions/checkout@v3
+uses: actions/checkout@v4
 with:
   ref: ${{ github.ref }}
 
@@ -129,7 +129,7 @@ jobs:
   - name: Tar files
 run: tar -cvf mtests.tar mTests
   - name: Publish mtest results
-uses: actions/upload-artifact@v3
+uses: actions/upload-artifact@v4
 with:
   name: mtest-${{ github.sha }}-${{ matrix.os }}-${{ matrix.c_compiler 
}}
   path: mtests.tar
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
@@ -50440,7 +50440,12 @@ SQLwindow_bound;
 computes window ranges for each row
 sqlcatalog
 alter_add_range_partition
-pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int):void 
+pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:bat[:lng]):void 
+SQLalter_add_range_partition;
+Catalog operation alter_add_range_partition
+sqlcatalog
+alter_add_range_partition
+pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:lng):void 
 SQLalter_add_range_partition;
 Catalog operation alter_add_range_partition
 sqlcatalog
@@ -50450,12 +50455,22 @@ SQLalter_add_table;
 Catalog operation alter_add_table
 sqlcatalog
 alter_add_value_partition
-pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int):void 
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:bat[:lng]):void 
 SQLalter_add_value_partition;
 Catalog operation alter_add_value_partition
 sqlcatalog
 alter_add_value_partition
-pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:any...):void 
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:bat[:lng], X_7:any...):void 
+SQLalter_add_value_partition;
+Catalog operation alter_add_value_partition
+sqlcatalog
+alter_add_value_partition
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:lng):void 
+SQLalter_add_value_partition;
+Catalog operation alter_add_value_partition
+sqlcatalog
+alter_add_value_partition
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:lng, X_7:any...):void 
 SQLalter_add_value_partition;
 Catalog operation alter_add_value_partition
 sqlcatalog
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
@@ -38765,7 +38765,12 @@ SQLwindow_bound;
 computes window ranges for each row
 sqlcatalog
 alter_add_range_partition
-pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int):void 
+pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:bat[:lng]):void 
+SQLalter_add_range_partition;
+Catalog operation alter_add_range_partition
+sqlcatalog
+alter_add_range_partition
+pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:lng):void 
 SQLalter_add_range_partition;
 Catalog operation alter_add_range_partition
 sqlcatalog
@@ -38775,12 +38780,22 @@ SQLalter_add_table;
 Catalog operation alter_add_table
 sqlcatalog
 alter_add_value_partition
-pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int):void 
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:bat[:lng]):void 
 SQLalter_add_value_partition;
 Catalog operation alter_add_value_partition
 sqlcatalog
 alter_add_value_partition
-pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:any...):void 
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:bat[:lng], X_7:any...):void 
+SQLalter_add_value_partition;
+Catalog operation alter_add_value_partition
+sqlcatalog
+alter_add_value_partition
+pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, 
X_3:str, X_4:bit, X_5:int, X_6:lng):void 
+SQLalter_add_value_partition;
+Catalog operation 

MonetDB: ascii-flag - Merge with default branch.

2024-02-16 Thread Sjoerd Mullender via checkin-list
Changeset: 41dd7a96f230 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/41dd7a96f230
Branch: ascii-flag
Log Message:

Merge with default branch.


diffs (truncated from 641 to 300 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -802,8 +802,8 @@ void TABLETdestroy_format(Tablet *as);
 int TABLEToutput_file(Tablet *as, BAT *order, stream *s, bstream *in);
 int TRACEtable(Client cntxt, BAT **r);
 int TYPE_xml;
-int UTF8_strlen(const char *restrict s);
-int UTF8_strwidth(const char *restrict s);
+int UTF8_strlen(const char *s);
+int UTF8_strwidth(const char *s);
 void addMalException(MalBlkPtr mb, str msg);
 str addOptimizerPipe(Client cntxt, MalBlkPtr mb, const char *name);
 str addPipeDefinition(Client cntxt, const char *name, const char *pipe);
@@ -1253,7 +1253,7 @@ const char *stoptraceRef;
 void strAfterCall(ValPtr v, ValPtr bak);
 void strBeforeCall(ValPtr v, ValPtr bak);
 const char *strRef;
-int str_strlen(const char *restrict s);
+int str_strlen(const char *s);
 const char *streamsRef;
 const char *strimpsRef;
 const char *subavgRef;
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -47,6 +47,10 @@
 
 #include 
 
+#ifdef HAVE_WCWIDTH
+#include 
+#endif
+
 #ifdef HAVE_ICONV
 #include 
 #ifdef HAVE_NL_LANGINFO
@@ -413,6 +417,14 @@ utf8strlenmax(char *s, char *e, size_t m
c = (c << 6) | (*s & 0x3F);
if (--n == 0) {
/* last byte of a multi-byte character */
+#ifdef HAVE_WCWIDTH
+   n = wcwidth(c);
+   if (n >= 0)
+   len += n;
+   else
+   len++;  /* assume width 1 if 
unprintable */
+   n = 0;
+#else
len++;
/* this list was created by combining
 * the code points marked as
@@ -546,7 +558,7 @@ utf8strlenmax(char *s, char *e, size_t m
len++;
else if (0x0080 <= c && c <= 0x009F)
len += 5;
-
+#endif
}
} else if ((*s & 0xE0) == 0xC0) {
assert(n == 0);
diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake
--- a/cmake/monetdb-defines.cmake
+++ b/cmake/monetdb-defines.cmake
@@ -118,6 +118,7 @@ function(monetdb_configure_defines)
   check_function_exists("task_info" HAVE_TASK_INFO)
   check_function_exists("times" HAVE_TIMES)
   check_function_exists("uname" HAVE_UNAME)
+  check_symbol_exists("wcwidth" "wchar.h" HAVE_WCWIDTH)
   # Some libc versions on Linux distributions don't have it
   check_symbol_exists("semtimedop" "sys/types.h;sys/ipc.h;sys/sem.h" 
HAVE_SEMTIMEDOP)
   cmake_push_check_state()
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -774,13 +774,14 @@ HEAPincref(Heap *h)
  *
  * If we find file X.new, we move it over X (if present) and open it.
  */
-static gdk_return
-HEAPload_intern(Heap *h, const char *nme, const char *ext, const char *suffix, 
bool trunc)
+gdk_return
+HEAPload(Heap *h, const char *nme, const char *ext, bool trunc)
 {
size_t minsize;
int ret = 0;
char *srcpath, *dstpath;
lng t0;
+   const char suffix[] = ".new";
 
if (h->storage == STORE_INVALID || h->newstorage == STORE_INVALID) {
size_t allocated;
@@ -889,12 +890,6 @@ HEAPload_intern(Heap *h, const char *nme
return GDK_SUCCEED;
 }
 
-gdk_return
-HEAPload(Heap *h, const char *nme, const char *ext, bool trunc)
-{
-   return HEAPload_intern(h, nme, ext, ".new", trunc);
-}
-
 /*
  * @- HEAPsave
  *
@@ -910,12 +905,13 @@ HEAPload(Heap *h, const char *nme, const
  * After GDKsave returns successfully (>=0), we assume the heaps are
  * safe on stable storage.
  */
-static gdk_return
-HEAPsave_intern(Heap *h, const char *nme, const char *ext, const char *suffix, 
bool dosync, BUN free, MT_Lock *lock)
+gdk_return
+HEAPsave(Heap *h, const char *nme, const char *ext, bool dosync, BUN free, 
MT_Lock *lock)
 {
storage_t store = h->newstorage;
long_str extension;
gdk_return rc;
+   const char suffix[] = ".new";
 
if (h->base == NULL) {
GDKerror("no heap to save\n");
@@ -965,12 +961,6 @@ HEAPsave_intern(Heap *h, const char *nme
return rc;
 }
 
-gdk_return
-HEAPsave(Heap *h, const char *nme, const char *ext, bool dosync, BUN free, 
MT_Lock *lock)
-{
-   return HEAPsave_intern(h, nme, ext, ".new", dosync, free, lock);
-}
-
 int
 HEAPwarm(Heap *h)
 {
diff --git a/gdk/gdk_logger.c