MonetDB: default - merged with aug2024

2024-07-14 Thread Niels Nes via checkin-list
Changeset: b62cf00a4142 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b62cf00a4142
Modified Files:
clients/Tests/exports.stable.out
sql/backends/monet5/sql.c
Branch: default
Log Message:

merged with aug2024


diffs (truncated from 780 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -182,6 +182,11 @@ install(FILES
   DESTINATION ${EXPORT_TARGET_PATH}
   COMPONENT monetdbdev)
 
+install(FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/MonetDBConfigVersion.cmake
+  DESTINATION ${EXPORT_TARGET_PATH}
+  COMPONENT monetdbdev)
+
 include(monetdb-packages)
 
 include(CTest)
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
@@ -790,7 +790,6 @@ str AUTHunlockVault(const char *password
 str AUTHverifyPassword(const char *passwd);
 str BKCmirror(bat *ret, const bat *bid);
 str BKCnewBAT(bat *res, const int *tt, const BUN *cap, role_t role);
-str CLTsessions(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str CLTshutdown(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str COPYrejects(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 str COPYrejects_clear(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
@@ -1022,6 +1021,7 @@ int getOidConstant(MalBlkPtr mb, oid val
 int getPC(MalBlkPtr mb, InstrPtr p);
 str getPipeCatalog(bat *nme, bat *def, bat *stat);
 const char *getRef;
+str getScenarioLanguage(Client c);
 int getShtConstant(MalBlkPtr mb, sht val);
 int getStrConstant(MalBlkPtr mb, str val);
 const char *getTraceRef;
diff --git a/monetdb5/mal/mal_scenario.h b/monetdb5/mal/mal_scenario.h
--- a/monetdb5/mal/mal_scenario.h
+++ b/monetdb5/mal/mal_scenario.h
@@ -37,11 +37,11 @@ typedef struct SCENARIO {
 
 mal_export Scenario getFreeScenario(void);
 mal_export Scenario findScenario(const char *nme);
+mal_export str getScenarioLanguage(Client c);
 
 #ifdef LIBMONETDB5
 extern str setScenario(Client c, const char *nme);
 extern str runScenario(Client c);
-extern str getScenarioLanguage(Client c);
 
 extern void showCurrentScenario(void);
 extern void showScenarioByName(stream *f, const char *s);
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
@@ -773,214 +773,6 @@ CLTshutdown(Client cntxt, MalBlkPtr mb, 
return MAL_SUCCEED;
 }
 
-str
-CLTsessions(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-   BAT *id = NULL, *user = NULL, *login = NULL, *sessiontimeout = NULL,
-   *querytimeout = NULL, *idle = NULL;
-   BAT *opt = NULL, *wlimit = NULL, *mlimit = NULL;
-   BAT *language = NULL, *peer = NULL, *hostname = NULL, *application = 
NULL, *client = NULL, *clientpid = NULL, *remark = NULL;
-   bat *idId = getArgReference_bat(stk, pci, 0);
-   bat *userId = getArgReference_bat(stk, pci, 1);
-   bat *loginId = getArgReference_bat(stk, pci, 2);
-   bat *idleId = getArgReference_bat(stk, pci, 3);
-   bat *optId = getArgReference_bat(stk, pci, 4);
-   bat *sessiontimeoutId = getArgReference_bat(stk, pci, 5);
-   bat *querytimeoutId = getArgReference_bat(stk, pci, 6);
-   bat *wlimitId = getArgReference_bat(stk, pci, 7);
-   bat *mlimitId = getArgReference_bat(stk, pci, 8);
-   bat *languageId = getArgReference_bat(stk, pci, 9);
-   bat *peerId = getArgReference_bat(stk, pci, 10);
-   bat *hostnameId = getArgReference_bat(stk, pci, 11);
-   bat *applicationId = getArgReference_bat(stk, pci, 12);
-   bat *clientId = getArgReference_bat(stk, pci, 13);
-   bat *clientpidId = getArgReference_bat(stk, pci, 14);
-   bat *remarkId = getArgReference_bat(stk, pci, 15);
-   Client c;
-   bool admin;
-   timestamp ts;
-   lng pid;
-   const char *s;
-   int timeout;
-   str msg = NULL;
-
-   (void) cntxt;
-   (void) mb;
-
-   id = COLnew(0, TYPE_int, 0, TRANSIENT);
-   user = COLnew(0, TYPE_str, 0, TRANSIENT);
-   login = COLnew(0, TYPE_timestamp, 0, TRANSIENT);
-   opt = COLnew(0, TYPE_str, 0, TRANSIENT);
-   sessiontimeout = COLnew(0, TYPE_int, 0, TRANSIENT);
-   querytimeout = COLnew(0, TYPE_int, 0, TRANSIENT);
-   wlimit = COLnew(0, TYPE_int, 0, TRANSIENT);
-   mlimit = COLnew(0, TYPE_int, 0, TRANSIENT);
-   idle = COLnew(0, TYPE_timestamp, 0, TRANSIENT);
-   language = COLnew(0, TYPE_str, 0, TRANSIENT);
-   peer = COLnew(0, TYPE_str, 0, TRANSIENT);
-   hostname = COLnew(0, TYPE_str, 0, TRANSIENT);
-   application = COLnew(0, TYPE_str, 0, TRANSIENT);
-   client = COLnew(0, TYPE_str, 0, TRANSIENT);
-   clientpid = COLnew(0, TYPE_lng, 0, TRANSIENT);
-   remark = COLnew(0, TYPE_str, 0, TRANSIENT);
-
-   if (id == NULL || user == NULL || login == NULL || sessiontimeout == 
NULL
-   || idle == NULL || 

MonetDB: default - merged with Aug2024

2024-07-10 Thread Niels Nes via checkin-list
Changeset: 2cc06379d80e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2cc06379d80e
Modified Files:
clients/Tests/exports.stable.out
Branch: default
Log Message:

merged with Aug2024


diffs (101 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
@@ -1065,6 +1065,7 @@ const char *likeRef;
 const char *likejoinRef;
 const char *likeselectRef;
 const char *likeuselectRef;
+const char *lngRef;
 str loadLibrary(const char *modulename, int flag);
 char *locate_file(const char *basename, const char *ext, bit recurse);
 const char *lockRef;
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -149,6 +149,7 @@ const char *leftjoinRef;
 const char *likejoinRef;
 const char *likeRef;
 const char *likeselectRef;
+const char *lngRef;
 const char *lockRef;
 const char *lookupRef;
 const char *malRef;
@@ -409,6 +410,7 @@ optimizerInit(void)
likejoinRef = putName("likejoin");
likeRef = putName("like");
likeselectRef = putName("likeselect");
+   lngRef = putName("lng");
lockRef = putName("lock");
lookupRef = putName("lookup");
malRef = putName("mal");
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -147,6 +147,7 @@ mal_export const char *likejoinRef;
 mal_export const char *likeRef;
 mal_export const char *likeselectRef;
 mal_export const char *likeuselectRef;
+mal_export const char *lngRef;
 mal_export const char *lockRef;
 mal_export const char *lookupRef;
 mal_export const char *malRef;
diff --git a/monetdb5/optimizer/opt_remap.c b/monetdb5/optimizer/opt_remap.c
--- a/monetdb5/optimizer/opt_remap.c
+++ b/monetdb5/optimizer/opt_remap.c
@@ -21,6 +21,21 @@
 #include "opt_inline.h"
 #include "opt_multiplex.h"
 
+static InstrPtr
+pushNilAt(MalBlkPtr mb, InstrPtr p, int pos)
+{
+int i;
+
+p = pushNilBat(mb, p);   /* push at end */
+if (mb->errors == NULL) {
+   int arg = getArg(p, p->argc - 1);
+for (i = p->argc - 1; i > pos; i--)
+getArg(p, i) = getArg(p, i - 1);
+getArg(p, pos) = arg;
+}
+return p;
+}
+
 static int
 OPTremapDirect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int 
idx,
   Module scope)
@@ -261,11 +276,16 @@ OPTmultiplexInline(Client cntxt, MalBlkP
q->typeresolved = false;
if (q->retc == 1 &&
((getModuleId(q) == batcalcRef
- && (getFunctionId(q) == mulRef
- || getFunctionId(q) 
== divRef
- || getFunctionId(q) 
== plusRef
- || getFunctionId(q) 
== minusRef
- || getFunctionId(q) 
== modRef))
+ && (   getFunctionId(q) == 
mulRef
+  || getFunctionId(q) 
== divRef
+  || getFunctionId(q) 
== plusRef
+  || getFunctionId(q) 
== minusRef
+  || getFunctionId(q) 
== modRef
+  || (q->argc > 3 && (
+
getFunctionId(q) == intRef
+ || 
getFunctionId(q) == lngRef
+ || 
getFunctionId(q) == hgeRef))
+))
 || getModuleId(q) == 
batmtimeRef
 || getModuleId(q) == 
batstrRef)) {
if (q->argc == 3 &&
@@ -292,6 +312,12 @@ OPTmultiplexInline(Client cntxt, MalBlkP
if 
(isaBatType(getArgType(mq, q, 2)))
q = 
pushNilBat(mq, q);
q = pushArgument(mq, q, 
a);
+   } else if (q->argc == 5 && 
getModuleId(q) == batcalcRef) { /* decimal casts */
+   int pos = 3;
+   if 
(isaBatType(getArgType(mq, q, 1)))
+ 

MonetDB: default - merged

2024-06-19 Thread Niels Nes via checkin-list
Changeset: ab4f55107eab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ab4f55107eab
Modified Files:
sql/backends/monet5/sql.c
sql/storage/bat/bat_storage.c
Branch: default
Log Message:

merged


diffs (truncated from 1274 to 300 lines):

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
@@ -38365,8 +38365,13 @@ SQLstr_auto_vacuum;
 auto vacuum string column with interval(sec)
 sql
 vacuum
+unsafe pattern sql.vacuum(X_0:str, X_1:str):void
+SQLstr_vacuum;
+vacuum a string column
+sql
+vacuum
 unsafe pattern sql.vacuum(X_0:str, X_1:str, X_2:str):void
-SQLstr_column_vacuum;
+SQLstr_vacuum;
 vacuum a string column
 sql
 variance
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
@@ -188,7 +188,7 @@ gdk_return BATrtree(BAT *wkb, BAT *mbr);
 BAT *BATsample(BAT *b, BUN n);
 BAT *BATsample_with_seed(BAT *b, BUN n, uint64_t seed);
 gdk_return BATsave(BAT *b) __attribute__((__warn_unused_result__));
-BAT *BATselect(BAT *b, BAT *s, const void *tl, const void *th, bool li, bool 
hi, bool anti);
+BAT *BATselect(BAT *b, BAT *s, const void *tl, const void *th, bool li, bool 
hi, bool anti, bool nil_matches);
 gdk_return BATsemijoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, 
bool nil_matches, bool max_one, BUN estimate) 
__attribute__((__warn_unused_result__));
 BAT *BATsetaccess(BAT *b, restrict_t mode) 
__attribute__((__warn_unused_result__));
 void BATsetcapacity(BAT *b, BUN cnt);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2265,7 +2265,7 @@ gdk_export ValPtr BATsetprop_nolock(BAT 
 #define JOIN_BAND  3
 #define JOIN_NE(-3)
 
-gdk_export BAT *BATselect(BAT *b, BAT *s, const void *tl, const void *th, bool 
li, bool hi, bool anti);
+gdk_export BAT *BATselect(BAT *b, BAT *s, const void *tl, const void *th, bool 
li, bool hi, bool anti, bool nil_matches);
 gdk_export BAT *BATthetaselect(BAT *b, BAT *s, const void *val, const char 
*op);
 
 gdk_export BAT *BATconstant(oid hseq, int tt, const void *val, BUN cnt, role_t 
role);
diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c
--- a/gdk/gdk_firstn.c
+++ b/gdk/gdk_firstn.c
@@ -1067,7 +1067,7 @@ BATfirstn_grouped(BAT **topn, BAT **gids
BAT *bn1, *bn2;
 
bn1 = bn;
-   bn2 = BATselect(bi->b, s, BUNtail(*bi, last - 
bi->b->hseqbase), NULL, true, false, false);
+   bn2 = BATselect(bi->b, s, BUNtail(*bi, last - 
bi->b->hseqbase), NULL, true, false, false, false);
if (bn2 == NULL) {
BBPunfix(bn1->batCacheid);
return GDK_FAIL;
@@ -1193,7 +1193,7 @@ BATfirstn_grouped_with_groups(BAT **topn
BAT *bn1, *bn2, *bn3, *bn4;
 
bn1 = bn;
-   bn2 = BATselect(g, NULL, , NULL, true, false, false);
+   bn2 = BATselect(g, NULL, , NULL, true, false, false, 
false);
if (bn2 == NULL) {
BBPunfix(bn1->batCacheid);
return GDK_FAIL;
@@ -1204,7 +1204,7 @@ BATfirstn_grouped_with_groups(BAT **topn
BBPunfix(bn1->batCacheid);
return  GDK_FAIL;
}
-   bn4 = BATselect(bi->b, bn3, BUNtail(*bi, last - hseq), NULL, 
true, false, false);
+   bn4 = BATselect(bi->b, bn3, BUNtail(*bi, last - hseq), NULL, 
true, false, false, false);
BBPunfix(bn3->batCacheid);
if (bn4 == NULL) {
BBPunfix(bn1->batCacheid);
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -391,7 +391,7 @@ selectjoin(BAT **r1p, BAT **r2p, BAT **r
return rc;
}
 
-   bn = BATselect(r, rci->s, v, NULL, true, true, false);
+   bn = BATselect(r, rci->s, v, NULL, true, true, false, false);
bat_iterator_end();
if (bn == NULL) {
return GDK_FAIL;
@@ -518,7 +518,7 @@ selectjoin(BAT **r1p, BAT **r2p, BAT **r
mark = 0;
} else {
/* no match, search for NIL in r */
-   BAT *n = BATselect(r, rci->s, ATOMnilptr(r->ttype), 
NULL, true, true, false);
+   BAT *n = BATselect(r, rci->s, ATOMnilptr(r->ttype), 
NULL, true, true, false, false);
if (n == NULL)
goto bailout;
mark = BATcount(n) == 0 ? 0 : bit_nil;
@@ -605,12 +605,12 @@ mergejoin_void(BAT **r1p, BAT **r2p, BAT
/* at this point, the matchable values in r are [lo..hi) */
if (!nil_on_miss) {
assert(r3p == NULL);
-   r1 = BATselect(l, lci->s, , , true, false, 

MonetDB: default - merged with Aug2024

2024-06-19 Thread Niels Nes via checkin-list
Changeset: d78523603c5f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d78523603c5f
Branch: default
Log Message:

merged with Aug2024


diffs (28 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2176,7 +2176,7 @@ BBPinit(bool allow_hge_upgrade)
}
}
 
-   if (MT_create_thread(, BBPmanager, NULL, MT_THR_DETACHED, 
"BBPmanager") < 0) {
+   if (!GDKinmemory(0) && MT_create_thread(, BBPmanager, NULL, 
MT_THR_DETACHED, "BBPmanager") < 0) {
TRC_CRITICAL(GDK, "Could not start BBPmanager thread.");
return GDK_FAIL;
}
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -643,9 +643,9 @@ tc_commit_objectversion(sql_trans *tr, s
(void)oldest;
if (!tr->parent)
change->obj->new = 0;
-   ATOMIC_INC(>cat->schema_version);
-   }
-   else {
+   if (!ov->os->temporary)
+   ATOMIC_INC(>cat->schema_version);
+   } else {
os_rollback(ov, tr->store);
}
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with aug2024

2024-06-11 Thread Niels Nes via checkin-list
Changeset: 24f8685ce20c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/24f8685ce20c
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

merged with aug2024


diffs (71 lines):

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
@@ -2842,8 +2842,10 @@ rel_logical_exp(sql_query *query, sql_re
assert(quantifier == 0 || quantifier == 1 || quantifier == 2 || 
quantifier == 3 || quantifier == 4);
 
if (quantifier >= 3) {
-   if (quantifier == 4)
+   if (quantifier == 4) {
is_distinct_from = true;
+   compare_op = "<>";
+   }
quantifier = 0;
is_semantics = 1;
}
@@ -2859,6 +2861,7 @@ rel_logical_exp(sql_query *query, sql_re
bool rs_is_non_null_atom = exp_is_atom(rs) && 
exp_is_not_null(rs);
 
if (ls_is_non_null_atom || rs_is_non_null_atom) {
+   sql_rel *r = rel_dup(rel);
sql_rel* l = rel_compare(query, rel, sc, lo, 
ro, compare_op, f | sql_or, ek, quantifier, 0);
sql_subtype *t;
if (!(t = 
exp_subtype(rs_is_non_null_atom?ls:rs)))
@@ -2866,9 +2869,10 @@ rel_logical_exp(sql_query *query, sql_re
sql_exp* e = exp_compare(sql->sa, 
rs_is_non_null_atom?ls:rs, exp_atom(sql->sa, atom_general(sql->sa, t, NULL, 
0)), cmp_equal);
set_has_no_nil(e);
set_semantics(e);
-   sql_rel* r = 
rel_select_push_compare_exp_down(sql, rel, e, e->l, e->r, NULL, f | sql_or);
-
-   return rel_or(sql, rel_dup(rel), l, r, NULL, 
NULL, NULL);
+
+   r = rel_select_push_compare_exp_down(sql, r, e, 
e->l, e->r, NULL, f | sql_or);
+
+   return rel_or(sql, rel, l, r, NULL, NULL, NULL);
}
}
 
diff --git a/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test 
b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7534-is-distinct-from.test
@@ -0,0 +1,20 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR)
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('a');
+
+query T
+SELECT t0.c0 FROM t0
+
+a
+
+query T
+SELECT (1 AND ('' IS DISTINCT FROM t0.c0)) FROM t0
+
+True
+
+query T
+SELECT t0.c0 FROM t0 WHERE (1 AND ('' IS DISTINCT FROM t0.c0))
+
+a
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
@@ -61,4 +61,5 @@ 7513-uri-authority-parse-issue
 7514-wrong-window-function
 7524-right-outer-join
 7528-jarowinkler-null
+7534-is-distinct-from
 7535-create-view-groupby-func
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with aug2024

2024-06-07 Thread Niels Nes via checkin-list
Changeset: d48164e0e4d4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d48164e0e4d4
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

merged with aug2024


diffs (32 lines):

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
@@ -1337,9 +1337,8 @@ bool group_by_pk_project_uk_cond(mvc* sq
if (pki && pki->columns->cnt == 1 && inner->r && ((list*) 
inner->r)->cnt == 1) {
/* for now only check simple case where primary key and 
group by expression is a single column*/
sql_exp* gbe = ((list*) inner->r)->h->data;
-   assert(gbe->type == e_column);
sql_column* pkc = ((sql_kc *)pki->columns->h->data)->c;
-   if (strcmp(gbe->alias.name, pkc->base.name) == 0) {
+   if (gbe->type == e_column && strcmp(gbe->alias.name, 
pkc->base.name) == 0) {
node *n;
for (n = ukil->h; n; n = n->next){
sql_idx* uki = n->data;
diff --git a/sql/test/BugTracker-2024/Tests/7535-create-view-groupby-func.test 
b/sql/test/BugTracker-2024/Tests/7535-create-view-groupby-func.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/7535-create-view-groupby-func.test
@@ -0,0 +1,5 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR, c1 INTEGER, PRIMARY KEY(c0))
+
+statement error 42000!SELECT: cannot use non GROUP BY column 't0.c0' in query 
results without an aggregate function
+CREATE VIEW v0(c0) AS SELECT ('a'||t0.c0) FROM t0 GROUP BY (CASE t0.c1 WHEN 
t0.c1 THEN 'a' END )
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
@@ -61,3 +61,4 @@ 7513-uri-authority-parse-issue
 7514-wrong-window-function
 7524-right-outer-join
 7528-jarowinkler-null
+7535-create-view-groupby-func
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with aug2024

2024-06-07 Thread Niels Nes via checkin-list
Changeset: a207071d3ec8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a207071d3ec8
Modified Files:
sql/server/rel_dump.c
Branch: default
Log Message:

merged with aug2024


diffs (78 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -2555,21 +2555,25 @@ exp2sql_dquoted(stream *fout, const char
 
 /* only simple expressions, ie recursive no psm */
 static void
-exp2sql_print(mvc *sql, stream *fout, sql_exp *e)
+exp2sql_print(mvc *sql, stream *fout, sql_exp *e, int depth)
 {
switch (e->type) {
case e_func: {
sql_subfunc *sf = e->f;
list *args = e->l;
if (list_length(args) == 2 && is_infix(sf->func)) {
-   exp2sql_print(sql, fout, args->h->data);
+   if (depth)
+   mnstr_printf(fout, "( " );
+   exp2sql_print(sql, fout, args->h->data, 
depth+1);
mnstr_printf(fout, " %s ", sf->func->base.name);
-   exp2sql_print(sql, fout, args->h->next->data);
+   exp2sql_print(sql, fout, args->h->next->data, 
depth+1);
+   if (depth)
+   mnstr_printf(fout, " )" );
} else {
exp2sql_dquoted(fout, NULL, 
sf->func->base.name, "(");
if (args)
for (node *n = args->h; n; n = n->next) 
{
-   exp2sql_print(sql, fout, 
n->data);
+   exp2sql_print(sql, fout, 
n->data, depth+1);
if (n->next)
mnstr_printf(fout, ", 
");
}
@@ -2581,7 +2585,7 @@ exp2sql_print(mvc *sql, stream *fout, sq
break;
case e_convert:
mnstr_printf(fout, "CAST (" );
-   exp2sql_print(sql, fout, e->l);
+   exp2sql_print(sql, fout, e->l, depth+1);
mnstr_printf(fout, "AS %s)", 
sql_subtype_string(sql->sa, exp_subtype(e)));
break;
case e_atom:
@@ -2609,7 +2613,7 @@ exp2sql( mvc *sql, sql_exp *exp)
if(s == NULL)
goto cleanup;
 
-   exp2sql_print(sql, s, exp);
+   exp2sql_print(sql, s, exp, 0);
 
res = buffer_get_buf(b);
 
diff --git a/sql/test/subquery/Tests/subquery3.test 
b/sql/test/subquery/Tests/subquery3.test
--- a/sql/test/subquery/Tests/subquery3.test
+++ b/sql/test/subquery/Tests/subquery3.test
@@ -624,19 +624,19 @@ query I rowsort
 SELECT col1 FROM another_T WHERE (col2, col3) IN (SELECT 1,2)
 
 
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '(' 
or VALUES or WITH in: "select (1,2) in (1"
+statement error 42000!
 SELECT (1,2) IN (1,2)
 
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '(' 
or VALUES or WITH in: "select (1,2) in (1"
+statement error 42000!
 SELECT (1,2) IN (1)
 
 statement error 42000!Subquery has too few columns
 SELECT (col1, col2) IN (VALUES (1)) FROM another_T
 
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '(' 
or VALUES or WITH in: "select (col1, col2) in (1"
+statement error 42000!
 SELECT (col1, col2) IN (1) FROM another_T
 
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '(' 
or VALUES or WITH in: "select col1 from another_t where (col2, col3) in (1"
+statement error 42000!
 SELECT col1 FROM another_T WHERE (col2, col3) IN (1,2,3)
 
 statement error 42000!Subquery has too few columns
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with aug2024

2024-06-06 Thread Niels Nes via checkin-list
Changeset: acc24cd4639d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/acc24cd4639d
Modified Files:
MonetDB.spec
clients/odbc/winsetup/setup.rc
sql/backends/monet5/sql.c
Branch: default
Log Message:

merged with aug2024


diffs (truncated from 2480 to 300 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -44,6 +44,7 @@ GPATH
 GRTAGS
 TAGS
 tags
+cscope.*
 *.pyo
 *.rej
 *.orig
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,8 +118,14 @@ if(WIN32)
 ${CMAKE_CURRENT_BINARY_DIR}/unistd.h)
 endif()
 
-add_library(monetdb_config_header
-  INTERFACE)
+add_library(monetdb_config_header INTERFACE)
+
+if (CTAGS_PATH)
+  add_dependencies(monetdb_config_header tags)
+endif()
+if (CSCOPE_PATH)
+  add_dependencies(monetdb_config_header cscope)
+endif()
 
 target_include_directories(monetdb_config_header
   INTERFACE
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -417,6 +417,7 @@ developer.
 %{_bindir}/arraytest
 %{_bindir}/bincopydata
 %{_bindir}/murltest
+%{_bindir}/odbcconnect
 %{_bindir}/odbcsample1
 %{_bindir}/sample0
 %{_bindir}/sample1
diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h
--- a/clients/odbc/winsetup/resource.h
+++ b/clients/odbc/winsetup/resource.h
@@ -24,21 +24,21 @@
 #define IDC_EDIT_PORT   2006
 #define IDC_EDIT_DATABASE   2007
 
-// Advanced settings (new from Jun2024)
-#define IDC_EDIT_SCHEMA 2011
-#define IDC_EDIT_LOGINTIMEOUT   2012
-#define IDC_EDIT_REPLYTIMEOUT   2013
-#define IDC_EDIT_REPLYSIZE  2014
-#define IDC_EDIT_AUTOCOMMIT 2015
-#define IDC_EDIT_TIMEZONE   2016
-#define IDC_EDIT_LOGFILE2017
+// Secure connections using TLS
+#define IDC_EDIT_USETLS 2011
+#define IDC_EDIT_SERVERCERT 2012
+#define IDC_EDIT_SERVERCERTHASH 2013
+#define IDC_EDIT_CLIENTKEY  2014
+#define IDC_EDIT_CLIENTCERT 2015
 
-// Secure connections using TLS
-#define IDC_EDIT_USETLS 2021
-#define IDC_EDIT_SERVERCERT 2022
-#define IDC_EDIT_SERVERCERTHASH 2023
-#define IDC_EDIT_CLIENTKEY  2024
-#define IDC_EDIT_CLIENTCERT 2025
+// Advanced settings
+#define IDC_EDIT_SCHEMA 2021
+#define IDC_EDIT_LOGINTIMEOUT   2022
+#define IDC_EDIT_REPLYTIMEOUT   2023
+#define IDC_EDIT_REPLYSIZE  2024
+#define IDC_EDIT_AUTOCOMMIT 2025
+#define IDC_EDIT_TIMEZONE   2026
+#define IDC_EDIT_LOGFILE2027
 
 #define IDC_BUTTON_TEST 2031
 #define IDC_BUTTON_HELP 2032
diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c
--- a/clients/odbc/winsetup/setup.c
+++ b/clients/odbc/winsetup/setup.c
@@ -154,6 +154,13 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
SetDlgItemText(hwndDlg, IDC_EDIT_HOST, datap->host ? 
datap->host : "");
SetDlgItemText(hwndDlg, IDC_EDIT_PORT, datap->port ? 
datap->port : "");
SetDlgItemText(hwndDlg, IDC_EDIT_DATABASE, datap->database ? 
datap->database : "");
+   // Secure connections using TLS
+   SetDlgItemText(hwndDlg, IDC_EDIT_USETLS, datap->use_tls ? 
datap->use_tls : "off");
+   SetDlgItemText(hwndDlg, IDC_EDIT_SERVERCERT, datap->servercert 
? datap->servercert : "");
+   SetDlgItemText(hwndDlg, IDC_EDIT_SERVERCERTHASH, 
datap->servercerthash ? datap->servercerthash : "");
+   SetDlgItemText(hwndDlg, IDC_EDIT_CLIENTKEY, datap->clientkey ? 
datap->clientkey : "");
+   SetDlgItemText(hwndDlg, IDC_EDIT_CLIENTCERT, datap->clientcert 
? datap->clientcert : "");
+   // Advanced settings
SetDlgItemText(hwndDlg, IDC_EDIT_SCHEMA, datap->schema ? 
datap->schema : "");
SetDlgItemText(hwndDlg, IDC_EDIT_LOGINTIMEOUT, 
datap->logintimeout ? datap->logintimeout : "");
SetDlgItemText(hwndDlg, IDC_EDIT_REPLYTIMEOUT, 
datap->replytimeout ? datap->replytimeout : "");
@@ -161,11 +168,6 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPAR
SetDlgItemText(hwndDlg, IDC_EDIT_AUTOCOMMIT, datap->autocommit 
? datap->autocommit : "on");
SetDlgItemText(hwndDlg, IDC_EDIT_TIMEZONE, datap->timezone ? 
datap->timezone : "");
SetDlgItemText(hwndDlg, IDC_EDIT_LOGFILE, datap->logfile ? 
datap->logfile : "");
-   SetDlgItemText(hwndDlg, IDC_EDIT_USETLS, datap->use_tls ? 
datap->use_tls : "off");
-   SetDlgItemText(hwndDlg, IDC_EDIT_SERVERCERT, datap->servercert 
? datap->servercert : "");
-   SetDlgItemText(hwndDlg, IDC_EDIT_SERVERCERTHASH, 
datap->servercerthash ? datap->servercerthash : "");
-   SetDlgItemText(hwndDlg, IDC_EDIT_CLIENTKEY, datap->clientkey ? 

MonetDB: default - merged

2024-05-16 Thread Niels Nes via checkin-list
Changeset: 13142ded24ef for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/13142ded24ef
Branch: default
Log Message:

merged


diffs (274 lines):

diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -55,9 +55,9 @@ override_dh_auto_install:
dh_auto_install
rm debian/tmp/usr/bin/monetdb_mtest.sh
rm -r debian/tmp/usr/share/monetdb
-   rm debian/tmp/usr/lib/*/monetdb5/lib_opt_sql_append.so
-   rm debian/tmp/usr/lib/*/monetdb5/lib_microbenchmark*.so
-   rm debian/tmp/usr/lib/*/monetdb5/lib_udf*.so
+   rm debian/tmp/usr/lib/*/monetdb5*/lib_opt_sql_append.so
+   rm debian/tmp/usr/lib/*/monetdb5*/lib_microbenchmark*.so
+   rm debian/tmp/usr/lib/*/monetdb5*/lib_udf*.so
 
 override_dh_installsystemd:
dh_installsystemd --no-enable --no-start
diff --git a/sql/backends/monet5/generator/generator.c 
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -74,83 +74,93 @@ VLTgenerator_noop(Client cntxt, MalBlkPt
return MAL_SUCCEED;
 }
 
-#define check_bte() (s > 0 ? f > l : f < l)
-#define check_sht() (s > 0 ? f > l : f < l)
-#define check_int() (s > 0 ? f > l : f < l)
+#define check_bte() ((void)0)
+#define check_sht() ((void)0)
 #if SIZEOF_BUN < SIZEOF_LNG
-#define check_lng() (s > 0 ? f > l || s > (lng) BUN_MAX : f < l || s < -(lng) 
BUN_MAX)
+#define check_int()
\
+   do {
\
+   if (cnt > (unsigned int) BUN_MAX)   
\
+   throw(MAL, "generator.table",   
\
+ SQLSTATE(42000) "Illegal generator range");   
\
+   } while (0)
 #else
-#define check_lng() (s > 0 ? f > l : f < l)
+#define check_int() ((void)0)
 #endif
+#define check_lng()
\
+   do {
\
+   if (cnt > (ulng) BUN_MAX)   
\
+   throw(MAL, "generator.table",   
\
+ SQLSTATE(42000) "Illegal generator range");   
\
+   } while (0)
 #ifdef HAVE_HGE
-#define check_hge() (s > 0 ? f > l || s > (lng) BUN_MAX : f < l || s < -(lng) 
BUN_MAX)
+#define check_hge()
\
+   do {
\
+   if (cnt > (uhge) BUN_MAX)   
\
+   throw(MAL, "generator.table",   
\
+ SQLSTATE(42000) "Illegal generator range");   
\
+   } while (0)
 #endif
 
-/*
- * The base line consists of materializing the generator iterator value
- */
-#define VLTmaterialize(TPE)
\
+#define VLTmaterialize(TPE, uTPE)  
\
do {
\
-   TPE *v, f, l, s;
\
+   TPE f, l, s;
\
+   uTPE cnt;   
\
+   
\
f = *getArgReference_##TPE(stk, pci, 1);
\
l = *getArgReference_##TPE(stk, pci, 2);
\
if ( pci->argc == 3)
\
-   s = f<=l? (TPE) 1: (TPE)-1; 
\
-   else s =  *getArgReference_##TPE(stk,pci, 3);   
\
-   if (s == 0 || is_##TPE##_nil(f) || is_##TPE##_nil(l) || 
check_##TPE()) \
+   s = f <= l ? (TPE) 1 : (TPE) -1;  

MonetDB: default - merged

2024-04-28 Thread Niels Nes via checkin-list
Changeset: 9c38920fe185 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9c38920fe185
Branch: default
Log Message:

merged


diffs (125 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1518,8 +1518,13 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (!l)
return NULL;
-   s = stmt_convert(be, l, (!push&>nrcols==0)?NULL:sel, from, 
to);
-   }   break;
+   if (from->type->eclass == EC_SEC && to->type->eclass == EC_SEC) 
{
+   // trivial conversion because EC_SEC is always in 
milliseconds
+   s = l;
+   } else {
+   s = stmt_convert(be, l, (!push&>nrcols==0)?NULL:sel, 
from, to);
+   }
+   }   break;
case e_func: {
node *en;
list *l = sa_list(sql->sa), *exps = e->l;
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -421,22 +421,29 @@ subtype_cmp(sql_subtype *t1, sql_subtype
 {
if (!t1->type || !t2->type)
return -1;
+   if (t1->type->eclass != t2->type->eclass)
+   return -1;
+   switch (t1->type->eclass) {
+   case EC_SEC:
+   case EC_MONTH:
+   if (t1->digits != t2->digits)
+   return -1;
+   return 0;
+   case EC_NUM:
+   break;
+   case EC_FLT:
+   if (t1->digits != t2->digits)
+   return -1;
+   break;
+   default:
+   if (t1->digits != t2->digits)
+   return -1;
+   if (t1->scale != t2->scale)
+   return -1;
+   break;
+   }
 
-   if (t1->type->eclass == t2->type->eclass && t1->type->eclass == EC_SEC)
-   return 0;
-   if (t1->type->eclass == t2->type->eclass && t1->type->eclass == 
EC_MONTH)
-   return 0;
-   if ( !(t1->type->eclass == t2->type->eclass &&
- (EC_INTERVAL(t1->type->eclass) || t1->type->eclass == EC_NUM)) &&
- (t1->digits != t2->digits ||
- (!(t1->type->eclass == t2->type->eclass &&
-  t1->type->eclass == EC_FLT) &&
-  t1->scale != t2->scale)) )
-   return -1;
-
-   /* subtypes are only equal iff
-  they map onto the same systemtype */
-   return (type_cmp(t1->type, t2->type));
+   return type_cmp(t1->type, t2->type);
 }
 
 int
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2964,7 +2964,7 @@ exp_scale_algebra(mvc *sql, sql_subfunc 
sql_subtype *lt = exp_subtype(l);
sql_subtype *rt = exp_subtype(r);
 
-   if (lt->type->scale == SCALE_FIX && (lt->scale || rt->scale) &&
+   if (!EC_INTERVAL(lt->type->eclass) && lt->type->scale == SCALE_FIX && 
(lt->scale || rt->scale) &&
strcmp(sql_func_imp(f->func), "/") == 0) {
sql_subtype *res = f->res->h->data;
unsigned int scale, digits, digL, scaleL;
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2133,17 +2133,7 @@ exp_physical_types(visitor *v, sql_rel *
if (!e || (e->type != e_func && e->type != e_convert) || !e->l)
return e;
 
-   if (e->type == e_convert) {
-   sql_subtype *ft = exp_fromtype(e);
-   sql_subtype *tt = exp_totype(e);
-
-   /* complex conversion matrix */
-   if (ft->type->eclass == EC_SEC && tt->type->eclass == EC_SEC && 
ft->type->digits > tt->type->digits) {
-   /* no conversion needed, just time adjustment */
-   ne = e->l;
-   ne->tpe = *tt; // ugh
-   }
-   } else {
+   if (e->type != e_convert) {
list *args = e->l;
sql_subfunc *f = e->f;
 
diff --git a/sql/test/BugTracker-2023/Tests/All 
b/sql/test/BugTracker-2023/Tests/All
--- a/sql/test/BugTracker-2023/Tests/All
+++ b/sql/test/BugTracker-2023/Tests/All
@@ -25,3 +25,4 @@ orderby-debug-crash-7416
 newurl-issue-7417
 rel_order_by-assertion-7418
 HAVE_LIBPY3?aggregate-vararg.Bug-7422
+interval-day-and-second.Bug-7353
diff --git 
a/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test 
b/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2023/Tests/interval-day-and-second.Bug-7353.test
@@ -0,0 +1,11 @@
+query TTI nosort
+SELECT
+CAST(CAST(value AS TEXT) AS INTERVAL HOUR)AS 

MonetDB: default - merged with dec2023

2024-04-14 Thread Niels Nes via checkin-list
Changeset: 7713c2fcac34 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7713c2fcac34
Modified Files:
sql/server/rel_optimize_proj.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/test/BugTracker-2023/Tests/All
Branch: default
Log Message:

merged with dec2023


diffs (255 lines):

diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -691,7 +691,7 @@ rel_push_project_up_(visitor *v, sql_rel
for (n = rel->exps->h; n && !fnd; n = n->next) {
sql_exp *e = n->data;
 
-   if (e->type != e_aggr && e->type != e_column && e->type 
!= e_atom) {
+   if (e->type != e_aggr && e->type != e_column && e->type 
!= e_atom && e->card > CARD_ATOM) {
fnd = 1;
}
}
@@ -1370,6 +1370,7 @@ rel_project_cse(visitor *v, sql_rel *rel
sql_exp *ne = 
exp_alias(v->sql->sa, exp_relname(e1), exp_name(e1), exp_relname(e2), 
exp_name(e2), exp_subtype(e2), e2->card, has_nil(e2), is_unique(e2), 
is_intern(e1));
 
ne = exp_propagate(v->sql->sa, 
ne, e1);
+   set_selfref(ne);
exp_prop_alias(v->sql->sa, ne, 
e1);
e1 = ne;
break;
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
@@ -4143,7 +4143,7 @@ rel_groupings(sql_query *query, sql_rel 
if (e->type != e_column) { /* 
store group by expressions in the stack */
if 
(is_sql_group_totals(f))
return 
sql_error(sql, 02, SQLSTATE(42000) "GROUP BY: grouping expressions not possible 
with ROLLUP, CUBE and GROUPING SETS");
-   if 
(!frame_push_groupby_expression(sql, grp, e))
+   if (!exp_has_rel(e) && 
!frame_push_groupby_expression(sql, grp, e))
return NULL;
}
list_append(next_tuple, e);
@@ -5188,36 +5188,34 @@ group_merge_exps(mvc *sql, list *gexps, 
 {
int nexps = list_length(gexps) + list_length(exps);
 
-   if (nexps < 5) {
-   return list_distinct(list_merge(gexps, exps, (fdup) NULL), 
(fcmp) exp_equal, (fdup) NULL);
-   } else { /* for longer lists, use hashing */
-   sql_hash *ht = hash_new(sql->ta, nexps, (fkeyvalue)_key);
-
-   for (node *n = gexps->h; n ; n = n->next) { /* first add 
grouping expressions */
-   sql_exp *e = n->data;
-   int key = ht->key(e);
-
-   hash_add(ht, key, e);
-   }
-
-   for (node *n = exps->h; n ; n = n->next) { /* then test if the 
new grouping expressions are already there */
-   sql_exp *e = n->data;
-   int key = ht->key(e);
-   sql_hash_e *he = ht->buckets[key&(ht->size-1)];
-   bool duplicates = false;
-
-   for (; he && !duplicates; he = he->chain) {
-   sql_exp *f = he->value;
-
-   if (!exp_equal(e, f))
-   duplicates = true;
-   }
-   hash_add(ht, key, e);
-   if (!duplicates)
-   list_append(gexps, e);
-   }
-   return gexps;
-   }
+   sql_hash *ht = hash_new(sql->ta, nexps, (fkeyvalue)_key);
+
+   for (node *n = gexps->h; n ; n = n->next) { /* first add grouping 
expressions */
+   sql_exp *e = n->data;
+   int key = ht->key(e);
+
+   hash_add(ht, key, e);
+   }
+
+   for (node *n = exps->h; n ; n = n->next) { /* then test if the new 
grouping expressions are already there */
+   sql_exp *e = n->data;
+   int key = ht->key(e);
+   sql_hash_e *he = ht->buckets[key&(ht->size-1)];
+   bool duplicates = false;
+
+   for (; he && !duplicates; he = he->chain) {
+   sql_exp *f = he->value;
+
+   if (!exp_equal(e, f))
+   duplicates = true;
+   }
+   hash_add(ht, key, e);
+   if (!duplicates) {
+   list_append(gexps, e);
+   

MonetDB: default - merged with dec2023

2024-03-31 Thread Niels Nes via checkin-list
Changeset: 5ff355b9f72c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5ff355b9f72c
Modified Files:
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

merged with dec2023


diffs (47 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1451,6 +1451,25 @@ def PerformDir(env, testdir, testlist, t
 interrupted = True
 finally:
 if pSrvr is not None:
+try:
+dbh = pymonetdb.connect(username='monetdb',
+password='monetdb',
+hostname=HOST,
+port=int(pSrvr.port),
+database=TSTDB,
+autocommit=True)
+except KeyboardInterrupt:
+interrupted = True
+except:
+pass
+else:
+crs = dbh.cursor()
+crs.execute("select count(*), max(id) from sys.bbp()")
+nbats, maxid = crs.fetchall()[0]
+crs.close()
+dbh.close()
+if maxid > nbats and maxid - nbats > 1:
+pSrvr.outfile.write(f'Too many free bats.  Max ID = 
{maxid}, # used = {nbats}, diff = {maxid - nbats}.')
 pSrvr.terminate()
 pSrvr = None
 if produce_html:
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -1743,8 +1743,13 @@ monetdbe_execute(monetdbe_statement *stm
goto cleanup;
}
 
-   (*(monetdbe_result_internal**) result)->type = (b->results) ? 
Q_TABLE : Q_UPDATE;
res_internal = *(monetdbe_result_internal**)result;
+   res_internal->type = (b->results) ? Q_TABLE : Q_UPDATE;
+   if (res_internal->monetdbe_resultset && 
res_internal->monetdbe_resultset->query_type == Q_TABLE) {
+   res_internal->type = Q_TABLE;
+   if (affected_rows)
+   *affected_rows = 
res_internal->monetdbe_resultset->nr_rows;
+   }
}
 
 cleanup:
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with dec2023

2024-03-06 Thread Niels Nes via checkin-list
Changeset: c697e12b3e43 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c697e12b3e43
Modified Files:
sql/server/rel_exp.c
sql/server/rel_optimize_sel.c
sql/server/rel_select.c
sql/test/BugTracker-2023/Tests/misc-crashes-7390.test
Branch: default
Log Message:

merged with dec2023


diffs (131 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -922,6 +922,8 @@ exp_rel(mvc *sql, sql_rel *rel)
e->flag = PSM_REL;
e->card = is_single(rel)?CARD_ATOM:rel->card;
assert(rel);
+   if (is_topn(rel->op))
+   rel = rel->l;
if (is_project(rel->op)) {
sql_exp *last = rel->exps->t->data;
sql_subtype *t = exp_subtype(last);
@@ -2340,8 +2342,13 @@ exp_rel_update_exp(mvc *sql, sql_exp *e,
return e;
case e_psm:
if (exp_is_rel(e)) {
-   sql_rel *r = exp_rel_get_rel(sql->sa, e);
-   e = r->exps->t->data;
+   sql_rel *r = exp_rel_get_rel(sql->sa, e), *nr = r;
+   if (is_topn(r->op)) {
+   nr = r->l;
+   if (nr && !is_project(nr->op))
+   r->l = nr = rel_project(sql->sa, nr, 
rel_projections(sql, nr, NULL, 1, 0));
+   }
+   e = nr->exps->t->data;
e = exp_ref(sql, e);
if (up)
set_freevar(e, 1);
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
@@ -2589,15 +2589,17 @@ rel_rewrite_semijoin(visitor *v, sql_rel
if (exp_find_column(rl, ne->l, -2) == cl) {
sql_exp *e = (or != r)?rel_find_exp(or, 
re):re;
 
-   equal = exp_match_exp(ne->r, e);
-   if (!equal)
+   if (e)
+   equal = exp_match_exp(ne->r, e);
+   if (!e || !equal)
return rel;
re = ne->r;
} else if (exp_find_column(rl, ne->r, -2) == 
cl) {
sql_exp *e = (or != r)?rel_find_exp(or, 
re):re;
 
-   equal = exp_match_exp(ne->l, e);
-   if (!equal)
+   if (e)
+   equal = exp_match_exp(ne->l, e);
+   if (!e || !equal)
return rel;
re = ne->l;
} else
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
@@ -4133,7 +4133,8 @@ rel_groupings(sql_query *query, sql_rel 
next_set = list_append(new_exp_list(sql->sa), 
new_exp_list(sql->sa));
}
if (is_sql_group_totals(f)) { /* if there are no sets, set the 
found one, otherwise calculate cartesian product and merge the distinct ones */
-   assert(next_set);
+   if (!next_set)
+   return sql_error(sql, 02, SQLSTATE(42000) 
"GROUP BY: GROUPING SETS is empty");
if (!*sets)
*sets = next_set;
else
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 42000!CATALOG: no such function 'sys'.'='
+statement ok
 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
@@ -259,8 +259,7 @@ query I nosort
 WITH v0 (v1) AS (SELECT 127 FROM v0 WHERE (v1 < 2147483647 OR v1 > -1) AND v1 
/ v1 + v1 <= 95 = v1 >= -128 + 15) SELECT 38 ^ v1 FROM v0 AS v3 WINDOW v2 AS ( 
), v4 AS (GROUPS BETWEEN -32768 PRECEDING AND 94 FOLLOWING) LIMIT 16 OFFSET 8
 
 
-skipif knownfail
-statement ok
+statement error 42000!SELECT: identifier 'v1' ambiguous
 UPDATE v0 SET v1 = (WITH v0 (v1) AS (SELECT 127 WHERE (v1 < 2147483647 OR v1 > 
-1) AND v1 / v1 + v1 <= 95 = v1 >= -128 + 15) SELECT 38 FROM v0 AS v3 WINDOW v2 
AS ( ), v4 AS (GROUPS BETWEEN -32768 PRECEDING AND 94 FOLLOWING) LIMIT 16 
OFFSET 8) ^ v1
 -- 

MonetDB: default - merged with dec2023

2024-03-04 Thread Niels Nes via checkin-list
Changeset: bb6527fa7586 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bb6527fa7586
Modified Files:
sql/server/rel_exp.c
sql/server/rel_schema.c
sql/storage/store.c
Branch: default
Log Message:

merged with dec2023


diffs (119 lines):

diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -1849,7 +1849,7 @@ exp_two_sided_bound_cmp_exp_is_false(sql
 sql_exp* h = e->f;
 assert (v && l && h);
 
-return is_anti(e) ? exp_is_null(v) || (exp_is_null(l) && exp_is_null(h)) : 
exp_is_null(l) || exp_is_null(v) || exp_is_null(h);
+return is_anti(e) ? exp_is_null(v) || (exp_is_null(l) && exp_is_null(h)) : 
false;
 }
 
 static inline bool
diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -612,10 +612,12 @@ column_options(sql_query *query, dlist *
}
used |= (1token == SQL_IDENT) {
+   if (sym->token == SQL_COLUMN || 
sym->token == SQL_IDENT || sym->token == SQL_NEXT) {
exp_kind ek = {type_value, 
card_value, FALSE};
sql_exp *e = 
rel_logical_value_exp(query, NULL, sym, sql_sel, ek);
 
+   if (!e)
+   return SQL_ERR;
if (e && is_atom(e->type)) {
atom *a = 
exp_value(sql, e);
 
@@ -1087,6 +1089,34 @@ table_element(sql_query *query, symbol *
sql_error(sql, ERR_NOTFOUND, SQLSTATE(42S22) "%s: no 
such column '%s'\n", action, cname);
return SQL_ERR;
}
+   if (sym->token == SQL_COLUMN || sym->token == SQL_IDENT || 
sym->token == SQL_NEXT) {
+   exp_kind ek = {type_value, card_value, FALSE};
+   sql_exp *e = rel_logical_value_exp(query, NULL, 
sym, sql_sel, ek);
+
+   if (!e)
+   return SQL_ERR;
+   if (e && is_atom(e->type)) {
+   atom *a = exp_value(sql, e);
+
+   if (a && atom_null(a)) {
+   switch (mvc_default(sql, c, 
NULL)) {
+   case -1:
+   (void) sql_error(sql, 
02, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   return SQL_ERR;
+   case -2:
+   case -3:
+   (void) sql_error(sql, 
02, SQLSTATE(42000) "DEFAULT: transaction conflict detected while setting 
default value");
+   return SQL_ERR;
+   default:
+   break;
+   }
+   break;
+   }
+   }
+   /* reset error */
+   sql->session->status = 0;
+   sql->errstr[0] = '\0';
+   }
r = symbol2string(sql, sym, 0, );
if (!r) {
(void) sql_error(sql, 02, SQLSTATE(42000) "%s: 
incorrect default value '%s'\n", action, err?err:"");
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -4488,9 +4488,10 @@ sys_drop_default_object(sql_trans *tr, s
 
extract_schema_and_sequence_name(NULL, col->def + 
strlen(next_value_for), , _name);
if (!schema || !seq_name || !(s = find_sql_schema(tr, schema))) 
{
+   /* didn't find the schema so no generated sequence */
_DELETE(schema);
_DELETE(seq_name);
-   return -1;
+   return res;
}
 
seq = find_sql_sequence(tr, s, seq_name);
diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -116,3 +116,4 @@ savepoint-release
 procedure-recompile
 rse_bug
 delete-or-not-in-bug
+default-error
diff --git a/sql/test/bugs/Tests/default-error.test 
b/sql/test/bugs/Tests/default-error.test
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/default-error.test
@@ -0,0 +1,27 @@
+statement ok
+CREATE TABLE "experiments" (
+   "id"   BIGINT   

MonetDB: default - merged with dec2023

2024-02-25 Thread Niels Nes via checkin-list
Changeset: a88de66d99cc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a88de66d99cc
Modified Files:
sql/server/rel_optimize_sel.c
Branch: default
Log Message:

merged with dec2023


diffs (18 lines):

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;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with dec2023

2024-02-19 Thread Niels Nes via checkin-list
Changeset: 3829bce08f77 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3829bce08f77
Modified Files:
clients/Tests/MAL-signatures.test
sql/server/rel_optimize_others.c
Branch: default
Log Message:

merged with dec2023


diffs (78 lines):

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 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/sql/server/rel_optimize_others.c b/sql/server/rel_optimize_others.c
--- a/sql/server/rel_optimize_others.c
+++ b/sql/server/rel_optimize_others.c
@@ -392,6 +392,8 @@ rel_exps_mark_used(sql_allocator *sa, sq
for (node *n = rel->attr->h; n; n = n->next) {
sql_exp *e = n->data;
 
+   if (e->type != e_aggr) /* keep all group by's */
+   e->used = 1;
if (e->used)
nr += exp_mark_used(subrel, e, -2);
}
diff --git a/sql/server/rel_statistics_functions.c 
b/sql/server/rel_statistics_functions.c
--- a/sql/server/rel_statistics_functions.c
+++ b/sql/server/rel_statistics_functions.c
@@ -409,7 +409,11 @@ sql_sign_propagate_statistics(mvc *sql, 
atom *zero1 = atom_zero_value(sql->sa, &(omin->tpe));
int cmp1 = atom_cmp(omax, zero1), cmp2 = atom_cmp(omin, zero1);
 
-   if (cmp1 >= 0 && cmp2 >= 0) {
+   if (cmp1 == 0 && cmp2 == 0) {
+   set_minmax_property(sql, e, PROP_MAX, atom_int(sql->sa, 
bte, 0));
+   set_minmax_property(sql, e, PROP_MIN, atom_int(sql->sa, 
bte, 0));
+   properties_set = true;
+   } else if (cmp1 > 0 && cmp2 > 0) {
set_minmax_property(sql, e, PROP_MAX, atom_int(sql->sa, 
bte, 1));
set_minmax_property(sql, e, PROP_MIN, atom_int(sql->sa, 
bte, 1));
properties_set = true;
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
@@ -24,3 +24,4 @@ between-boolean-7451
 concat_order-7455
 order-by-false-or-false-Bug-7456
 constant-expression-issue-7457
+sign-issue-7458
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with dec2023

2024-02-18 Thread Niels Nes via checkin-list
Changeset: 57d8771f2335 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/57d8771f2335
Modified Files:
sql/backends/monet5/rel_bin.c
Branch: default
Log Message:

merged with dec2023


diffs (55 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4357,7 +4357,7 @@ rel2bin_select(backend *be, sql_rel *rel
if (s->nrcols == 0){
if (!predicate && sub && !list_empty(sub->op4.lval))
predicate = stmt_const(be, 
bin_find_smallest_column(be, sub), stmt_bool(be, 1));
-   else
+   else if (!predicate)
predicate = const_column(be, stmt_bool(be, 1));
if (e->type != e_cmp) {
sql_subtype *bt = sql_bind_localtype("bit");
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
@@ -23,3 +23,4 @@ where_null-7450
 between-boolean-7451
 concat_order-7455
 order-by-false-or-false-Bug-7456
+constant-expression-issue-7457
diff --git a/sql/test/BugTracker-2024/Tests/constant-expression-issue-7457.test 
b/sql/test/BugTracker-2024/Tests/constant-expression-issue-7457.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/constant-expression-issue-7457.test
@@ -0,0 +1,30 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR(500), c1 BOOLEAN)
+
+statement ok
+INSERT INTO t0 (c0, c1) VALUES ('a', false)
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('b')
+
+query TT
+SELECT * FROM t0
+
+a
+False
+b
+NULL
+
+query T
+SELECT (1 AND 3) FROM t0
+
+True
+True
+
+query TT
+SELECT * FROM t0 WHERE (1 AND 3)
+
+a
+False
+b
+NULL
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with dec2023

2024-02-17 Thread Niels Nes via checkin-list
Changeset: 2ea4647d0d5c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2ea4647d0d5c
Modified Files:
clients/Tests/MAL-signatures-hge.test
gdk/gdk_select.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/server/rel_optimize_sel.c
sql/server/rel_propagate.c
sql/test/information-schema/Tests/columns.test
Branch: default
Log Message:

merged with dec2023


diffs (truncated from 1188 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -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/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1199,6 +1199,7 @@ BATrange(BATiter *bi, const void *tl, co
const ValRecord *minprop = NULL, *maxprop = NULL;
const void *minval = NULL, *maxval = NULL;
bool maxincl = true;
+   BAT *pb = NULL;
int c;
int (*atomcmp) (const void *, const void *) = ATOMcompare(bi->type);
 
@@ -1222,6 +1223,27 @@ BATrange(BATiter *bi, const void *tl, co
maxval = VALptr(maxprop);
maxincl = false;
}
+   if (minprop == NULL || maxprop == NULL) {
+   if (VIEWtparent(bi->b) &&
+   (pb = BATdescriptor(VIEWtparent(bi->b))) != NULL) {
+   bool keep = false;
+   MT_lock_set(>theaplock);
+   if (minprop == NULL && (minprop = BATgetprop_nolock(pb, 
GDK_MIN_BOUND)) != NULL) {
+   keep = true;
+   minval = VALptr(minprop);
+   }
+   if (maxprop == NULL && (maxprop = BATgetprop_nolock(pb, 
GDK_MAX_BOUND)) != NULL) {
+   keep = true;
+   maxval = VALptr(maxprop);
+   maxincl = true;
+   }
+   if (!keep) {
+   MT_lock_unset(>theaplock);
+   BBPreclaim(pb);
+   pb = NULL;
+   }
+   }
+   }
 
if (minprop == NULL && maxprop == NULL) {
range = range_inside; /* strictly: unknown */
@@ -1306,6 +1328,11 @@ BATrange(BATiter *bi, const void *tl, co
}
}
 
+   if (pb) {
+   MT_lock_unset(>theaplock);
+   BBPreclaim(pb);
+   }
+
MT_lock_unset(>b->theaplock);
return range;
 }
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
@@ -4355,8 +4355,10 @@ rel2bin_select(backend *be, sql_rel *rel
return NULL;
}
if (s->nrcols == 0){
-   if 

MonetDB: default - merged with Dec2023

2024-02-11 Thread Niels Nes via checkin-list
Changeset: 8b86b26d5058 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8b86b26d5058
Modified Files:
gdk/gdk_calc_addsub.c
Branch: default
Log Message:

merged with Dec2023


diffs (176 lines):

diff --git a/gdk/gdk_calc_addsub.c b/gdk/gdk_calc_addsub.c
--- a/gdk/gdk_calc_addsub.c
+++ b/gdk/gdk_calc_addsub.c
@@ -1590,9 +1590,9 @@ BATcalcaddcst(BAT *b, const ValRecord *v
 
/* if the input is sorted, and no overflow occurred, the result
 * is also sorted */
-   bn->tsorted = (bi.sorted && nils == 0) ||
+   bn->tsorted = (bi.sorted && nils == 0 && bi.type != TYPE_str) ||
ci.ncand <= 1 || nils == ci.ncand;
-   bn->trevsorted = (bi.revsorted && nils == 0) ||
+   bn->trevsorted = (bi.revsorted && nils == 0 && bi.type != TYPE_str) ||
ci.ncand <= 1 || nils == ci.ncand;
bn->tkey = ci.ncand <= 1;
bn->tnil = nils != 0;
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
@@ -21,3 +21,4 @@ where-cond-issue-7448
 function_return_issue
 where_null-7450
 between-boolean-7451
+concat_order-7455
diff --git a/sql/test/BugTracker-2024/Tests/between-boolean-7451.test 
b/sql/test/BugTracker-2024/Tests/between-boolean-7451.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/between-boolean-7451.test
@@ -0,0 +1,47 @@
+
+statement ok
+CREATE TABLE t0(c0 VARCHAR, PRIMARY KEY(c0))
+
+statement ok
+CREATE TABLE t1(c1 INTEGER, c2 VARCHAR(500))
+
+statement ok
+INSERT INTO t0 ( c0) VALUES ('a')
+
+statement ok
+INSERT INTO t0 (c0) VALUES (false)
+
+statement ok
+INSERT INTO t1 ( c1) VALUES (0)
+
+query IT
+SELECT t1.c1, t1.c2 FROM t1, t0
+
+0
+NULL
+0
+NULL
+
+query T
+SELECT (NOT CAST((true BETWEEN t1.c2 AND t0.c0) AS VARCHAR)) FROM t1, t0
+
+True
+True
+
+query IT
+SELECT t1.c1, t1.c2 FROM t1, t0 WHERE (NOT CAST((true BETWEEN t1.c2 AND t0.c0) 
AS VARCHAR));
+
+0
+NULL
+0
+NULL
+
+query ITT
+SELECT * FROM t1, t0 WHERE (NOT CAST((true BETWEEN t1.c2 AND t0.c0) AS 
VARCHAR)); -- 2 rows
+
+0
+NULL
+a
+0
+NULL
+false
diff --git a/sql/test/BugTracker-2024/Tests/concat_order-7455.test 
b/sql/test/BugTracker-2024/Tests/concat_order-7455.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/concat_order-7455.test
@@ -0,0 +1,71 @@
+statement ok
+CREATE TABLE t0(c0 VARCHAR, c1 VARCHAR(500))
+
+statement ok
+CREATE VIEW v0(c0) AS SELECT true FROM t0
+
+statement ok
+INSERT INTO t0 (c0, c1) VALUES ('', 0)
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('a')
+
+statement ok
+INSERT INTO t0 (c0) VALUES ('b')
+
+query TTT
+SELECT * FROM v0, t0
+
+True
+(empty)
+0
+True
+a
+NULL
+True
+b
+NULL
+True
+(empty)
+0
+True
+a
+NULL
+True
+b
+NULL
+True
+(empty)
+0
+True
+a
+NULL
+True
+b
+NULL
+
+query T
+SELECT (t0.c0||true BETWEEN v0.c0 AND v0.c0) FROM v0, t0
+
+True
+False
+False
+True
+False
+False
+True
+False
+False
+
+query TTT
+SELECT * FROM v0, t0 WHERE (t0.c0||true BETWEEN v0.c0 AND v0.c0); 
+
+True
+(empty)
+0
+True
+(empty)
+0
+True
+(empty)
+0
diff --git a/sql/test/BugTracker-2024/Tests/where_null-7450.test 
b/sql/test/BugTracker-2024/Tests/where_null-7450.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2024/Tests/where_null-7450.test
@@ -0,0 +1,20 @@
+statement ok
+CREATE TABLE t0(c0 INT);
+
+statement ok
+INSERT INTO t0 ( c0) VALUES (false);
+
+statement ok
+CREATE VIEW v0(c0) AS SELECT true FROM t0 WHERE NULL GROUP BY t0.c0, true;
+
+query I
+SELECT * FROM v0;
+
+
+query I
+SELECT * FROM v0 WHERE true;
+
+
+query I
+SELECT * FROM v0 WHERE true UNION ALL SELECT * FROM v0 WHERE (NOT true);
+
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Dec2023

2024-02-05 Thread Niels Nes via checkin-list
Changeset: 405ebfd12335 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/405ebfd12335
Modified Files:
sql/test/file_loader/Tests/file_loader_function.test
Branch: default
Log Message:

merged with Dec2023


diffs (truncated from 1076 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1362,6 +1362,8 @@ exp2bin_file_loader(backend *be, sql_exp
 
file_loader_t *fl = fl_find(ext);
if (!fl)
+   fl = fl_find("csv");
+   if (!fl)
return NULL;
sql_exp *fexp = arg_list->h->data;
assert(is_atom(fexp->type));
diff --git a/sql/backends/monet5/vaults/csv/csv.c 
b/sql/backends/monet5/vaults/csv/csv.c
--- a/sql/backends/monet5/vaults/csv/csv.c
+++ b/sql/backends/monet5/vaults/csv/csv.c
@@ -189,6 +189,8 @@ detect_bool(const char *s, const char *e
 static bool
 detect_bigint(const char *s, const char *e)
 {
+   if (s[0] == '-' || s[0] == '+')
+   s++;
while(s < e) {
if (!isdigit(*s))
break;
@@ -204,6 +206,8 @@ detect_decimal(const char *s, const char
 {
int dotseen = 0;
 
+   if (s[0] == '-' || s[0] == '+')
+   s++;
while(s < e) {
if (!dotseen && *s == '.')
dotseen = (int)(e-(s+1));
@@ -371,6 +375,7 @@ typedef struct csv_t {
char quote;
char delim;
bool has_header;
+   bool extra_tsep;
 } csv_t;
 
 /*
@@ -402,7 +407,7 @@ csv_relation(mvc *sql, sql_subfunc *f, c
if (l<0)
return RUNTIME_LOAD_ERROR;
buf[l] = 0;
-   bool has_header = false;
+   bool has_header = false, extra_tsep = false;
int nr_fields = 0;
char q = detect_quote(buf);
char d = detect_delimiter(buf, q, _fields);
@@ -425,13 +430,20 @@ csv_relation(mvc *sql, sql_subfunc *f, c
sql_subtype *t = (types[col].type == CSV_DECIMAL)?
sql_bind_subtype(sql->sa, st, 18, 
types[col].scale):
sql_bind_subtype(sql->sa, st,  0, 
types[col].scale);
-
-   list_append(typelist, t);
-   list_append(res_exps, exp_column(sql->sa, NULL, name, 
t, CARD_MULTI, 1, 0, 0));
+   if (!t && (col+1) == nr_fields && types[col].type == 
CSV_NULL) {
+   nr_fields--;
+   extra_tsep = true;
+   } else if (t) {
+   list_append(typelist, t);
+   list_append(res_exps, exp_column(sql->sa, NULL, 
name, t, CARD_MULTI, 1, 0, 0));
+   } else {
+   GDKfree(types);
+   throw(SQL, SQLSTATE(42000), "csv" "type %s not 
found\n", st);
+   }
} else {
/* shouldn't be possible, we fallback to strings */
GDKfree(types);
-   assert(0);
+   throw(SQL, SQLSTATE(42000), "csv" "type unknown\n");
}
}
GDKfree(types);
@@ -443,6 +455,7 @@ csv_relation(mvc *sql, sql_subfunc *f, c
r->sname[0] = 0;
r->quote = q;
r->delim = d;
+   r->extra_tsep = extra_tsep;
r->has_header = has_header;
f->sname = (char*)r; /* pass schema++ */
return MAL_SUCCEED;
@@ -467,7 +480,7 @@ csv_load(void *BE, sql_subfunc *f, char 
sql_subtype *tp = tn->data;
sql_column *c = NULL;
 
-   if (mvc_create_column(, be->mvc, t, name, tp) != LOG_OK) {
+   if (!tp || mvc_create_column(, be->mvc, t, name, tp) != 
LOG_OK) {
//throw(SQL, SQLSTATE(42000), "csv" RUNTIME_LOAD_ERROR);
return NULL;
}
@@ -480,15 +493,23 @@ csv_load(void *BE, sql_subfunc *f, char 
 
sql_subtype tpe;
sql_find_subtype(, "varchar", 0, 0);
-   char tsep[2], ssep[2];
+   char tsep[2], rsep[3], ssep[2];
tsep[0] = r->delim;
tsep[1] = 0;
ssep[0] = r->quote;
ssep[1] = 0;
+   if (r->extra_tsep) {
+   rsep[0] = r->delim;
+   rsep[1] = '\n';
+   rsep[2] = 0;
+   } else {
+   rsep[0] = '\n';
+   rsep[1] = 0;
+   }
list *args = append( append( append( append( append( 
new_exp_list(sql->sa),
exp_atom_ptr(sql->sa, t)),
exp_atom_str(sql->sa, tsep, )),
-   exp_atom_str(sql->sa, "\n", )),
+   exp_atom_str(sql->sa, rsep, )),
exp_atom_str(sql->sa, ssep, )),
exp_atom_str(sql->sa, "", ));
 
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
@@ -563,7 +563,9 @@ 

MonetDB: default - Merged client_interrupts branch into default.

2024-01-11 Thread Sjoerd Mullender via checkin-list
Changeset: 35dd9dee1374 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/35dd9dee1374
Branch: default
Log Message:

Merged client_interrupts branch into default.


diffs (truncated from 8089 to 300 lines):

diff --git a/clients/ChangeLog b/clients/ChangeLog
--- a/clients/ChangeLog
+++ b/clients/ChangeLog
@@ -1,3 +1,12 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Jan 10 2024 Sjoerd Mullender 
+- Implemented interrupt handling in mclient.  When using mclient
+  interactively, an interrupt (usually control-C) stops whatever the
+  client is doing.  When editing a line, the line is discarded; when
+  editing a second or later line of a query, the whole query is discarded;
+  when a query is being executed, the server is asked to stop the query
+  at its earliest convenience.  Stopping a running query can only be
+  done with an up-to-date server.  All of this does not work on Windows.
+
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
@@ -681,6 +681,7 @@ MapiMsg mapi_ping(Mapi mid) __attribute_
 MapiHdl mapi_prepare(Mapi mid, const char *cmd) 
__attribute__((__nonnull__(1)));
 MapiMsg mapi_prepare_handle(MapiHdl hdl, const char *cmd) 
__attribute__((__nonnull__(1)));
 MapiHdl mapi_query(Mapi mid, const char *cmd) __attribute__((__nonnull__(1)));
+MapiMsg mapi_query_abort(MapiHdl hdl, int reason) 
__attribute__((__nonnull__(1)));
 MapiMsg mapi_query_done(MapiHdl hdl) __attribute__((__nonnull__(1)));
 MapiMsg mapi_query_handle(MapiHdl hdl, const char *cmd) 
__attribute__((__nonnull__(1)));
 MapiMsg mapi_query_part(MapiHdl hdl, const char *cmd, size_t size) 
__attribute__((__nonnull__(1)));
@@ -797,7 +798,7 @@ BUN SQLload_file(Client cntxt, Tablet *a
 str TABLETcollect(BAT **bats, Tablet *as);
 str TABLETcreate_bats(Tablet *as, BUN est);
 void TABLETdestroy_format(Tablet *as);
-int TABLEToutput_file(Tablet *as, BAT *order, stream *s);
+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);
@@ -1643,6 +1644,7 @@ stream *block_stream(stream *s);
 stream *bs_stream(stream *s);
 bstream *bstream_create(stream *rs, size_t chunk_size);
 void bstream_destroy(bstream *s);
+int bstream_getoob(bstream *s);
 ssize_t bstream_next(bstream *s);
 ssize_t bstream_read(bstream *s, size_t size);
 buffer *buffer_create(size_t size);
@@ -1682,12 +1684,14 @@ int mnstr_fsetpos(stream *restrict s, fp
 int mnstr_fsync(stream *s);
 buffer *mnstr_get_buffer(stream *s);
 bool mnstr_get_swapbytes(const stream *s);
+int mnstr_getoob(const stream *s);
 int mnstr_init(void);
 int mnstr_isalive(const stream *s);
 bool mnstr_isbinary(const stream *s);
 const char *mnstr_name(const stream *s);
 const char *mnstr_peek_error(const stream *s);
 int mnstr_printf(stream *restrict s, _In_z_ _Printf_format_string_ const char 
*restrict format, ...) __attribute__((__format__(__printf__, 2, 3)));
+int mnstr_putoob(const stream *s, char val);
 ssize_t mnstr_read(stream *restrict s, void *restrict buf, size_t elmsize, 
size_t cnt);
 int mnstr_readBte(stream *restrict s, int8_t *restrict val);
 int mnstr_readBteArray(stream *restrict s, int8_t *restrict val, size_t cnt);
diff --git a/clients/mapiclient/ReadlineTools.c 
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -35,6 +35,9 @@
 #include 
 #endif
 
+#include 
+#include 
+
 static const char *sql_commands[] = {
"SELECT",
"INSERT",
@@ -421,6 +424,30 @@ bailout:
return 1;
 }
 
+static sigjmp_buf readline_jumpbuf;
+static volatile sig_atomic_t mayjump;
+
+void
+readline_int_handler(void)
+{
+   if (mayjump) {
+   mayjump = false;
+   siglongjmp(readline_jumpbuf, 1);
+   }
+}
+
+char *
+call_readline(const char *prompt)
+{
+   char *res;
+   if (sigsetjmp(readline_jumpbuf, 1) != 0)
+   return (char *) -1; /* interrupted */
+   mayjump = true;
+   res = readline(prompt); /* normal code path */
+   mayjump = false;
+   return res;
+}
+
 void
 init_readline(Mapi mid, const char *lang, bool save_history)
 {
@@ -501,5 +528,4 @@ save_line(const char *s)
append_history(1, _history_file);
 }
 
-
 #endif /* HAVE_LIBREADLINE */
diff --git a/clients/mapiclient/ReadlineTools.h 
b/clients/mapiclient/ReadlineTools.h
--- a/clients/mapiclient/ReadlineTools.h
+++ b/clients/mapiclient/ReadlineTools.h
@@ -22,6 +22,8 @@ void deinit_readline(void);
 void save_line(const char *s);
 rl_completion_func_t *suspend_completion(void);
 void continue_completion(rl_completion_func_t * func);
+void readline_int_handler(void);
+char *call_readline(const char *prompt);
 
 #endif /* HAVE_LIBREADLINE */
 #endif /* READLINETOOLS_H_INCLUDED */
diff --git a/clients/mapiclient/mclient.1 

MonetDB: default - merged with Dec2023

2024-01-04 Thread Niels Nes via checkin-list
Changeset: 9d76655ea97a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9d76655ea97a
Branch: default
Log Message:

merged with Dec2023


diffs (110 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -3428,13 +3428,11 @@ log_printinfo(logger *lg)
printf("number of flushers: %d\n", (int) ATOMIC_GET(>nr_flushers));
printf("number of catalog entries "BUNFMT", of which "BUNFMT" 
deleted\n",
   lg->catalog_bid->batCount, lg->dcatalog->batCount);
-   int npend = 0;
for (logged_range *p = lg->pending; p; p = p->next) {
char buf[32];
if (p->output_log == NULL ||
snprintf(buf, sizeof(buf), ", file size %"PRIu64, 
(uint64_t) getfilepos(getFile(lg->current->output_log))) >= (int) sizeof(buf))
buf[0] = 0;
printf("pending range "ULLFMT": drops %"PRIu64", last_ts 
%"PRIu64", flushed_ts %"PRIu64", refcount %"PRIu64"%s%s\n", p->id, (uint64_t) 
ATOMIC_GET(>drops), (uint64_t) ATOMIC_GET(>last_ts), (uint64_t) 
ATOMIC_GET(>flushed_ts), (uint64_t) ATOMIC_GET(>refcount), buf, p == 
lg->current ? " (current)" : "");
-   npend++;
}
 }
diff --git a/sql/scripts/40_json.sql b/sql/scripts/40_json.sql
--- a/sql/scripts/40_json.sql
+++ b/sql/scripts/40_json.sql
@@ -50,7 +50,7 @@ returns bool external name json.isvalid;
 GRANT EXECUTE ON FUNCTION json.isvalid(string) TO PUBLIC;
 
 create function json.isvalid(js json)
-returns bool begin return true; end;
+returns bool begin return case when js is NULL then NULL else true end; end;
 GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC;
 
 create function json.isobject(js json)
diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -2935,7 +2935,7 @@ rel_groupjoin(visitor *v, sql_rel *rel)
}
}
if (nr == list_length(gbes)) {
-   printf("#group by converted\n");
+   // printf("#group by converted\n");
j = rel_dup(j);
j->attr = rel->exps;
v->changes++;
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
@@ -3000,7 +3000,7 @@ rel_simplify_project_fk_join(mvc *sql, s
if (!list_empty(r->attr)) {
nr = rel_groupby(sql, nr, NULL);
if (nr) {
-   printf("# introduced groupby  \n");
+   // printf("# introduced groupby  \n");
nr->r = append(sa_list(sql->sa), le);
nr->exps = r->attr;
}
@@ -3636,7 +3636,7 @@ rel_select_leftgroup_2_semi(visitor *v, 
sql_exp *a = attrs->h->data;
 
if (exps_find_exp(l->attr, e->l) && exp_is_true(e->r) 
&& e->flag == cmp_equal /*&& exp_is_true(a)*/) {
-   printf("# optimize select leftgroup -> semi\n");
+   // printf("# optimize select leftgroup -> 
semi\n");
if (!list_empty(l->exps)) {
for(node *m = l->exps->h; m; m = 
m->next) {
sql_exp *j = m->data;
diff --git a/sql/test/SQLancer/Tests/sqlancer17.test 
b/sql/test/SQLancer/Tests/sqlancer17.test
--- a/sql/test/SQLancer/Tests/sqlancer17.test
+++ b/sql/test/SQLancer/Tests/sqlancer17.test
@@ -363,7 +363,7 @@ create or replace view v30(vc0) as (sele
 query I nosort
 select json."isvalid"(CAST(v30.vc0 AS JSON)) FROM v30
 
-1
+NULL
 
 statement ok
 ROLLBACK
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1701,7 +1701,7 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "json", "integer",  "SYSTEM",   "create 
function json.\"integer\"(js json) returns bigint external name 
json.\"integer\";", "json", "MAL",  "Scalar function",  false,  false,  
false,  true,   NULL,   "result",   "bigint",   64, 0,  "out",  
"js",   "json", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]

MonetDB: default - merged from Jun2023

2023-11-11 Thread Ying Zhang via checkin-list
Changeset: c490f0d7c83d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c490f0d7c83d
Branch: default
Log Message:

merged from Jun2023


diffs (53 lines):

diff --git a/sql/test/BugTracker-2023/Tests/union-query-7401.test 
b/sql/test/BugTracker-2023/Tests/union-query-7401.test
--- a/sql/test/BugTracker-2023/Tests/union-query-7401.test
+++ b/sql/test/BugTracker-2023/Tests/union-query-7401.test
@@ -15,31 +15,31 @@ 1
 20
 2
 
-query II rowsort
+query II rowsort gb-over-bt
 select a as a, b as b from t7401
 UNION
 select b as a, a as b from t7401
 
 1
 10
+10
+1
 2
 20
-10
-1
 20
 2
 
-query II rowsort
+query II rowsort gb-over-bt
 select a as a, b as b from t7401
 UNION ALL
 select b as a, a as b from t7401
 
 1
 10
+10
+1
 2
 20
-10
-1
 20
 2
 
diff --git a/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out 
b/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out
--- a/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out
+++ b/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out
@@ -45,7 +45,7 @@ stdout of test 'limit_in_prepare.Bug-255
 [ "int",   32, 0,  "", "rr",   "id"]
 [ "bigint",64, 0,  NULL,   NULL,   NULL]
 #exec  5 (1);
-% sys.rr # table_name
+% .rr # table_name
 % id # name
 % int # type
 % 1 # length
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Jun2023

2023-11-10 Thread Ying Zhang via checkin-list
Changeset: 0209860283d4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0209860283d4
Modified Files:
sql/test/rel-optimizers/Tests/groupby-cse.test
Branch: default
Log Message:

merged with Jun2023


diffs (134 lines):

diff --git 
a/sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.test 
b/sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.test
--- a/sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.test
+++ b/sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.test
@@ -343,29 +343,6 @@ 3
 4
 
 query I rowsort
-select * from oblo OFFSET 2
-
-1
-2
-
-query I rowsort
-select * from oblo LIMIT 2
-
-3
-4
-
-query I rowsort
-select * from oblo LIMIT 1 OFFSET 2
-
-2
-
-query I rowsort
-select * from oblo LIMIT 2 OFFSET 1
-
-2
-3
-
-query I rowsort
 select * from oblo ORDER BY a
 
 1
diff --git a/sql/test/BugTracker-2023/Tests/union-query-7401.test 
b/sql/test/BugTracker-2023/Tests/union-query-7401.test
--- a/sql/test/BugTracker-2023/Tests/union-query-7401.test
+++ b/sql/test/BugTracker-2023/Tests/union-query-7401.test
@@ -7,7 +7,7 @@ insert into t7401 values (1,10)
 statement ok
 insert into t7401 values (2,20)
 
-query II nosort
+query II rowsort
 select b as a, a as b from t7401
 
 10
@@ -15,7 +15,7 @@ 1
 20
 2
 
-query II nosort
+query II rowsort
 select a as a, b as b from t7401
 UNION
 select b as a, a as b from t7401
@@ -29,7 +29,7 @@ 1
 20
 2
 
-query II nosort
+query II rowsort
 select a as a, b as b from t7401
 UNION ALL
 select b as a, a as b from t7401
diff --git a/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.sql 
b/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.sql
--- a/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.sql
+++ b/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.sql
@@ -1,5 +1,5 @@
 CREATE TABLE "sys"."tbls" (
-   "id"INTEGER,
+   "id"INTEGER PRIMARY KEY,
"name"  VARCHAR(1024),
"schema_id" INTEGER,
"query" VARCHAR(2048),
@@ -52,12 +52,12 @@ 6453"statistics"2000NULL0   true
0   fal
 
 create table rr (id int);
 insert into rr values (1),(2),(3);
-prepare select * from rr limit ?;
+prepare select * from rr order by id limit ?;
 exec ** (1);
 
 drop table rr;
 
-prepare select name, schema_id, query, type, system, commit_action, readonly, 
temporary from tbls limit 24;
+prepare select name, schema_id, query, type, system, commit_action, readonly, 
temporary from tbls order by id limit 24;
 exec ** ();
 
 drop table tbls;
diff --git a/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out 
b/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out
--- a/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out
+++ b/sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out
@@ -10,7 +10,7 @@ stdout of test 'limit_in_prepare.Bug-255
 # 22:28:06 >  
 
 #CREATE TABLE "sys"."tbls" (
-#  "id"INTEGER,
+#  "id"INTEGER PRIMARY KEY,
 #  "name"  VARCHAR(1024),
 #  "schema_id" INTEGER,
 #  "query" VARCHAR(2048),
@@ -36,8 +36,8 @@ stdout of test 'limit_in_prepare.Bug-255
 #create table rr (id int);
 #insert into rr values (1),(2),(3);
 [ 3]
-#prepare select * from rr limit ?;
-#prepare select * from rr limit ?;
+#prepare select * from rr order by id limit ?;
+#prepare select * from rr order by id limit ?;
 % .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
 % type,digits, scale,  schema, table,  column # name
 % varchar, int,int,varchar,varchar,varchar # type
@@ -51,8 +51,8 @@ stdout of test 'limit_in_prepare.Bug-255
 % 1 # length
 [ 1]
 #drop table rr;
-#prepare select name, schema_id, query, type, system, commit_action, readonly, 
temporary from tables limit 24;
-#prepare select name, schema_id, query, type, system, commit_action, readonly, 
temporary from tables limit 24;
+#prepare select name, schema_id, query, type, system, commit_action, readonly, 
temporary from tables order by id limit 24;
+#prepare select name, schema_id, query, type, system, commit_action, readonly, 
temporary from tables order by id limit 24;
 % .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
 % type,digits, scale,  schema, table,  column # name
 % varchar, int,int,varchar,varchar,varchar # type
diff --git a/sql/test/rel-optimizers/Tests/groupby-cse.test 
b/sql/test/rel-optimizers/Tests/groupby-cse.test
--- a/sql/test/rel-optimizers/Tests/groupby-cse.test
+++ b/sql/test/rel-optimizers/Tests/groupby-cse.test
@@ -45,7 +45,7 @@ project (
 | ) [ "foo"."c1" ] [ "foo"."c1", "sys"."count" no nil ("foo"."c3") NOT NULL as 
"%1"."%1" ]
 ) [ "foo"."c1" UNIQUE, "foo"."c1" UNIQUE, "%1"."%1" NOT NULL ]
 
-query III nosort gb-over-bt
+query 

MonetDB: default - merged with Jun2023

2023-10-28 Thread Niels Nes via checkin-list
Changeset: 8661f60a6882 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8661f60a6882
Modified Files:
sql/server/rel_psm.c
Branch: default
Log Message:

merged with Jun2023


diffs (12 lines):

diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -950,7 +950,7 @@ rel_create_func(sql_query *query, dlist 
 
sql->params = NULL;
if (create) {
-   bit side_effect = (list_empty(restype) || 
list_empty(l)); /* TODO make this more precise? */
+   bit side_effect = (list_empty(restype) || (!vararg && 
list_empty(l))); /* TODO make this more precise? */
switch (mvc_create_func(, sql, sql->sa, s, fname, l, 
restype, type, lang, mod, imp, lang_body, (type == F_LOADER)?TRUE:FALSE, 
vararg, FALSE, side_effect)) {
case -1:
return sql_error(sql, 01, 
SQLSTATE(HY013) MAL_MALLOC_FAIL);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2023-10-24 Thread Niels Nes via checkin-list
Changeset: df5900d5f9cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/df5900d5f9cd
Branch: default
Log Message:

merged


diffs (truncated from 1802 to 300 lines):

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
@@ -140,6 +140,14 @@ JSONtoStorageString(JSON *jt, int idx, j
size_t sz = 0;
str msg = MAL_SUCCEED;
 
+   if (THRhighwater()) {
+   msg = createException(MAL, "json.new",
+   
SQLSTATE(42000)
+   "JSON 
object too complex to render into string.");
+   return msg;
+   }
+
+
switch(jt->elm[idx].kind) {
case JSON_OBJECT:
*p++ = '{';
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -937,6 +937,7 @@ sqltypeinit( sql_allocator *sa)
/* needed for indices/clusters oid(schema.table,val) returns 
max(head(schema.table))+1 */
sql_create_func(sa, "rowid", "calc", "rowid", TRUE, TRUE, SCALE_NONE, 
0, OID, 3, ANY, STR, STR);
sql_create_aggr(sa, "min", "aggr", "min", FALSE, FALSE, ANY, 1, ANY);
+   sql_create_aggr(sa, "any_value", "aggr", "min", FALSE, FALSE, ANY, 1, 
ANY);
sql_create_aggr(sa, "max", "aggr", "max", FALSE, FALSE, ANY, 1, ANY);
sql_create_func(sa, "sql_min", "calc", "min", FALSE, FALSE, SCALE_FIX, 
0, ANY, 2, ANY, ANY);
sql_create_func(sa, "sql_max", "calc", "max", FALSE, FALSE, SCALE_FIX, 
0, ANY, 2, ANY, ANY);
@@ -1095,6 +1096,7 @@ sqltypeinit( sql_allocator *sa)
 
sql_create_analytic(sa, "count", "sql", "count", FALSE, SCALE_NONE, 
LNG, 2, ANY, BIT);
sql_create_analytic(sa, "min", "sql", "min", FALSE, SCALE_NONE, ANY, 1, 
ANY);
+   sql_create_analytic(sa, "any_value", "sql", "min", FALSE, SCALE_NONE, 
ANY, 1, ANY);
sql_create_analytic(sa, "max", "sql", "max", FALSE, SCALE_NONE, ANY, 1, 
ANY);
 
/* analytical sum for numerical and decimals */
@@ -1511,8 +1513,8 @@ sqltypeinit( sql_allocator *sa)
sql_create_func(sa, "ucase", "str", "toUpper", FALSE, FALSE, 
INOUT, 0, *t, 1, *t);
sql_create_func(sa, "lower", "str", "toLower", FALSE, FALSE, 
INOUT, 0, *t, 1, *t);
sql_create_func(sa, "lcase", "str", "toLower", FALSE, FALSE, 
INOUT, 0, *t, 1, *t);
-   sql_create_func(sa, "trim", "str", "trim", FALSE, FALSE, INOUT, 
0, *t, 1, *t);
-   sql_create_func(sa, "trim", "str", "trim2", FALSE, FALSE, 
INOUT, 0, *t, 2, *t, *t);
+   sql_create_func(sa, "btrim", "str", "trim", FALSE, FALSE, 
INOUT, 0, *t, 1, *t);
+   sql_create_func(sa, "btrim", "str", "trim2", FALSE, FALSE, 
INOUT, 0, *t, 2, *t, *t);
sql_create_func(sa, "ltrim", "str", "ltrim", FALSE, FALSE, 
INOUT, 0, *t, 1, *t);
sql_create_func(sa, "ltrim", "str", "ltrim2", FALSE, FALSE, 
INOUT, 0, *t, 2, *t, *t);
sql_create_func(sa, "rtrim", "str", "rtrim", FALSE, FALSE, 
INOUT, 0, *t, 1, *t);
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -63,9 +63,11 @@ makeAtomNode(mvc *m, const char* type, c
 #ifdef HAVE_HGE
 #define MAX_DEC_DIGITS 38
 #define MAX_HEX_DIGITS 32
+#define MAX_OCT_DIGITS 64 /* TODO */
 #else
 #define MAX_DEC_DIGITS 18
 #define MAX_HEX_DIGITS 16
+#define MAX_OCT_DIGITS 32 /* TODO */
 #endif
 
 static inline int
@@ -421,6 +423,8 @@ int yydebug=1;
opt_null_string
opt_to_savepoint
opt_uescape
+   opt_trim_type
+   opt_trim_characters
opt_using
opt_XML_attribute_name
restricted_ident
@@ -636,7 +640,7 @@ int yydebug=1;
 
 /* sql prefixes to avoid name clashes on various architectures */
 %token 
-   IDENT UIDENT aTYPE ALIAS RANK sqlINT OIDNUM HEXADECIMAL INTNUM APPROXNUM
+   IDENT UIDENT aTYPE ALIAS RANK sqlINT OIDNUM HEXADECIMALNUM OCTALNUM 
BINARYNUM INTNUM APPROXNUM
USING
GLOBAL CAST CONVERT
CHARACTER VARYING LARGE OBJECT VARCHAR CLOB sqlTEXT BINARY sqlBLOB
@@ -694,7 +698,7 @@ int yydebug=1;
 %left  ALL ANY NOT_BETWEEN BETWEEN NOT_IN sqlIN NOT_EXISTS EXISTS 
NOT_LIKE LIKE NOT_ILIKE ILIKE OR SOME
 %left  AND
 %left  COMPARISON /* <> < > <= >= */
-%left  '+' '-' '&' '|' '^' LEFT_SHIFT RIGHT_SHIFT LEFT_SHIFT_ASSIGN 
RIGHT_SHIFT_ASSIGN CONCATSTRING SUBSTRING POSITION SPLIT_PART
+%left  '+' '-' '&' '|' '^' LEFT_SHIFT RIGHT_SHIFT LEFT_SHIFT_ASSIGN 
RIGHT_SHIFT_ASSIGN CONCATSTRING SUBSTRING TRIM POSITION SPLIT_PART
 %left  '*' '/' '%'
 %left UMINUS
 %left  '~'
@@ -721,6 +725,7 @@ SQLCODE SQLERROR UNDER WHENEVER
 %token PATH PRIMARY PRIVILEGES
 %token PUBLIC REFERENCES SCHEMA SET AUTO_COMMIT
 %token RETURN
+%token LEADING TRAILING BOTH
 
 %token ALTER ADD TABLE COLUMN 

MonetDB: default - merged with groupjoin

2023-10-24 Thread Niels Nes via checkin-list
Changeset: eb00c8a79aa1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eb00c8a79aa1
Modified Files:
gdk/gdk_join.c
Branch: default
Log Message:

merged with groupjoin


diffs (35 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2279,21 +2279,27 @@ mergejoin(BAT **r1p, BAT **r2p, BAT **r3
}
if (maybeextend(r1, r2, r3, nlx, 
lci->next, lci->ncand, maxsize) != GDK_SUCCEED)
goto bailout;
+   if (r3)
+   r3->tnil = false;
while (nlx > 0) {
lv = canditer_next(lci);
if (mlci == NULL || 
canditer_contains(mlci, lv)) {
APPEND(r1, lv);
if (r2)
APPEND(r2, 
oid_nil);
-   if (r3)
-   ((bit *) 
r3->theap->base)[r3->batCount++] = defmark;
+   if (r3) {
+   if (rhasnil || 
cmp(VALUE(l, lv - l->hseqbase), nil) == 0) {
+   ((bit 
*) r3->theap->base)[r3->batCount++] = bit_nil;
+   
r3->tnil = true;
+   } else {
+   ((bit 
*) r3->theap->base)[r3->batCount++] = 0;
+   }
+   }
}
nlx--;
}
if (r1->trevsorted && BATcount(r1) > 1)
r1->trevsorted = false;
-   if (r3)
-   r3->tnil = rhasnil;
} else {
canditer_setidx(lci, lci->next + nlx);
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2023-09-29 Thread Niels Nes via checkin-list
Changeset: 3ca9c804d37a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3ca9c804d37a
Branch: default
Log Message:

merged


diffs (truncated from 911 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -811,3 +811,4 @@ 573511e0e7bf2f7ab11f00b45711aab5f1aff6f2
 573511e0e7bf2f7ab11f00b45711aab5f1aff6f2 Jun2023_SP1_release
 ce63ebe9a78c52ef0cbe8fd6f2159d2637f0387c Jun2023_7
 1efa83c6409769d13b2ee30e497d5f7ab42fa955 Jun2023_9
+6f88424ebfd9d82c072cf21d89070e04321983da Jun2023_11
diff --git a/ChangeLog-Archive b/ChangeLog-Archive
--- a/ChangeLog-Archive
+++ b/ChangeLog-Archive
@@ -1,6 +1,10 @@
 # DO NOT EDIT THIS FILE -- MAINTAINED AUTOMATICALLY
 # This file contains past ChangeLog entries
 
+* Fri Sep 29 2023 Sjoerd Mullender  - 11.47.11-20230929
+- Fixed an installation issue on Debian and Ubuntu introduced in the
+  last build.
+
 * Wed Aug 30 2023 Sjoerd Mullender  - 11.47.7-20230925
 - Do a lot more error checking, mostly for allocation failures.  More is
   still needed, though.
diff --git a/ChangeLog.Jun2023 b/ChangeLog.Jun2023
--- a/ChangeLog.Jun2023
+++ b/ChangeLog.Jun2023
@@ -1,7 +1,3 @@
 # ChangeLog file for devel
 # This file is updated with Maddlog
 
-* Fri Sep 29 2023 Sjoerd Mullender 
-- Fixed an installation issue on Debian and Ubuntu introduced in the
-  last build.
-
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -860,6 +860,13 @@ fi
 %endif
 
 %changelog
+* Fri Sep 29 2023 Sjoerd Mullender  - 11.47.11-20230929
+- Rebuilt.
+
+* Fri Sep 29 2023 Sjoerd Mullender  - 11.47.11-20230929
+- MonetDB: Fixed an installation issue on Debian and Ubuntu introduced in the
+  last build.
+
 * Wed Sep 27 2023 Sjoerd Mullender  - 11.47.9-20230927
 - Rebuilt.
 - GH#7402: Privileges on merge table not propagated to partition tables
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -42,7 +42,7 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M
 # common/options and common/utils)
 set(GDK_VERSION_MAJOR "27")
 set(GDK_VERSION_MINOR "0")
-set(GDK_VERSION_PATCH "3")
+set(GDK_VERSION_PATCH "4")
 set(GDK_VERSION 
"${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}")
 
 # version of the MAPI library (subdirectory clients/mapilib)
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+monetdb (11.47.11) unstable; urgency=low
+
+  * Rebuilt.
+
+ -- Sjoerd Mullender   Fri, 29 Sep 2023 12:00:43 +0200
+
+monetdb (11.47.11) unstable; urgency=low
+
+  * MonetDB: Fixed an installation issue on Debian and Ubuntu introduced in the
+last build.
+
+ -- Sjoerd Mullender   Fri, 29 Sep 2023 12:00:43 +0200
+
 monetdb (11.47.9) unstable; urgency=low
 
   * Rebuilt.
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2529,9 +2529,9 @@ log_flush(logger *lg, ulng ts)
log_unlock(lg);
return GDK_FAIL;
}
+   updated = p;
memset(updated + allocated / 4, 0, a - 
allocated);
allocated = a;
-   updated = p;
}
nupdated = n;
}
diff --git a/misc/packages/deb/changelog b/misc/packages/deb/changelog
--- a/misc/packages/deb/changelog
+++ b/misc/packages/deb/changelog
@@ -1,3 +1,16 @@
+monetdb (11.47.11) unstable; urgency=low
+
+  * Rebuilt.
+
+ -- Sjoerd Mullender   Fri, 29 Sep 2023 12:00:43 +0200
+
+monetdb (11.47.11) unstable; urgency=low
+
+  * MonetDB: Fixed an installation issue on Debian and Ubuntu introduced in the
+last build.
+
+ -- Sjoerd Mullender   Fri, 29 Sep 2023 12:00:43 +0200
+
 monetdb (11.47.9) unstable; urgency=low
 
   * Rebuilt.
diff --git a/misc/packages/rpm/changelog b/misc/packages/rpm/changelog
--- a/misc/packages/rpm/changelog
+++ b/misc/packages/rpm/changelog
@@ -1,3 +1,10 @@
+* Fri Sep 29 2023 Sjoerd Mullender  - 11.47.11-20230929
+- Rebuilt.
+
+* Fri Sep 29 2023 Sjoerd Mullender  - 11.47.11-20230929
+- MonetDB: Fixed an installation issue on Debian and Ubuntu introduced in the
+  last build.
+
 * Wed Sep 27 2023 Sjoerd Mullender  - 11.47.9-20230927
 - Rebuilt.
 - GH#7402: Privileges on merge table not propagated to partition tables
diff --git a/monetdb5/modules/atoms/Tests/json01.maltest 
b/monetdb5/modules/atoms/Tests/json01.maltest
--- a/monetdb5/modules/atoms/Tests/json01.maltest
+++ b/monetdb5/modules/atoms/Tests/json01.maltest
@@ -18,7 +18,7 @@ f:= json.filter(b,"f1")
 query T rowsort
 io.print(f)
 
-"[1]"
+"1"
 
 statement ok
 b:= json.new("{\"f1\":1,\"f2\":2}")
@@ -29,7 +29,7 @@ f:= json.filter(b,"f2")
 query T rowsort
 io.print(f)
 
-"[2]"
+"2"
 
 statement ok
 f:= json.filter(b,"f1,f2")
@@ -48,7 +48,7 @@ f:= json.filter(b,"f1[0]")
 query T 

MonetDB: default - merged with jun2023

2023-09-14 Thread Niels Nes via checkin-list
Changeset: 595862c688de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/595862c688de
Modified Files:
gdk/gdk_storage.c
sql/backends/monet5/sql_upgrades.c
sql/storage/bat/bat_storage.c
Branch: default
Log Message:

merged with jun2023


diffs (266 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2085,6 +2085,12 @@ log_load(const char *fn, const char *log
lg->seqs_val = BATdescriptor(BBPindex(bak));
strconcat_len(bak, sizeof(bak), fn, "_dseqs", NULL);
lg->dseqs = BATdescriptor(BBPindex(bak));
+   if (lg->seqs_id == NULL ||
+   lg->seqs_val == NULL ||
+   lg->dseqs == NULL) {
+   GDKerror("Logger_new: cannot load seqs bats");
+   goto error;
+   }
} else {
lg->seqs_id = logbat_new(TYPE_int, 1, PERSISTENT);
lg->seqs_val = logbat_new(TYPE_lng, 1, PERSISTENT);
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -550,7 +550,7 @@ GDKload(int farmid, const char *nme, con
for (n_expected = (ssize_t) size; n_expected > 
0; n_expected -= n) {
n = read(fd, dst, (unsigned) MIN(1 << 
30, n_expected));
if (n < 0)
-   GDKsyserror("GDKload: cannot 
read: name=%s, ext=%s, %zu bytes missing\n", nme, ext ? ext : "", (size_t) 
n_expected);
+   GDKsyserror("GDKload: cannot 
read: name=%s, ext=%s, expected %zu, %zd bytes missing\n", nme, ext ? ext : "", 
size, n_expected);
 #ifndef __COVERITY__
/* Coverity doesn't seem to
 * recognize that we're just
@@ -567,7 +567,8 @@ GDKload(int farmid, const char *nme, con
/* we couldn't read all, error
 * already generated */
GDKfree(ret);
-   GDKerror("short read from heap %s%s%s, 
expected %zu, missing %zd\n", nme, ext ? "." : "", ext ? ext : "", size, 
n_expected);
+   if (n >= 0) /* don't report error twice 
 */
+   GDKerror("short read from heap 
%s%s%s, expected %zu, missing %zd\n", nme, ext ? "." : "", ext ? ext : "", 
size, n_expected);
ret = NULL;
}
 #ifndef NDEBUG
diff --git a/monetdb5/modules/kernel/batmmath.c 
b/monetdb5/modules/kernel/batmmath.c
--- a/monetdb5/modules/kernel/batmmath.c
+++ b/monetdb5/modules/kernel/batmmath.c
@@ -95,9 +95,10 @@ CMDscienceUNARY(MalStkPtr stk, InstrPtr 
BBPreclaim(s);
if (e != 0 || ex != 0) {
const char *err;
+   char buf[128];
BBPunfix(bn->batCacheid);
if (e)
-   err = GDKstrerror(e, (char[128]) { 0 }, 128);
+   err = GDKstrerror(e, buf, 128);
else if (ex & FE_DIVBYZERO)
err = "Divide by zero";
else if (ex & FE_OVERFLOW)
@@ -323,9 +324,10 @@ CMDscienceBINARY(MalStkPtr stk, InstrPtr
throw(MAL, malfunc, GDK_EXCEPTION);
if (e != 0 || ex != 0) {
const char *err;
+   char buf[128];
BBPunfix(bn->batCacheid);
if (e)
-   err = GDKstrerror(e, (char[128]) { 0 }, 128);
+   err = GDKstrerror(e, buf, 128);
else if (ex & FE_DIVBYZERO)
err = "Divide by zero";
else if (ex & FE_OVERFLOW)
diff --git a/monetdb5/modules/kernel/mmath.c b/monetdb5/modules/kernel/mmath.c
--- a/monetdb5/modules/kernel/mmath.c
+++ b/monetdb5/modules/kernel/mmath.c
@@ -96,8 +96,9 @@ MATHunary##NAME##TYPE(TYPE *res, const T
(ex = fetestexcept(FE_INVALID | FE_DIVBYZERO |  
\
   FE_OVERFLOW)) != 0) 
{\
const char *err;
\
+   char buf[128];  
\
if (e) {
\
-   err = GDKstrerror(e, (char[128]){0}, 128);  
\
+   err = GDKstrerror(e, buf, 128); 
\
} else if (ex & 

MonetDB: default - merged with jun2023

2023-09-09 Thread Niels Nes via checkin-list
Changeset: 500df27472bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/500df27472bf
Modified Files:
sql/server/rel_exp.c
Branch: default
Log Message:

merged with jun2023

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2023-08-21 Thread Niels Nes via checkin-list
Changeset: 8fc87508453d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8fc87508453d
Branch: default
Log Message:

merged


diffs (38 lines):

diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -525,15 +525,9 @@ extern size_t GDK_mmap_pagesize; /* mmap
 
 #define GDKswapLock(x)  GDKbatLock[(x)_BATMASK].swap
 
-#if ATOMIC_LLONG_LOCK_FREE == 2
-#define HEAPREMOVE ((ATOMIC_BASE_TYPE) 1 << 63)
-#define DELAYEDREMOVE  ((ATOMIC_BASE_TYPE) 1 << 62)
-#define HEAPREFS   (((ATOMIC_BASE_TYPE) 1 << 62) - 1)
-#else
-#define HEAPREMOVE ((ATOMIC_BASE_TYPE) 1 << 31)
-#define DELAYEDREMOVE  ((ATOMIC_BASE_TYPE) 1 << 30)
-#define HEAPREFS   (((ATOMIC_BASE_TYPE) 1 << 30) - 1)
-#endif
+#define HEAPREMOVE ((ATOMIC_BASE_TYPE) 1 << (sizeof(ATOMIC_BASE_TYPE) * 8 
- 1))
+#define DELAYEDREMOVE  ((ATOMIC_BASE_TYPE) 1 << (sizeof(ATOMIC_BASE_TYPE) * 8 
- 2))
+#define HEAPREFS   (((ATOMIC_BASE_TYPE) 1 << (sizeof(ATOMIC_BASE_TYPE) * 8 
- 2)) - 1)
 
 /* when the number of updates to a BAT is less than 1 in this number, we
  * keep the unique_est property */
diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h
--- a/sql/storage/sql_storage.h
+++ b/sql/storage/sql_storage.h
@@ -474,11 +474,7 @@ extern sql_table *globaltmp_instantiate(
 
 #define NR_TABLE_LOCKS 64
 #define NR_COLUMN_LOCKS 512
-#if ATOMIC_LLONG_LOCK_FREE == 2
-#define TRANSACTION_ID_BASE(1ULL<<63)
-#else
-#define TRANSACTION_ID_BASE(1UL<<31)
-#endif
+#define TRANSACTION_ID_BASE(1ULL<<(sizeof(ATOMIC_BASE_TYPE) * 8 - 1))
 
 typedef struct sqlstore {
int catalog_version;/* software version of the catalog */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Jun2023

2023-08-12 Thread Niels Nes via checkin-list
Changeset: e95d0f98ae91 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e95d0f98ae91
Branch: default
Log Message:

merged with Jun2023


diffs (11 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1189,6 +1189,7 @@ log_read_transaction(logger *lg, uint32_
BUN p;
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 */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Jun2023

2023-08-06 Thread Niels Nes via checkin-list
Changeset: fb1846604869 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fb1846604869
Branch: default
Log Message:

merged with Jun2023


diffs (155 lines):

diff --git a/gdk/gdk_tracer.c b/gdk/gdk_tracer.c
--- a/gdk/gdk_tracer.c
+++ b/gdk/gdk_tracer.c
@@ -513,6 +513,7 @@ GDKtracer_log(const char *file, const ch
va_list va;
char ts[TS_SIZE];
char *msg = NULL;
+   bool isexit;
static char file_prefix[] = __FILE__;
static size_t prefix_length = (size_t) -1;
 
@@ -550,6 +551,7 @@ GDKtracer_log(const char *file, const ch
  sizeof(buffer) - bytes_written,
  fmt, va);
}
+   isexit = strstr(msg, EXITING_MSG) != NULL;
va_end(va);
if (bytes_written < 0) {
if ((adapter_t) ATOMIC_GET(_adapter) != MBEDDED)
@@ -567,7 +569,8 @@ GDKtracer_log(const char *file, const ch
size_t n = strlen(buf);
snprintf(buf + n, GDKMAXERRLEN - n,
 "%s%s: %s%s%s\n",
-GDKERROR, func, msg,
+isexit ? "" : GDKERROR,
+func, msg,
 syserr ? ": " : "",
 syserr ? syserr : "");
}
@@ -582,7 +585,7 @@ GDKtracer_log(const char *file, const ch
reinit();
 
if (level <= M_WARNING || (ATOMIC_GET() & FORCEMITOMASK)) {
-   fprintf(level <= M_ERROR ? stderr : stdout,
+   fprintf(level <= M_ERROR && !isexit ? stderr : stdout,
"#%s%s%s: %s: %s: %s%s%s\n",
add_ts ? ts : "",
add_ts ? ": " : "",
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -159,7 +159,7 @@ createException(enum malexception type, 
ret = createException(type, fcn, "%s", q + 2);
}
if (ret == NULL)
-   ret = createException(type, fcn, "GDK reported error: 
%s", p);
+   ret = createException(type, fcn, "GDK reported%s: %s", 
strstr(p, EXITING_MSG) == NULL ? " error" : "", p);
GDKclrerr();
assert(ret);
return ret;
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -404,7 +404,7 @@ MSscheduleClient(str command, str challe
c->protocol = protocol;
c->blocksize = blocksize;
 
-   if (!GDKembedded() && c->initClient) {
+   if (c->initClient) {
if ((msg = c->initClient(c, passwd, challenge, algo)) != 
MAL_SUCCEED) {
mnstr_printf(fout, "!%s\n", msg);
if (passwd)
diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c
--- a/sql/server/rel_optimize_proj.c
+++ b/sql/server/rel_optimize_proj.c
@@ -2694,15 +2694,19 @@ rel_groupby_distinct(visitor *v, sql_rel
}
 
darg = arg->h->data;
-   if ((found = exps_find_exp(gbe, darg))) { /* first find if the 
aggregate argument already exists in the grouping list */
-   darg = exp_ref(v->sql, found);
+   if ((found = exps_find_exp(exps, darg)) == NULL) { /* not 
already in the groups projection list */
+   if ((found = exps_find_exp(gbe, darg))) { /* first find 
if the aggregate argument already exists in the grouping list */
+   darg = exp_ref(v->sql, found);
+   } else {
+   list_append(gbe, darg = exp_copy(v->sql, darg));
+   exp_label(v->sql->sa, darg, ++v->sql->label);
+   darg = exp_ref(v->sql, darg);
+   }
+   list_append(exps, darg);
+   darg = exp_ref(v->sql, darg);
} else {
-   list_append(gbe, darg = exp_copy(v->sql, darg));
-   exp_label(v->sql->sa, darg, ++v->sql->label);
-   darg = exp_ref(v->sql, darg);
+   darg = exp_ref(v->sql, found);
}
-   list_append(exps, darg);
-   darg = exp_ref(v->sql, darg);
arg->h->data = darg;
l = rel->l = rel_groupby(v->sql, rel->l, gbe);
l->exps = exps;
diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -115,3 +115,4 @@ rtrim_bug
 savepoint-release
 procedure-recompile
 rse_bug
+delete-or-not-in-bug
diff --git a/sql/test/bugs/Tests/delete-or-not-in-bug.test 
b/sql/test/bugs/Tests/delete-or-not-in-bug.test
new 

MonetDB: default - merged with jun2023

2023-08-01 Thread Niels Nes via checkin-list
Changeset: b7a38cc19cda for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b7a38cc19cda
Branch: default
Log Message:

merged with jun2023


diffs (172 lines):

diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -181,16 +181,9 @@ static str MSserveClient(Client cntxt);
 
 
 static inline void
-cleanUpScheduleClient(Client c, Scenario s, str *command, str *err)
+cleanUpScheduleClient(Client c, str *command, str *err)
 {
if(c) {
-   if (s) {
-   str msg = NULL;
-   if((msg = s->exitClientCmd(c)) != MAL_SUCCEED) {
-   mnstr_printf(c->fdout, "!%s\n", msg);
-   freeException(msg);
-   }
-   }
MCcloseClient(c);
}
if (command) {
@@ -359,18 +352,15 @@ MSscheduleClient(str command, str challe
c->curmodule = c->usermodule = userModule();
if(c->curmodule  == NULL) {
mnstr_printf(fout, "!could not allocate 
space\n");
-   cleanUpScheduleClient(c, NULL, , );
+   cleanUpScheduleClient(c, , );
return;
}
}
 
-   if ((s = setScenario(c, lang)) != NULL) {
-   mnstr_printf(c->fdout, "!%s\n", s);
+   if ((msg = setScenario(c, lang)) != NULL) {
+   mnstr_printf(c->fdout, "!%s\n", msg);
mnstr_flush(c->fdout, MNSTR_FLUSH_DATA);
-   GDKfree(s);
-   exit_streams(fin, fout);
-   GDKfree(command);
-   MCcloseClient(c);
+   cleanUpScheduleClient(c, , );
return;
}
if (!GDKgetenv_isyes(mal_enableflag) &&
@@ -378,14 +368,14 @@ MSscheduleClient(str command, str challe
 
mnstr_printf(fout, "!only the 'monetdb' user can use 
non-sql languages. "
   "run mserver5 with --set 
%s=yes to change this.\n", mal_enableflag);
-   cleanUpScheduleClient(c, NULL, , );
+   cleanUpScheduleClient(c, , );
return;
}
}
 
if((msg = MSinitClientPrg(c, "user", "main")) != MAL_SUCCEED) {
mnstr_printf(fout, "!could not allocate space\n");
-   cleanUpScheduleClient(c, NULL, , );
+   cleanUpScheduleClient(c, , );
return;
}
 
@@ -423,7 +413,7 @@ MSscheduleClient(str command, str challe
GDKfree(algo);
if (c->exitClient)
c->exitClient(c);
-   cleanUpScheduleClient(c, NULL, NULL, );
+   cleanUpScheduleClient(c, NULL, );
return;
}
}
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -1027,7 +1027,7 @@ sql2pcre(str *r, const char *pat, const 
int escaped = 0;
int hasWildcard = 0;
char *ppat;
-   int esc = esc_str[0] == '\200' ? 0 : esc_str[0]; /* should change to 
utf8_convert() */
+   int esc = strNil(esc_str) ? 0 : esc_str[0]; /* should change to 
utf8_convert() */
int specials;
int c;
 
@@ -1389,11 +1389,11 @@ re_like_build(struct RE **re, uint32_t *
 }
 
 #define proj_scanloop(TEST)\
-   do {\
-   if (*s == '\200') \
+   do {\
+   if (strNil(s))  \
return bit_nil; \
-   else \
-   return TEST; \
+   else\
+   return TEST;\
} while (0)
 
 static inline bit
@@ -1490,7 +1490,7 @@ pcre_like_build(regex_t *res, void *ex, 
 #define PCRE_LIKE_BODY(LOOP_BODY, RES1, RES2) \
do { \
LOOP_BODY  \
-   if (*s == '\200') \
+   if (strNil(s))  \
*ret = bit_nil; \
else if (pos >= 0) \
*ret = RES1; \
@@ -1736,7 +1736,7 @@ BATPCREnotlike(Client cntxt, MalBlkPtr m
GDK_CHECK_TIMEOUT(timeoffset, counter,  
\
  
GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \
const char *restrict v = BUNtvar(bi, p - off);  
\
-   if ((TEST) || ((KEEP_NULLS) && *v == '\200'))   
\
+   if ((TEST) || 

MonetDB: default - merged

2023-07-31 Thread Niels Nes via checkin-list
Changeset: cbd6a861ff57 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cbd6a861ff57
Branch: default
Log Message:

merged


diffs (truncated from 2834 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -225,7 +225,9 @@ log_write_format(logger *lg, logformat *
 {
assert(data->id || data->flag);
assert(!lg->inmemory);
-   if (mnstr_write(lg->current->output_log, >flag, 1, 1) == 1 &&
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR &&
+   mnstr_write(lg->current->output_log, >flag, 1, 1) == 1 &&
mnstr_writeInt(lg->current->output_log, data->id))
return GDK_SUCCEED;
TRC_CRITICAL(GDK, "write failed\n");
@@ -271,7 +273,9 @@ log_write_id(logger *lg, int id)
 {
assert(!lg->inmemory);
assert(id >= 0);
-   if (mnstr_writeInt(lg->current->output_log, id))
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR &&
+   mnstr_writeInt(lg->current->output_log, id))
return GDK_SUCCEED;
TRC_CRITICAL(GDK, "write failed\n");
return GDK_FAIL;
@@ -2373,7 +2377,12 @@ log_activate(logger *lg)
bool flush_cleanup = false;
gdk_return res = GDK_SUCCEED;
rotation_lock(lg);
-   if (!lg->flushnow && !lg->current->next && lg->current->drops > 10 
&& (ulng) ATOMIC_GET(>current->last_ts) > 0 && lg->saved_id+1 == lg->id && 
ATOMIC_GET(>current->refcount) == 1 /* no pending work on this file */) {
+   if (!lg->flushnow &&
+   !lg->current->next &&
+   lg->current->drops > 10 &&
+   (ulng) ATOMIC_GET(>current->last_ts) > 0 &&
+   lg->saved_id + 1 == lg->id &&
+   ATOMIC_GET(>current->refcount) == 1 /* no pending work on this 
file */) {
lg->id++;
/* start new file */
res = log_open_output(lg);
@@ -2521,7 +2530,9 @@ log_constant(logger *lg, int type, ptr v
 
gdk_return (*wt) (const void *, stream *, size_t) = 
BATatoms[type].atomWrite;
 
-   if (log_write_format(lg, ) != GDK_SUCCEED ||
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR ||
+   log_write_format(lg, ) != GDK_SUCCEED ||
!mnstr_writeLng(lg->current->output_log, nr) ||
mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
!mnstr_writeLng(lg->current->output_log, offset)) {
@@ -2552,6 +2563,9 @@ string_writer(logger *lg, BAT *b, lng of
 
if (!buf)
return GDK_FAIL;
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR)
+   return GDK_FAIL;
BATiter bi = bat_iterator(b);
BUN p = (BUN)offset;
for ( ; p < end; ) {
@@ -2579,7 +2593,9 @@ string_writer(logger *lg, BAT *b, lng of
sz += len;
}
}
-   if (sz && (!mnstr_writeLng(lg->current->output_log, (lng) sz) 
|| mnstr_write(lg->current->output_log, buf, sz, 1) != 1)) {
+   if (sz &&
+   (!mnstr_writeLng(lg->current->output_log, (lng) sz) ||
+mnstr_write(lg->current->output_log, buf, sz, 1) != 1)) {
res = GDK_FAIL;
break;
}
@@ -2609,11 +2625,17 @@ internal_log_bat(logger *lg, BAT *b, log
 
gdk_return (*wt) (const void *, stream *, size_t) = 
BATatoms[b->ttype].atomWrite;
 
+   assert(mnstr_errnr(lg->current->output_log) == MNSTR_NO__ERROR);
+   if (mnstr_errnr(lg->current->output_log) != MNSTR_NO__ERROR) {
+   ok = GDK_FAIL;
+   goto bailout;
+   }
+
if (lg->total_cnt == 0) /* signals single bulk message or first part of 
bat logged in parts */
if (log_write_format(lg, ) != GDK_SUCCEED ||
-   !mnstr_writeLng(lg->current->output_log, 
total_cnt?total_cnt:cnt) ||
-   mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
-   !mnstr_writeLng(lg->current->output_log, 
total_cnt?-1:offset)) { /* offset = -1 indicates bat was logged in parts */
+   !mnstr_writeLng(lg->current->output_log, 
total_cnt?total_cnt:cnt) ||
+   mnstr_write(lg->current->output_log, , 1, 1) != 1 ||
+   !mnstr_writeLng(lg->current->output_log, 
total_cnt?-1:offset)) { /* offset = -1 indicates bat was logged in parts */
ok = GDK_FAIL;
goto bailout;
}
@@ -2696,7 +2718,9 @@ log_bat_persists(logger *lg, BAT *b, log
l.flag = LOG_CREATE;
l.id = id;
if 

MonetDB: default - merged

2023-07-27 Thread Niels Nes via checkin-list
Changeset: 765c7d9cafb9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/765c7d9cafb9
Branch: default
Log Message:

merged


diffs (truncated from 1067 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2430,20 +2430,32 @@ gdk_export BAT *BATsample_with_seed(BAT 
  * on each iteration */
 #define TIMEOUT_LOOP_IDX(IDX, REPEATS, TIMEOFFSET) \
for (BUN REPS = (IDX = 0, (REPEATS)); REPS > 0; REPS = 0) /* "loops" at 
most once */ \
-   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET = 
GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
+   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET)) { \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? 
REPS & CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, 
IDX++)
 
 /* declare and use IDX as a loop variable, initializing it to 0 and
  * incrementing it on each iteration */
 #define TIMEOUT_LOOP_IDX_DECL(IDX, REPEATS, TIMEOFFSET)
\
for (BUN IDX = 0, REPS = (REPEATS); REPS > 0; REPS = 0) /* "loops" at 
most once */ \
-   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET = 
GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
+   for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >> 
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET)) { \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? 
REPS & CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, 
IDX++)
 
 /* there is no user-visible loop variable */
 #define TIMEOUT_LOOP(REPEATS, TIMEOFFSET)  \
-   for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS + 
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET 
>= 0; CTR1++, TIMEOFFSET = GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > 
TIMEOFFSET) ? -1 : TIMEOFFSET) \
-   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
+   for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS + 
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET 
>= 0; CTR1++) \
+   if (GDKexiting() || (TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET)) 
{ \
+   TIMEOFFSET = -1;\
+   break;  \
+   } else  \
+   for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS & 
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
 
 /* break out of the loop (cannot use do/while trick here) */
 #define TIMEOUT_LOOP_BREAK \
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2008,6 +2008,12 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
BUN i;
oid o;
 
+   lng timeoffset = 0;
+   QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+   if (qry_ctx != NULL) {
+   timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? 
(qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+   }
+
if ((err = BATgroupaggrinit(b, g, e, s, , , , )) != 
NULL) {
GDKerror("%s\n", err);
return GDK_FAIL;
@@ -2053,7 +2059,7 @@ BATgroupavg3(BAT **avgp, BAT **remp, BAT
case TYPE_bte: {
const bte *vals = (const bte *) bi.base;
bte *avgs = Tloc(bn, 0);
-   CAND_LOOP() {
+   TIMEOUT_LOOP(ci.ncand, timeoffset) {
o = canditer_next() - b->hseqbase;
if (ngrp > 1)
   

MonetDB: default - merged

2023-07-15 Thread Niels Nes via checkin-list
Changeset: 3919d39ffd44 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3919d39ffd44
Branch: default
Log Message:

merged


diffs (12 lines):

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
@@ -541,7 +541,7 @@ file_loader_add_table_column_types(mvc *
 
file_loader_t *fl = fl_find(ext);
if (!fl)
-   return sa_message(sql->ta, "extension '%s' mising", ext?ext:"");
+   return sa_message(sql->ta, "extension '%s' missing", 
ext?ext:"");
str err = fl->add_types(sql, f, filename, res_exps, tname);
if (err)
return err;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2023-07-13 Thread Niels Nes via checkin-list
Changeset: 636832e361e7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/636832e361e7
Branch: default
Log Message:

merged


diffs (272 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -484,8 +484,7 @@ SQLhelp sqlhelp1[] = {
 "[ HAVING condition [',' ...] ]\n"
 "[ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] [ CORRESPONDING ] 
select ]\n"
 "[ ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [',' 
...] ]\n"
-"[ LIMIT { count | param } ]\n"
-"[ OFFSET { count | param } ]\n"
+"[ limit_offset_clause | offset_fetchfirst_clause ]\n"
 "[ SAMPLE size [ SEED size ] ]",
 "cte_list,expression,group_by_element,window_definition",
 "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-manipulation/table-expressions/"},
@@ -832,8 +831,8 @@ SQLhelp sqlhelp2[] = {
 NULL},
{"query_expression",
 NULL,
-"select_no_parens [ order_by_clause ] [ limit_clause ] [ offset_clause 
] [ sample_clause ]",
-
"select_no_parens,order_by_clause,limit_clause,offset_clause,sample_clause",
+"select_no_parens [ order_by_clause ] [ limit_offset_clause | 
offset_fetchfirst_clause ] [ sample_clause ]",
+"select_no_parens",
 NULL},
{"select_no_parens",
 NULL,
@@ -842,6 +841,21 @@ SQLhelp sqlhelp2[] = {
 "| '(' select_no_parens ')' }",
 
"column_exp_commalist,from_clause,window_clause,where_clause,group_by_clause,having_clause,corresponding",
 NULL},
+   {"order_by_clause",
+NULL,
+"ORDER BY expression [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [',' 
...]",
+"",
+NULL},
+   {"limit_offset_clause",
+NULL,
+"[ LIMIT { count | param } ]  [ OFFSET { count | param } ]",
+"",
+NULL},
+   {"offset_fetchfirst_clause",
+NULL,
+"[ OFFSET { count | param } [ {ROW|ROWS} ] ]  [ FETCH {FIRST|NEXT} [ 
count | param ] {ROW|ROWS} ONLY ]",
+"",
+NULL},
{"corresponding",
 NULL,
 "{ CORRESPONDING | CORRESPONDING BY '(' column_ref_commalist ')' }",
diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -1,3 +1,18 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Fri Jul 7 2023 Niels Nes 
+- Added SQL support for:  and 
+  in   ::=
+  [  ] 
+  [  ]
+  [  ]
+  [  ]
+  [  ]
+
+   ::=
+ OFFSET  [ {ROW|ROWS} ]
+
+   ::=
+ FETCH {FIRST|NEXT}  {ROW|ROWS} ONLY
+
diff --git a/sql/test/Tests/All b/sql/test/Tests/All
--- a/sql/test/Tests/All
+++ b/sql/test/Tests/All
@@ -70,6 +70,7 @@ create_in_schema
 null-byte-hang
 orderby_limit
 orderby_non_selection_column
+limit_offset_fetchfirst
 
 psm
 
diff --git a/sql/test/Tests/limit_offset_fetchfirst.test 
b/sql/test/Tests/limit_offset_fetchfirst.test
new file mode 100644
--- /dev/null
+++ b/sql/test/Tests/limit_offset_fetchfirst.test
@@ -0,0 +1,188 @@
+-- tests  [ LIMIT y ]  [ OFFSET x ]
+
+statement ok
+drop table if exists limittest
+
+statement ok
+create table limittest as select * from "sys"."generate_series"(1, 221)
+
+query I nosort
+select * from limittest LIMIT 5
+
+1
+2
+3
+4
+5
+
+statement error
+select * from limittest LIMIT +5
+
+statement error
+select * from limittest LIMIT 0
+
+statement error
+select * from limittest LIMIT -5
+
+statement error
+select * from limittest LIMIT 20, 50
+
+statement error
+select * from limittest LIMIT OFFSET 20, 50
+
+statement error
+select * from limittest OFFSET 20 LIMIT 50
+
+query I rowsort
+select * from limittest LIMIT 5 OFFSET 20
+
+21
+22
+23
+24
+25
+
+statement error
+select * from limittest LIMIT 5 OFFSET 20 ROWS
+
+statement error
+select * from limittest LIMIT 5 ROWS OFFSET 20
+
+
+-- tests  [ OFFSET pos_lng [ {ROW|ROWS} ] ]  [ FETCH {FIRST|NEXT} nonzero_lng 
{ROW|ROWS} ONLY ]
+
+statement error
+select * from limittest OFFSET 
+
+statement error
+select * from limittest OFFSET ROW
+
+query I rowsort
+select * from limittest OFFSET 218
+
+219
+220
+
+query I rowsort
+select * from limittest OFFSET 219 ROW
+
+220
+
+query I rowsort
+select * from limittest OFFSET 218 ROWS
+
+219
+220
+
+statement error
+select * from limittest OFFSET (200 + 18) ROWS
+
+statement error
+select * from limittest FETCH ROWS
+
+statement error
+select * from limittest FETCH ROWS ONLY
+
+statement error
+select * from limittest FETCH 0 ROWS ONLY
+
+query I rowsort
+select * from limittest FETCH NEXT ROW ONLY
+
+1
+
+query I rowsort
+select * from limittest FETCH FIRST 4 ROWS ONLY
+
+1
+2
+3
+4
+
+query I rowsort
+select * from limittest OFFSET 5 FETCH FIRST 4 ROWS ONLY
+
+6
+7
+8
+9
+
+query I rowsort
+select * from limittest OFFSET 5 FETCH NEXT 4 ROWS ONLY
+
+6
+7
+8
+9
+
+query I rowsort
+select * from limittest FETCH FIRST ROW ONLY

MonetDB: default - merged with jun2023

2023-07-13 Thread Niels Nes via checkin-list
Changeset: 5863ea78ff21 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5863ea78ff21
Modified Files:
common/stream/CMakeLists.txt
gdk/CMakeLists.txt
gdk/gdk_bbp.c
Branch: default
Log Message:

merged with jun2023


diffs (58 lines):

diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt
--- a/common/stream/CMakeLists.txt
+++ b/common/stream/CMakeLists.txt
@@ -130,10 +130,9 @@ install(TARGETS
   DESTINATION ${CMAKE_INSTALL_LIBDIR}
   COMPONENT stream
   PUBLIC_HEADER
+  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb
   COMPONENT streamdev
-  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb
-  INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-  COMPONENT streamdev)
+  INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
 install(EXPORT streamTargets
   FILE streamTargets.cmake
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -141,7 +141,6 @@ endif()
 
 install(TARGETS
   bat
-  COMPONENT monetdb
   EXPORT gdkTargets
   RUNTIME
   DESTINATION ${CMAKE_INSTALL_BINDIR}
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1846,6 +1846,7 @@ BBPinit(void)
  */
 
 static int backup_files = 0, backup_dir = 0, backup_subdir = 0;
+static char *lockfile = NULL;
 
 void
 BBPexit(void)
@@ -1903,7 +1904,10 @@ BBPexit(void)
backup_files = 0;
backup_dir = 0;
backup_subdir = 0;
-
+   if (lockfile) {
+   GDKfree(lockfile);
+   lockfile = NULL;
+   }
 }
 
 /*
@@ -4492,7 +4496,6 @@ BBPcallbacks(void)
  * This is at the end of the file on purpose: we don't want people to
  * accidentally use GDKtmLock directly. */
 static MT_Lock GDKtmLock = MT_LOCK_INITIALIZER(GDKtmLock);
-static char *lockfile;
 static int lockfd;
 
 void
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with jun2023

2023-07-13 Thread Niels Nes via checkin-list
Changeset: 633b99a61e7e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/633b99a61e7e
Modified Files:
gdk/CMakeLists.txt
gdk/gdk_bat.c
gdk/gdk_bbp.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/common/sql_list.c
sql/server/rel_select.c
Branch: default
Log Message:

merged with jun2023


diffs (truncated from 1721 to 300 lines):

diff --git a/ChangeLog.Sep2022 b/ChangeLog.Sep2022
deleted file mode 100644
--- a/ChangeLog.Sep2022
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for devel
-# This file is updated with Maddlog
-
diff --git a/clients/ChangeLog.Sep2022 b/clients/ChangeLog.Sep2022
deleted file mode 100644
--- a/clients/ChangeLog.Sep2022
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for clients
-# This file is updated with Maddlog
-
diff --git a/clients/mapilib/ChangeLog.Sep2022 
b/clients/mapilib/ChangeLog.Sep2022
deleted file mode 100644
--- a/clients/mapilib/ChangeLog.Sep2022
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for mapilib
-# This file is updated with Maddlog
-
diff --git a/clients/odbc/ChangeLog.Sep2022 b/clients/odbc/ChangeLog.Sep2022
deleted file mode 100644
--- a/clients/odbc/ChangeLog.Sep2022
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for odbc
-# This file is updated with Maddlog
-
diff --git a/common/stream/ChangeLog.Sep2022 b/common/stream/ChangeLog.Sep2022
deleted file mode 100644
--- a/common/stream/ChangeLog.Sep2022
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for stream
-# This file is updated with Maddlog
-
diff --git a/gdk/CMakeLists.txt b/gdk/CMakeLists.txt
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -145,6 +145,7 @@ install(TARGETS
   EXPORT gdkTargets
   RUNTIME
   DESTINATION ${CMAKE_INSTALL_BINDIR}
+  COMPONENT monetdb
   LIBRARY
   DESTINATION ${CMAKE_INSTALL_LIBDIR}
   COMPONENT monetdb
@@ -155,8 +156,7 @@ install(TARGETS
   PUBLIC_HEADER
   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/monetdb
   COMPONENT monetdbdev
-  INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-  COMPONENT monetdbdev)
+  INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
 install(EXPORT gdkTargets
   FILE gdkTargets.cmake
diff --git a/gdk/ChangeLog.Sep2022 b/gdk/ChangeLog.Sep2022
deleted file mode 100644
--- a/gdk/ChangeLog.Sep2022
+++ /dev/null
@@ -1,3 +0,0 @@
-# ChangeLog file for GDK
-# This file is updated with Maddlog
-
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -283,10 +283,12 @@ COLnew2(oid hseq, int tt, BUN cap, role_
}
 
if (bn->tvheap && width == 0 && ATOMheap(tt, bn->tvheap, cap) != 
GDK_SUCCEED) {
+   HEAPfree(bn->theap, true);
goto bailout;
}
DELTAinit(bn);
if (BBPcacheit(bn, true) != GDK_SUCCEED) {
+   /* cannot happen, function always returns success */
goto bailout;
}
TRC_DEBUG(ALGO, "-> " ALGOBATFMT "\n", ALGOBATPAR(bn));
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2207,8 +2207,7 @@ void
 BBPdump(void)
 {
size_t mem = 0, vm = 0;
-   size_t cmem = 0, cvm = 0;
-   int n = 0, nc = 0;
+   int n = 0;
 
for (bat i = 0; i < (bat) ATOMIC_GET(); i++) {
if (BBP_refs(i) == 0 && BBP_lrefs(i) == 0)
@@ -2240,15 +2239,9 @@ BBPdump(void)
b->theap->farmid,
b->theap->base == NULL ? "X" : 
b->theap->storage == STORE_MMAP ? "M" : "",
status & BBPSWAPPED ? "(Swapped)" : 
b->theap->dirty ? "(Dirty)" : "");
-   if (BBP_logical(i) && BBP_logical(i)[0] == '.') 
{
-   cmem += HEAPmemsize(b->theap);
-   cvm += HEAPvmsize(b->theap);
-   nc++;
-   } else {
-   mem += HEAPmemsize(b->theap);
-   vm += HEAPvmsize(b->theap);
-   n++;
-   }
+   mem += HEAPmemsize(b->theap);
+   vm += HEAPvmsize(b->theap);
+   n++;
}
}
if (b->tvheap) {
@@ -2264,13 +2257,8 @@ BBPdump(void)
b->tvheap->farmid,
b->tvheap->base == NULL ? "X" : 
b->tvheap->storage == STORE_MMAP ? "M" : "",
b->tvheap->dirty ? "(Dirty)" : "");
-   if (BBP_logical(i) && BBP_logical(i)[0] == '.') 
{
-   cmem += HEAPmemsize(b->tvheap);
-   cvm += HEAPvmsize(b->tvheap);
-   } else {
-   

MonetDB: default - merged with jun2023

2023-07-07 Thread Niels Nes via checkin-list
Changeset: a854ef9f873d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a854ef9f873d
Branch: default
Log Message:

merged with jun2023


diffs (67 lines):

diff --git a/ctest/monetdb5/mal/test_malEmbeddedBoot.c 
b/ctest/monetdb5/mal/test_malEmbeddedBoot.c
--- a/ctest/monetdb5/mal/test_malEmbeddedBoot.c
+++ b/ctest/monetdb5/mal/test_malEmbeddedBoot.c
@@ -18,6 +18,12 @@ main(void)
 char* msg = MAL_SUCCEED;
 gdk_return gdk_res;
 
+   if (BBPaddfarm(NULL, (1U << PERSISTENT) | (1U << TRANSIENT), false) != 
GDK_SUCCEED) {
+   /* set in memory dbfarm */
+   createException(MAL, "embedded.monetdb_startup", "BBPaddfram() 
failed");
+   return 1;
+   }
+
 gdk_res = GDKinit(NULL, 0, true, NULL);
 if (gdk_res != GDK_SUCCEED) {
msg = createException(MAL, "embedded.monetdb_startup", 
"GDKinit() failed");
diff --git a/ctest/monetdb5/mal/test_malInclude.c 
b/ctest/monetdb5/mal/test_malInclude.c
--- a/ctest/monetdb5/mal/test_malInclude.c
+++ b/ctest/monetdb5/mal/test_malInclude.c
@@ -18,6 +18,12 @@ main(void)
 {
 gdk_return gdk_res;
 
+   if (BBPaddfarm(NULL, (1U << PERSISTENT) | (1U << TRANSIENT), false) != 
GDK_SUCCEED) {
+   /* set in memory dbfarm */
+   createException(MAL, "embedded.monetdb_startup", "BBPaddfram() 
failed");
+   return 1;
+   }
+
 gdk_res = GDKinit(NULL, 0, true, NULL);
 if (gdk_res != GDK_SUCCEED) {
createException(MAL, "embedded.monetdb_startup", "GDKinit() 
failed");
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1441,6 +1441,7 @@ SQLparser(Client c, backend *be)
be->q->name = NULL; /* later remove 
cleanup from mal from qc code */
qc_delete(m->qc, be->q);
}
+   be->result_id = be->q->id;
be->q = NULL;
}
if (err)
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3395,6 +3395,8 @@ sql_trans_copy_key( sql_trans *tr, sql_t
 
if (nk->type == fkey) {
sql_key *rkey = (sql_key*)os_find_id(tr->cat->objects, tr, 
((sql_fkey*)k)->rkey);
+   if (!rkey)
+   return LOG_ERR;
 
if ((res = sql_trans_create_dependency(tr, rkey->base.id, 
nk->base.id, FKEY_DEPENDENCY)))
return res;
diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -411,7 +411,7 @@ monetdbe_query_internal(monetdbe_databas
if ((mdbe->msg = SQLengine_(c)) != MAL_SUCCEED)
goto cleanup;
if (m->emode == m_prepare && prepare_id)
-   *prepare_id = b->q->id;
+   *prepare_id = b->result_id;
if (!b->results && b->rowcnt >= 0 && affected_rows)
*affected_rows = b->rowcnt;
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with jun2023

2023-07-01 Thread Niels Nes via checkin-list
Changeset: c3dca2c13397 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c3dca2c13397
Modified Files:
.hgtags
Branch: default
Log Message:

merged with jun2023


diffs (164 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -806,3 +806,4 @@ 8b736d6dcfd63d0560c99fc5427b504c116b74b0
 8b736d6dcfd63d0560c99fc5427b504c116b74b0 Sep2022_SP3_release
 aba8c31c60480148cd388a09ac99b42679406258 Jun2023_1
 79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_3
+79dbf838f04483a2d9ccce8332090ff91b18caec Jun2023_release
diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -212,6 +212,10 @@ STRMPmakebitstring(const char *s, Strimp
pi.pos = 0;
pi.lim = strlen(s);
 
+   if (pi.lim < 2) {
+   return ret;
+   }
+
while(pair_at(, )) {
pair_idx = STRMPpairLookup(r, );
if (pair_idx >= 0)
@@ -324,6 +328,9 @@ STRMPbuildHeader(BAT *b, BAT *s, CharPai
pi.s = cs;
pi.pos = 0;
pi.lim = strlen(pi.s);
+   if (pi.lim < 2) {
+   continue;
+   }
while (pair_at(pip, cpp)) {
if(ignored(cpp, 1)) {
/* Skip this AND the next pair
diff --git a/sql/test/strimps/Tests/All b/sql/test/strimps/Tests/All
--- a/sql/test/strimps/Tests/All
+++ b/sql/test/strimps/Tests/All
@@ -2,3 +2,4 @@ strimps_stable_counts
 strimps_stable_counts2
 persisted_strimp
 strimps_not_like
+small_string_crash
diff --git a/sql/test/strimps/Tests/small_string_crash.test 
b/sql/test/strimps/Tests/small_string_crash.test
new file mode 100644
--- /dev/null
+++ b/sql/test/strimps/Tests/small_string_crash.test
@@ -0,0 +1,119 @@
+statement ok
+CREATE TABLE fal(x STRING)
+
+statement ok
+COPY 100 RECORDS INTO fal FROM STDIN USING DELIMITERS ',','\n','"'
+
+Mary Garcia
+James Ballard
+Alexandria Harris
+Dakota Howell
+Tracy Glover
+Mark Cook
+James Woodard
+Sophia Stone
+Jeffrey Ramirez
+Ryan Knight
+Taylor Lane
+Christopher Russell
+Daniel Sims
+Tony Watts
+Dwayne Johnson
+Jason Dunlap
+Abigail Burton
+Maria Lewis
+Ashley Taylor
+Emma Abbott
+James Whitney
+Philip Maldonado
+Rachel Taylor
+Tina Singleton
+Ricky Johnson
+Anthony Peterson
+Eugene Mata
+Tyler Terry
+Thomas Morales
+Kathy Moore
+William Franco
+Christopher Williams
+David Carter
+Andrew Alvarado
+John Jenkins
+Anthony Charles
+Jose Tran
+Amy Stafford
+Vincent Malone
+Ashley Waters
+Cindy Huffman
+Anthony Hernandez
+Brett Hardy
+Lisa Matthews
+Jeffrey Ingram
+Jessica Miller
+Karen Jones
+Terry Sanders
+Aaron Rodriguez
+Kyle Ortega
+David Clark
+Brent Garrett
+Scott Young
+Shannon Edwards
+Tiffany Macias
+Ricky Gonzalez
+Devin Logan
+Russell Walker
+Michael Nguyen
+Heather Robinson
+April Lawrence
+Christopher Williams
+Laura Gonzalez
+Patrick Ortiz
+Sylvia Phillips
+Cynthia Kemp
+Stephanie Gillespie
+Elizabeth Joseph
+Jay Collins
+Johnny Gibson
+Dr. Audrey Sellers MD
+Desiree Li
+Heather Brown
+Shelly Bauer
+Donna Anderson
+Amy Sharp
+Olivia Howell
+Margaret Tran
+Alexandra Jarvis
+Glen Ray
+Michael Mendoza
+Sarah Hall
+Dennis Moss
+Wanda Brooks
+Debra Powers
+Shannon Nguyen
+Daisy Mcdonald
+Donna Rivera
+Samuel Jackson
+Wendy Howe
+Connor Howell
+Jeffrey Newman
+Daniel Sullivan
+Megan Dunn
+Laura Holland
+Brendan Bates
+Mary Miller
+Thomas Ramirez
+a
+""
+
+
+statement ok
+ALTER TABLE fal SET READ ONLY
+
+statement ok
+CREATE IMPRINTS INDEX fal_index ON fal(x)
+
+query T
+SELECT * FROM fal WHERE x LIKE 'Daniel%'
+
+Daniel Sims
+Daniel Sullivan
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Jun2023

2023-06-26 Thread Niels Nes via checkin-list
Changeset: 6b54c415dec0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6b54c415dec0
Branch: default
Log Message:

merged with Jun2023


diffs (232 lines):

diff --git a/clients/odbc/tests/ODBCStmtAttr.c 
b/clients/odbc/tests/ODBCStmtAttr.c
--- a/clients/odbc/tests/ODBCStmtAttr.c
+++ b/clients/odbc/tests/ODBCStmtAttr.c
@@ -188,12 +188,19 @@ main(int argc, char **argv)
"Set SQL_ATTR_MAX_LENGTH: 2147483641\n"
"Get SQL_ATTR_MAX_LENGTH: 0\n"
" which is different from 2147483641 !!\n");
+#if (SIZEOF_LONG_INT == 8)
GetSetReGetStmtAttr(stmt, SQL_ATTR_MAX_LENGTH, -1,  /* test also 
what happens with a negative value */
"Get SQL_ATTR_MAX_LENGTH: 0\n"
"Set SQL_ATTR_MAX_LENGTH: 18446744073709551615\n"
"Get SQL_ATTR_MAX_LENGTH: 0\n"
" which is different from 18446744073709551615 !!\n");
-
+#else
+   GetSetReGetStmtAttr(stmt, SQL_ATTR_MAX_LENGTH, -1,  /* test also 
what happens with a negative value */
+   "Get SQL_ATTR_MAX_LENGTH: 0\n"
+   "Set SQL_ATTR_MAX_LENGTH: 4294967295\n"
+   "Get SQL_ATTR_MAX_LENGTH: 0\n"
+   " which is different from 4294967295 !!\n");
+#endif
GetSetReGetStmtAttr(stmt, SQL_ATTR_MAX_ROWS, 0,
"Get SQL_ATTR_MAX_ROWS: 0\n"
"Set SQL_ATTR_MAX_ROWS: 0\n"
@@ -208,11 +215,19 @@ main(int argc, char **argv)
"Set SQL_ATTR_MAX_ROWS: 2147483642\n"
"Get SQL_ATTR_MAX_ROWS: 0\n"
" which is different from 2147483642 !!\n");
+#if (SIZEOF_LONG_INT == 8)
GetSetReGetStmtAttr(stmt, SQL_ATTR_MAX_ROWS, -2,/* test also 
what happens with a negative value */
"Get SQL_ATTR_MAX_ROWS: 0\n"
"Set SQL_ATTR_MAX_ROWS: 18446744073709551614\n"
"Get SQL_ATTR_MAX_ROWS: 0\n"
" which is different from 18446744073709551614 !!\n");
+#else
+   GetSetReGetStmtAttr(stmt, SQL_ATTR_MAX_ROWS, -2,/* test also 
what happens with a negative value */
+   "Get SQL_ATTR_MAX_ROWS: 0\n"
+   "Set SQL_ATTR_MAX_ROWS: 4294967294\n"
+   "Get SQL_ATTR_MAX_ROWS: 0\n"
+   " which is different from 4294967294 !!\n");
+#endif
 
GetSetReGetStmtAttr(stmt, SQL_ATTR_QUERY_TIMEOUT, 0,
"Get SQL_ATTR_QUERY_TIMEOUT: 0\n"
@@ -229,11 +244,19 @@ main(int argc, char **argv)
"Set SQL_ATTR_QUERY_TIMEOUT: 2147483643\n"
"Get SQL_ATTR_QUERY_TIMEOUT: 2147483647\n"
" which is different from 2147483643 !!\n");
+#if (SIZEOF_LONG_INT == 8)
GetSetReGetStmtAttr(stmt, SQL_ATTR_QUERY_TIMEOUT, -3,   /* test also 
what happens with a negative value */
"Get SQL_ATTR_QUERY_TIMEOUT: 2147483647\n"
"Set SQL_ATTR_QUERY_TIMEOUT: 18446744073709551613\n"
"Get SQL_ATTR_QUERY_TIMEOUT: 2147483647\n"
" which is different from 18446744073709551613 !!\n");
+#else
+   GetSetReGetStmtAttr(stmt, SQL_ATTR_QUERY_TIMEOUT, -3,   /* test also 
what happens with a negative value */
+   "Get SQL_ATTR_QUERY_TIMEOUT: 2147483647\n"
+   "Set SQL_ATTR_QUERY_TIMEOUT: 4294967293\n"
+   "Get SQL_ATTR_QUERY_TIMEOUT: 2147483647\n"
+   " which is different from 4294967293 !!\n");
+#endif
 
ret = SQLFreeHandle(SQL_HANDLE_STMT, stmt);
check(ret, SQL_HANDLE_STMT, stmt, "SQLFreeHandle (STMT)");
diff --git a/sql/test/SQLancer/Tests/sqlancer18.test 
b/sql/test/SQLancer/Tests/sqlancer18.test
--- a/sql/test/SQLancer/Tests/sqlancer18.test
+++ b/sql/test/SQLancer/Tests/sqlancer18.test
@@ -255,144 +255,10 @@ SELECT CAST(SUM(count) AS BIGINT) FROM (
 
 135
 
-query R rowsort
-SELECT sub0.c2 FROM t2 JOIN (SELECT DISTINCT t2.c2, 3 FROM t2) AS sub0(c2,c3) 
on t2.c2 = sub0.c2
+query I rowsort
+SELECT count(sub0.c2) FROM t2 JOIN (SELECT DISTINCT t2.c2, 3 FROM t2) AS 
sub0(c2,c3) on t2.c2 = sub0.c2
 
--0.000
--1.000
--1.000
--1087290368.000
--1268147100.000
--1462578700.000
--1701868600.000
--2044814500.000
--444399328.000
--5.000
--5.370
--6.000
--707779136.000
--8.000
--809476200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545200.000
--870545216.000
--870545216.000
--870545216.000
--946846140.000
-0.000
-0.000
-0.000
-0.000
-0.000
-0.002
-0.029
-0.071
-0.104
-0.121
-0.124
-0.126
-0.172
-0.181
-0.185
-0.188
-0.212
-0.235
-0.244
-0.254
-0.256
-0.283
-0.292
-0.293
-0.293
-0.295
-0.307
-0.311
-0.325
-0.348
-0.356
-0.357
-0.357
-0.360
-0.374
-0.379
-0.384
-0.391
-0.419
-0.438
-0.458
-0.492
-0.493
-0.494
-0.514
-0.517
-0.536
-0.538
-0.550
-0.560
-0.579
-0.581
-0.607
-0.613
-0.624
-0.643
-0.644

MonetDB: default - merged with Jun2023

2023-06-09 Thread Niels Nes via checkin-list
Changeset: 73454c94db30 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/73454c94db30
Branch: default
Log Message:

merged with Jun2023


diffs (truncated from 703 to 300 lines):

diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake
--- a/cmake/monetdb-toolchain.cmake
+++ b/cmake/monetdb-toolchain.cmake
@@ -27,6 +27,15 @@ function(monetdb_default_compiler_option
   else()
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" PARENT_SCOPE)
   endif()
+elseif ("${CMAKE_C_COMPILER_ID}" MATCHES "^(Clang|AppleClang)$")
+  add_compile_options("-fsanitize=address")
+  add_compile_options("-fno-omit-frame-pointer")
+  add_compile_definitions(SANITIZER)
+  if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
+add_link_options("-fsanitize=address")
+  else()
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" PARENT_SCOPE)
+  endif()
 else()
   message(FATAL_ERROR "Sanitizer only supported with GCC")
 endif()
diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c
--- a/gdk/gdk_strimps.c
+++ b/gdk/gdk_strimps.c
@@ -141,7 +141,7 @@ histogram_index(PairHistogramElem *hist,
 inline static bool
 pair_at(PairIterator *pi, CharPair *p)
 {
-   if (pi->pos >= pi->lim)
+   if (pi->pos >= pi->lim - 1)
return false;
p->pbytes = (uint8_t*)pi->s + pi->pos;
p->psize = 2;
@@ -151,7 +151,7 @@ pair_at(PairIterator *pi, CharPair *p)
 inline static bool
 next_pair(PairIterator *pi)
 {
-   if (pi->pos >= pi->lim)
+   if (pi->pos >= pi->lim - 1)
return false;
pi->pos++;
return true;
@@ -688,14 +688,7 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s)
if ((r = b->tstrimps) == NULL &&
STRMPbuildHeader(b, s, hpairs)) { /* Find the header pairs, put
 the result in hpairs */
-   /* The 64th bit in the bit string is used to indicate if
-  the string is NULL. So the corresponding pair does
-  not encode useful information. We need to keep it for
-  alignment but we must make sure that it will not
-  match an actual pair of characters we encounter in
-  strings.*/
-   for (i = 0; i < hpairs[STRIMP_HEADER_SIZE - 1].psize; i++)
-   hpairs[STRIMP_HEADER_SIZE - 1].pbytes[i] = 0;
+
sz = 8 + STRIMP_HEADER_SIZE; /* add 8-bytes for the descriptor 
and
the pair sizes */
for (i = 0; i < STRIMP_HEADER_SIZE; i++) {
@@ -725,12 +718,25 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s)
r->sizes_base = h1 = (uint8_t *)r->strimps.base + 8;
r->pairs_base = h2 = (uint8_t *)h1 + STRIMP_HEADER_SIZE;
 
-   for (i = 0; i < STRIMP_HEADER_SIZE; i++) {
+   for (i = 0; i < STRIMP_HEADER_SIZE - 1; i++) {
uint8_t psize = hpairs[i].psize;
h1[i] = psize;
memcpy(h2, hpairs[i].pbytes, psize);
h2 += psize;
}
+
+   /* The 64th bit in the bit string is used to indicate if
+  the string is NULL. So the corresponding pair does
+  not encode useful information. We need to keep it for
+  alignment but we must make sure that it will not
+  match an actual pair of characters we encounter in
+  strings.*/
+   h1[STRIMP_HEADER_SIZE - 1] = hpairs[STRIMP_HEADER_SIZE - 
1].psize;
+   for(i = 0; i < hpairs[STRIMP_HEADER_SIZE - 1].psize; i++) {
+   *(h2 + i) = 0;
+   }
+   h2 += hpairs[STRIMP_HEADER_SIZE - 1].psize;
+
r->bitstrings_base = h2;
r->strimps.free = sz;
r->rec_cnt = 0;
diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c
--- a/monetdb5/mal/mal_embedded.c
+++ b/monetdb5/mal/mal_embedded.c
@@ -69,7 +69,7 @@ malEmbeddedBoot(int workerlimit, int mem
"unable to open vault_key_file %s: 
%s\n",
GDKgetenv("monet_vault_key"), 
strerror(errno));
}
-   len = fread(secret, 1, sizeof(secret), secretf);
+   len = fread(secret, 1, sizeof(secret) - 1, secretf);
fclose(secretf);
secret[len] = '\0';
len = strlen(secret); /* secret can contain null-bytes 
*/
diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022
--- a/sql/ChangeLog.Sep2022
+++ b/sql/ChangeLog.Sep2022
@@ -1,3 +1,9 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Fri Jun  9 2023 Sjoerd Mullender 
+- An upgrade that both creates a new .snapshot user and extends the
+  

MonetDB: default - merged with jun2023

2023-05-28 Thread Niels Nes
Changeset: 6cae651b3992 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6cae651b3992
Modified Files:
clients/odbc/winsetup/setup.rc
Branch: default
Log Message:

merged with jun2023


diffs (truncated from 6306 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -50485,45 +50485,75 @@ STRcontains;
 Check if string chaystack contains string needle, icase flag.
 str
 containsjoin
-command 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] 
+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
+The same as STRcontainsjoin, but only produce one output + icase.
 str
 containsjoin
-command 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]) 
+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.
+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]) 
+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[: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
 containsselect
-command str.containsselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, X_3:bit, 
X_4:bit):bat[:oid] 
+pattern str.containsselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, 
X_3:bit):bat[:oid] 
 STRcontainsselect;
 Select all head values of the first input BAT for which the@tail value 
contains the given needle.
 str
-endsWith
-pattern str.endsWith(X_0:str, X_1:str):bit 
-STRendsWith;
+containsselect
+pattern str.containsselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, X_3:bit, 
X_4:bit):bat[:oid] 
+STRcontainsselect;
+Select all head values of the first input BAT for which the@tail value 
contains the given needle + icase.
+str
+endswith
+pattern str.endswith(X_0:str, X_1:str):bit 
+STRendswith;
 Check if string ends with substring.
 str
-endsWith
-pattern str.endsWith(X_0:str, X_1:str, X_2:bit):bit 
-STRendsWith;
+endswith
+pattern str.endswith(X_0:str, X_1:str, X_2:bit):bit 
+STRendswith;
 Check if string ends with substring, icase flag.
 str
-endsWithjoin
-command 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] 
+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
-command 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]) 
+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[: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
-endsWithselect
-command str.endsWithselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, X_3:bit, 
X_4:bit):bat[:oid] 
+endswithselect
+pattern str.endswithselect(X_0:bat[:str], X_1:bat[:oid], X_2:str, 
X_3:bit):bat[:oid] 
 STRendswithselect;
 Select all head values of the first input BAT for which the@tail value end 
with the given suffix.
 str
+endswithselect
+pattern str.endswithselect(X_0:bat[:str], 

MonetDB: default - Merged txtsim into default.

2023-04-18 Thread Sjoerd Mullender
Changeset: 0c3380f252d0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0c3380f252d0
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
clients/Tests/exports.stable.out
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
Branch: default
Log Message:

Merged txtsim into default.


diffs (truncated from 9285 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -34574,35 +34574,130 @@ pattern batstr.ascii(X_0:bat[:str], X_1:
 STRbatAscii;
 Return unicode of head of string
 batstr
+asciify
+command batstr.asciify(X_0:bat[:str]):bat[:str] 
+BATSTRasciify;
+Transform BAT of strings from UTF8 to ASCII
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:bat[:str]):bat[:bit] 
+BATSTRcontains;
+Check if bat string haystack contains bat string needle.
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid]):bat[:bit] 
+BATSTRcontains;
+Check if bat string haystack contains bat string needle (with CLs).
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:bat[:str], X_2:bit):bat[:bit] 
+BATSTRcontains;
+Check if bat string haystack contains bat string needle, icase flag.
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:bat[:str], X_2:bit, X_3:bat[:oid], 
X_4:bat[:oid]):bat[:bit] 
+BATSTRcontains;
+Check if bat string haystack contains bat string needle (with CLs) + icase 
flag.
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:str):bat[:bit] 
+BATSTRcontains_cst;
+Check if bat string haystack contains string needle.
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:str, X_2:bat[:oid]):bat[:bit] 
+BATSTRcontains_cst;
+Check if bat string haystack contains string needle (with CL) ends with 
substring.
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:str, X_2:bit):bat[:bit] 
+BATSTRcontains_cst;
+Check if bat string haystack contains string needle, icase flag.
+batstr
+contains
+pattern batstr.contains(X_0:bat[:str], X_1:str, X_2:bit, 
X_3:bat[:oid]):bat[:bit] 
+BATSTRcontains_cst;
+Check if bat string haystack contains string needle (with CL) ends with 
substring + icase flag.
+batstr
+contains
+pattern batstr.contains(X_0:str, X_1:bat[:str]):bat[:bit] 
+BATSTRcontains_strcst;
+Check if string haystack contains bat string needle.
+batstr
+contains
+pattern batstr.contains(X_0:str, X_1:bat[:str], X_2:bat[:oid]):bat[:bit] 
+BATSTRcontains_strcst;
+Check if string haystack contains bat string needle (with CL).
+batstr
+contains
+pattern batstr.contains(X_0:str, X_1:bat[:str], X_2:bit):bat[:bit] 
+BATSTRcontains_strcst;
+Check if string haystack contains bat string needle + icase flag.
+batstr
+contains
+pattern batstr.contains(X_0:str, X_1:bat[:str], X_2:bit, 
X_3:bat[:oid]):bat[:bit] 
+BATSTRcontains_strcst;
+Check if string haystack contains bat string needle (with CL) + icase flag.
+batstr
 endsWith
 pattern batstr.endsWith(X_0:bat[:str], X_1:bat[:str]):bat[:bit] 
-STRbatSuffix;
-Suffix check.
+BATSTRends_with;
+Check if bat string ends with bat substring.
 batstr
 endsWith
 pattern batstr.endsWith(X_0:bat[:str], X_1:bat[:str], X_2:bat[:oid], 
X_3:bat[:oid]):bat[:bit] 
-STRbatSuffix;
-Suffix check.
+BATSTRends_with;
+Check if bat string ends with bat substring (with CLs).
+batstr
+endsWith
+pattern batstr.endsWith(X_0:bat[:str], X_1:bat[:str], X_2:bit):bat[:bit] 
+BATSTRends_with;
+Check if bat string ends with bat substring, icase flag.
+batstr
+endsWith
+pattern batstr.endsWith(X_0:bat[:str], X_1:bat[:str], X_2:bit, X_3:bat[:oid], 
X_4:bat[:oid]):bat[:bit] 
+BATSTRends_with;
+Check if bat string ends with bat substring (with CLs) + icase flag.
+batstr
+endsWith
+pattern batstr.endsWith(X_0:bat[:str], X_1:str):bat[:bit] 
+BATSTRends_with_cst;
+Check if bat string ends with substring.
+batstr
+endsWith
+pattern batstr.endsWith(X_0:bat[:str], X_1:str, X_2:bat[:oid]):bat[:bit] 
+BATSTRends_with_cst;
+Check if bat string(with CL) ends with substring.
+batstr
+endsWith
+pattern batstr.endsWith(X_0:bat[:str], X_1:str, X_2:bit):bat[:bit] 
+BATSTRends_with_cst;
+Check if bat string ends with substring, icase flag.
+batstr
+endsWith
+pattern batstr.endsWith(X_0:bat[:str], X_1:str, X_2:bit, 
X_3:bat[:oid]):bat[:bit] 
+BATSTRends_with_cst;
+Check if bat string(with CL) ends with substring + icase flag.
 batstr
 endsWith
 pattern batstr.endsWith(X_0:str, X_1:bat[:str]):bat[:bit] 
-STRbatSuffix_strcst;
-Suffix check.
+BATSTRends_with_strcst;
+Check if string ends with bat substring.
 batstr
 endsWith
 pattern batstr.endsWith(X_0:str, X_1:bat[:str], X_2:bat[:oid]):bat[:bit] 
-STRbatSuffix_strcst;
-Suffix check.
+BATSTRends_with_strcst;
+Check if string ends with bat substring(with CL).
 batstr
 endsWith
-pattern batstr.endsWith(X_0:bat[:str], X_1:str):bat[:bit] 

MonetDB: default - Merged simplify_scenario into default.

2023-04-18 Thread Sjoerd Mullender
Changeset: 9265aa8a2174 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9265aa8a2174
Modified Files:
sql/backends/monet5/sql.c
sql/server/sql_parser.y
Branch: default
Log Message:

Merged simplify_scenario into default.


diffs (truncated from 7994 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -44719,11 +44719,6 @@ unsafe pattern clients.setquerytimeout(X
 CLTqueryTimeout;
 A query is aborted after q seconds (q=0 means run undisturbed).
 clients
-setsession
-unsafe pattern clients.setsession(X_0:lng):void 
-CLTsetSessionTimeout;
-Abort a session after  n seconds.
-clients
 setsessiontimeout
 unsafe pattern clients.setsessiontimeout(X_0:int):void 
 CLTsessionTimeout;
@@ -44734,16 +44729,6 @@ unsafe pattern clients.setsessiontimeout
 CLTsessionTimeout;
 Set the session timeout for a particulat session id
 clients
-settimeout
-unsafe pattern clients.settimeout(X_0:lng):void 
-CLTsetTimeout;
-Abort a query after  n seconds.
-clients
-settimeout
-unsafe pattern clients.settimeout(X_0:lng, X_1:lng):void 
-CLTsetTimeout;
-Abort a query after q seconds (q=0 means run undisturbed).@The session timeout 
aborts the connection after spending too@many seconds on query processing.
-clients
 setworkerlimit
 unsafe pattern clients.setworkerlimit(X_0:int):void 
 CLTsetworkerlimit;
@@ -44923,36 +44908,6 @@ thetaselect
 pattern dict.thetaselect(X_0:bat[:any], X_1:bat[:oid], X_2:bat[:any_1], 
X_3:any_1, X_4:str):bat[:oid] 
 DICTthetaselect;
 thetaselect on a dictionary
-factories
-getArrival
-command factories.getArrival():bat[:timestamp] 
-FCTgetArrival;
-Retrieve the time stamp the last call was made.
-factories
-getCaller
-command factories.getCaller():int 
-FCTgetCaller;
-Retrieve the unique identity of the factory caller.
-factories
-getDeparture
-command factories.getDeparture():bat[:timestamp] 
-FCTgetDeparture;
-Retrieve the time stamp the last answer was returned.
-factories
-getOwners
-command factories.getOwners():bat[:str] 
-FCTgetOwners;
-Retrieve the factory owners table.
-factories
-getPlants
-command factories.getPlants() (X_0:bat[:str], X_1:bat[:str]) 
-FCTgetPlants;
-Retrieve the names for all active factories.
-factories
-shutdown
-pattern factories.shutdown(X_0:str, X_1:str):void 
-FCTshutdown;
-Close a factory.
 fits
 attach
 unsafe pattern fits.attach(X_0:str):void 
@@ -47199,11 +47154,6 @@ pattern mdb.List():void
 MDBlistDetail;
 Dump the current routine on standard out.
 mdb
-dump
-pattern mdb.dump():void 
-MDBdump;
-Dump instruction, stacktrace, and stack
-mdb
 getContext
 command mdb.getContext(X_0:str):str 
 MDBgetExceptionContext;
@@ -47259,11 +47209,6 @@ pattern mdb.getVMsize():lng
 MDBgetVMsize;
 Retrieve the max VM size
 mdb
-inspect
-pattern mdb.inspect(X_0:str, X_1:str):void 
-MDBinspect;
-Run the debugger on a specific function
-mdb
 list
 pattern mdb.list(X_0:str, X_1:str):void 
 MDBlist3;
@@ -47284,11 +47229,6 @@ command mdb.modules():bat[:str]
 CMDmodules;
 List available modules
 mdb
-setCatch
-pattern mdb.setCatch(X_0:bit):void 
-MDBsetCatch;
-Turn on/off catching exceptions
-mdb
 setDebug
 pattern mdb.setDebug(X_0:int):int 
 MDBsetDebug;
@@ -47299,41 +47239,11 @@ pattern mdb.setDebug(X_0:str):int
 MDBsetDebugStr;
 Set the kernel debugging bit-set and return its previous value.@The recognized 
options are: threads, memory, properties,@io, transactions, modules, 
algorithms, estimates.
 mdb
-setTrace
-pattern mdb.setTrace(X_0:bit):void 
-MDBsetTrace;
-Turn on/off tracing of current routine
-mdb
-setTrace
-pattern mdb.setTrace(X_0:str):void 
-MDBsetVarTrace;
-Turn on/off tracing of a variable 
-mdb
 setVMsize
 pattern mdb.setVMsize(X_0:lng):lng 
 MDBsetVMsize;
 Manipulate the VM max size in MBs
 mdb
-start
-pattern mdb.start():void 
-MDBstart;
-Start interactive debugger
-mdb
-start
-pattern mdb.start(X_0:int):void 
-MDBstart;
-Start interactive debugger on a client
-mdb
-start
-pattern mdb.start(X_0:str, X_1:str):void 
-MDBstartFactory;
-Start interactive debugger on a running factory
-mdb
-stop
-pattern mdb.stop():void 
-MDBstop;
-Stop the interactive debugger
-mdb
 var
 pattern mdb.var(X_0:str, X_1:str):void 
 MDBvar3;
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
@@ -33214,11 +33214,6 @@ unsafe pattern clients.setquerytimeout(X
 CLTqueryTimeout;
 A query is aborted after q seconds (q=0 means run undisturbed).
 clients
-setsession
-unsafe pattern clients.setsession(X_0:lng):void 
-CLTsetSessionTimeout;
-Abort a session after  n seconds.
-clients
 setsessiontimeout
 unsafe pattern clients.setsessiontimeout(X_0:int):void 
 CLTsessionTimeout;
@@ -33229,16 +33224,6 @@ unsafe pattern clients.setsessiontimeout
 CLTsessionTimeout;
 Set the session timeout for a particulat session id
 clients
-settimeout

MonetDB: default - merged

2023-04-15 Thread Niels Nes
Changeset: b7f22a40aa92 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b7f22a40aa92
Branch: default
Log Message:

merged


diffs (21 lines):

diff --git 
a/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test 
b/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test
--- a/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test
+++ b/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320-Windows.test
@@ -8,7 +8,7 @@ query T nosort
 plan copy into cm_tmp from E'\\file1',E'\\file2'
 
 insert(
-| table("sys"."cm_tmp") [ "cm_tmp"."i" NOT NULL UNIQUE, "cm_tmp"."%TID%" NOT 
NULL UNIQUE ]
+| table("sys"."cm_tmp") [ "cm_tmp"."i", "cm_tmp"."%TID%" NOT NULL UNIQUE ]
 | union (
 | | project (
 | | | table ("sys"."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", 
varchar NULL, varchar "null", varchar "\\file1", bigint(19) "-1", bigint(19) 
"0", int(9) "0", varchar NULL, int(9) "0", int(9) "1"), 
@@ -25,7 +25,7 @@ query T nosort
 plan copy into cm_tmp from E'a:\\file1','Z:/file2'
 
 insert(
-| table("sys"."cm_tmp") [ "cm_tmp"."i" NOT NULL UNIQUE, "cm_tmp"."%TID%" NOT 
NULL UNIQUE ]
+| table("sys"."cm_tmp") [ "cm_tmp"."i", "cm_tmp"."%TID%" NOT NULL UNIQUE ]
 | union (
 | | project (
 | | | table ("sys"."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", 
varchar NULL, varchar "null", varchar "a:\\file1", bigint(19) "-1", bigint(19) 
"0", int(9) "0", varchar NULL, int(9) "0", int(9) "1"), 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2023-04-12 Thread Niels Nes
Changeset: 946ed3791db7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/946ed3791db7
Modified Files:
sql/server/rel_unnest.c
Branch: default
Log Message:

merged with Sep2022


diffs (116 lines):

diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1602,6 +1602,19 @@ push_up_table(mvc *sql, sql_rel *rel, li
return rel;
 }
 
+static bool
+exps_have_rank(list *exps)
+{
+   if (!exps)
+   return false;
+   for(node *n=exps->h; n; n = n->next) {
+   sql_exp *e = n->data;
+   if (is_analytic(e))
+   return true;
+   }
+   return false;
+}
+
 static sql_rel *
 rel_unnest_dependent(mvc *sql, sql_rel *rel)
 {
@@ -1682,7 +1695,7 @@ rel_unnest_dependent(mvc *sql, sql_rel *
}
}
 
-   if (r && is_simple_project(r->op) && 
((!exps_have_freevar(sql, r->exps) && !exps_have_unsafe(r->exps, 1)) || 
is_distinct_set(sql, l, ad))) {
+   if (r && is_simple_project(r->op) && ((!r->r && 
!exps_have_rank(r->exps)) || (!exps_have_freevar(sql, r->exps) && 
!exps_have_unsafe(r->exps, 1)) || is_distinct_set(sql, l, ad))) {
rel = push_up_project(sql, rel, ad);
return rel_unnest_dependent(sql, rel);
}
diff --git a/sql/test/SQLancer/Tests/sqlancer18.test 
b/sql/test/SQLancer/Tests/sqlancer18.test
--- a/sql/test/SQLancer/Tests/sqlancer18.test
+++ b/sql/test/SQLancer/Tests/sqlancer18.test
@@ -313,7 +313,7 @@ SELECT vx.vc0 FROM vx WHERE vx.vc0 <> AL
 1970-01-01
 NULL
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT max((SELECT (SELECT rt2.c1 FROM t2) FROM t2 as rt2))
 
 statement ok
@@ -330,7 +330,7 @@ SELECT 1 FROM (select 4) v100(vc0) WHERE
 
 1
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 select 1 from t1 where exists (select min((select t2.c0 from t1)) from t1 as 
t2)
 
 query I rowsort
diff --git a/sql/test/subquery/Tests/correlated.test 
b/sql/test/subquery/Tests/correlated.test
--- a/sql/test/subquery/Tests/correlated.test
+++ b/sql/test/subquery/Tests/correlated.test
@@ -42,7 +42,7 @@ 3
 2
 1
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT i, (SELECT 42+i1.i FROM integers) AS j FROM integers i1 ORDER BY i
 
 statement error
@@ -329,7 +329,7 @@ NULL
 statement error 42000!SELECT: subquery must return only one column
 SELECT (SELECT SUM(i + i1.i), 1 FROM integers) FROM integers i1
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT (SELECT SUM(i1.i) FROM integers) AS k FROM integers i1 GROUP BY i ORDER 
BY i
 
 query II nosort
@@ -401,7 +401,7 @@ SELECT CAST(SUM((SELECT i+i1.i FROM inte
 
 9
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT i, CAST(SUM(i1.i) AS BIGINT), CAST((SELECT SUM(i1.i) FROM integers) AS 
BIGINT) AS k FROM integers i1 GROUP BY i ORDER BY i
 
 query II nosort
@@ -511,7 +511,7 @@ 2
 3
 3
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT i, SUM(i1.i) FROM integers i1 GROUP BY i ORDER BY (SELECT SUM(i1.i) 
FROM integers)
 
 statement error
diff --git a/sql/test/subquery/Tests/subquery2.test 
b/sql/test/subquery/Tests/subquery2.test
--- a/sql/test/subquery/Tests/subquery2.test
+++ b/sql/test/subquery/Tests/subquery2.test
@@ -296,7 +296,7 @@ 1
 0
 0
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT
(SELECT MAX(col6) FROM tbl_ProductSales) IN (SELECT MIN(col3) FROM 
another_T)
 FROM another_T
diff --git a/sql/test/subquery/Tests/subquery5.test 
b/sql/test/subquery/Tests/subquery5.test
--- a/sql/test/subquery/Tests/subquery5.test
+++ b/sql/test/subquery/Tests/subquery5.test
@@ -404,7 +404,7 @@ SELECT SUM((SELECT MAX(i1.i + i2.i) FROM
 
 15
 
-statement error GDK reported error: mergejoin: more than one match
+statement error GDK reported error: BATsubcross: more than one match
 SELECT CORR((SELECT i1.i FROM integers i2), (SELECT SUM(i1.i + i2.i) FROM 
integers i2)) FROM integers i1
 
 query I rowsort
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2023-04-11 Thread Niels Nes
Changeset: 630ae91e3530 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/630ae91e3530
Modified Files:
clients/Tests/MAL-signatures-hge.test
clients/Tests/MAL-signatures.test
gdk/gdk_group.c
monetdb5/modules/mal/mat.c
sql/backends/monet5/sql.c
sql/storage/store.c
Branch: default
Log Message:

merged with Sep2022


diffs (156 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -49381,7 +49381,7 @@ Write db snapshot to the given tar(.gz) 
 sql
 hot_snapshot
 unsafe pattern sql.hot_snapshot(X_0:str, X_1:bit):void 
-SQLhot_snapshot_wrap;
+SQLhot_snapshot;
 Write db snapshot to the given tar(.gz/.lz4/.bz/.xz) file on either server or 
client
 sql
 importColumn
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
@@ -37786,7 +37786,7 @@ Write db snapshot to the given tar(.gz) 
 sql
 hot_snapshot
 unsafe pattern sql.hot_snapshot(X_0:str, X_1:bit):void 
-SQLhot_snapshot_wrap;
+SQLhot_snapshot;
 Write db snapshot to the given tar(.gz/.lz4/.bz/.xz) file on either server or 
client
 sql
 importColumn
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -850,9 +850,11 @@ BATgroup_internal(BAT **groups, BAT **ex
MT_rwlock_rdunlock(>thashlock);
if (maxgrps == BUN_NONE) {
MT_lock_set(>theaplock);
-   if (bi.unique_est != 0)
+   if (bi.unique_est != 0) {
maxgrps = (BUN) bi.unique_est;
-   else
+   if (maxgrps > ci.ncand)
+   maxgrps = ci.ncand;
+   } else
maxgrps = ci.ncand / 10;
MT_lock_unset(>theaplock);
}
diff --git a/monetdb5/modules/mal/mat.c b/monetdb5/modules/mal/mat.c
--- a/monetdb5/modules/mal/mat.c
+++ b/monetdb5/modules/mal/mat.c
@@ -141,8 +141,9 @@ MATpackIncrement(Client cntxt, MalBlkPtr
throw(MAL, "mat.pack", SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
/* allocate enough space for the vheap, but not for strings,
-* since BATappend does clever things for strings */
-   if ( b->tvheap && bn->tvheap && ATOMstorage(b->ttype) != 
TYPE_str){
+* since BATappend does clever things for strings, and not for
+* vheap views since they may well get shared */
+   if (b->tvheap && b->tvheap->parentid == b->batCacheid && 
bn->tvheap && ATOMstorage(b->ttype) != TYPE_str){
newsize =  b->tvheap->size * pieces;
if (HEAPextend(bn->tvheap, newsize, true) != 
GDK_SUCCEED) {
BBPunfix(b->batCacheid);
diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022
--- a/sql/ChangeLog.Sep2022
+++ b/sql/ChangeLog.Sep2022
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Wed Apr  5 2023 Sjoerd Mullender 
+- When creating a hot snapshot, allow other clients to proceed, even
+  with updating queries.
+
 * Fri Mar 24 2023 Sjoerd Mullender 
 - Increased the size of a variable counting the number of changes made
   to the database (e.g. in case more than a 2 billion rows are added to
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4233,25 +4233,9 @@ SQLsuspend_log_flushing(Client cntxt, Ma
 }
 
 str
-/*SQLhot_snapshot(void *ret, const str *tarfile_arg)*/
+/*SQLhot_snapshot(void *ret, const str *tarfile_arg [, bool onserver ])*/
 SQLhot_snapshot(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
-   char *tarfile = *getArgReference_str(stk, pci, 1);
-   mvc *mvc;
-
-   char *msg = getSQLContext(cntxt, mb, , NULL);
-   if (msg)
-   return msg;
-   lng result = store_hot_snapshot(mvc->session->tr->store, tarfile);
-   if (result)
-   return MAL_SUCCEED;
-   else
-   throw(SQL, "sql.hot_snapshot", GDK_EXCEPTION);
-}
-
-str
-SQLhot_snapshot_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
char *filename;
bool onserver;
char *msg = MAL_SUCCEED;
@@ -4263,7 +4247,7 @@ SQLhot_snapshot_wrap(Client cntxt, MalBl
lng result;
 
filename = *getArgReference_str(stk, pci, 1);
-   onserver = *getArgReference_bit(stk, pci, 2);
+   onserver = pci->argc == 3 ? *getArgReference_bit(stk, pci, 2) : true;
 
msg = getSQLContext(cntxt, mb, , NULL);
if (msg)
@@ -5073,7 +5057,7 @@ static mel_func sql_init_funcs[] = {
  pattern("sql", "hot_snapshot", SQLhot_snapshot, true, "Write db snapshot to 
the given tar(.gz) file", args(1,2, arg("",void),arg("tarfile",str))),
  

MonetDB: default - merged

2023-03-31 Thread Niels Nes
Changeset: e4e0262bd167 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e4e0262bd167
Branch: default
Log Message:

merged


diffs (217 lines):

diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -34,7 +34,6 @@
 
 static struct pipeline {
char *name;
-   const char *status; /* "stable" or "experimental" */
char **def; /* NULL terminated list 
of optimizers */
bool builtin;
 } pipes[MAXOPTPIPES] = {
@@ -45,7 +44,6 @@ static struct pipeline {
  * (see tools/mserver/mserver5.1) accordingly!
  */
{"minimal_pipe",
-"stable",
 (char *[]) {
 "inline",
 "remap",
@@ -55,14 +53,13 @@ static struct pipeline {
 "dict",
 "multiplex",
 "generator",
+"profiler",
 "garbageCollector",
-"profiler",
 NULL,
 },
 true,
},
{"minimal_fast",
-"stable",
 (char *[]) {
 "minimalfast",
 NULL,
@@ -75,7 +72,6 @@ static struct pipeline {
  * tools/mserver/mserver5.1) accordingly!
  */
{"default_pipe",
-"stable",
 (char *[]) {
 "inline",
 "remap",
@@ -105,14 +101,13 @@ static struct pipeline {
 "candidates",
 "deadcode",
 "postfix",
+"profiler",
 "garbageCollector",
-"profiler",
 NULL,
 },
 true,
},
{"default_fast",
-"stable",
 (char *[]) {
 "defaultfast",
 NULL,
@@ -130,7 +125,6 @@ static struct pipeline {
  * (see tools/mserver/mserver5.1) accordingly!
  */
{"no_mitosis_pipe",
-"stable",
 (char *[]) {
 "inline",
 "remap",
@@ -157,8 +151,8 @@ static struct pipeline {
 "candidates",
 "deadcode",
 "postfix",
+"profiler",
 "garbageCollector",
-"profiler",
 NULL,
 },
 true,
@@ -174,7 +168,6 @@ static struct pipeline {
  * (see tools/mserver/mserver5.1) accordingly!
  */
{"sequential_pipe",
-"stable",
 (char *[]) {
 "inline",
 "remap",
@@ -202,8 +195,8 @@ static struct pipeline {
 "candidates",
 "deadcode",
 "postfix",
+"profiler",
 "garbageCollector",
-"profiler",
 NULL,
 },
 true,
@@ -213,7 +206,7 @@ static struct pipeline {
  * settings!
  */
 /* sentinel */
-   {NULL, NULL, NULL, false, },
+   {NULL, NULL, false, },
 };
 
 #include "optimizer_private.h"
@@ -239,6 +232,8 @@ validatePipe(struct pipeline *pipe)
 
for (i = 0; pipe->def[i]; i++) {
const char *fname = pipe->def[i];
+   if (garbage)
+   throw(MAL, "optimizer.validate", SQLSTATE(42000) 
"'garbageCollector' should be used as the last one\n");
if (strcmp(fname, "deadcode") == 0)
deadcode = true;
else if (strcmp(fname, "remap") == 0)
@@ -301,7 +296,6 @@ addPipeDefinition(Client cntxt, const ch
oldpipe = pipes[i];
pipes[i] = (struct pipeline) {
.name = GDKstrdup(name),
-   .status = "experimental",
};
if(pipes[i].name == NULL)
goto bailout;
@@ -413,7 +407,7 @@ getPipeCatalog(bat *nme, bat *def, bat *
}
if (BUNappend(b, pipes[i].name, false) != GDK_SUCCEED ||
BUNappend(bn, buf, false) != GDK_SUCCEED ||
-   BUNappend(bs, pipes[i].status, false) != GDK_SUCCEED) {
+   BUNappend(bs, pipes[i].builtin ? "stable" : 
"experimental", false) != GDK_SUCCEED) {
BBPreclaim(b);
BBPreclaim(bn);
BBPreclaim(bs);
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -157,7 +157,7 @@ static int
return -1;
}
symbackup = c->curprg;
-   memcpy(, be, sizeof(backend)); /* backup current backend */
+   bebackup = *be; /* backup current backend */
backend_reset(be);
 
int nargs;
@@ -289,7 +289,7 @@ cleanup:
else
SQLremoveQueryFromCache(c);
}
-   memcpy(be, , sizeof(backend));
+   *be = bebackup;
c->curprg = symbackup;
return res;
 }
@@ -1103,7 +1103,7 @@ 

MonetDB: default - merged with Sep2022

2023-03-31 Thread Niels Nes
Changeset: 1dc03fb789a0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1dc03fb789a0
Modified Files:
gdk/gdk_logger.c
gdk/gdk_logger_internals.h
gdk/gdk_logger_old.c
sql/backends/monet5/sql_result.c
Branch: default
Log Message:

merged with Sep2022


diffs (truncated from 330 to 300 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -300,12 +300,12 @@ string_reader(logger *lg, BAT *b, lng nr
if (mnstr_readLng(lg->input_log, ) != 1)
return LOG_EOF;
sz = (size_t)SZ;
-   char *buf = lg->buf;
-   if (lg->bufsize < sz) {
-   if (!(buf = GDKrealloc(lg->buf, sz)))
+   char *buf = lg->rbuf;
+   if (lg->rbufsize < sz) {
+   if (!(buf = GDKrealloc(lg->rbuf, sz)))
return LOG_ERR;
-   lg->buf = buf;
-   lg->bufsize = sz;
+   lg->rbuf = buf;
+   lg->rbufsize = sz;
}
 
if (mnstr_read(lg->input_log, buf, sz, 1) != 1)
@@ -399,8 +399,7 @@ log_read_updates(logger *lg, trans *tr, 
}
else
res = LOG_ERR;
-   }
-   else {
+   } else {
assert((*cands)->ttype == 
TYPE_oid);
assert(BATcount(*cands) > 0);
if (BATappend(*cands, dense, 
NULL, true) != GDK_SUCCEED)
@@ -410,8 +409,8 @@ log_read_updates(logger *lg, trans *tr, 
}
 
// We have to read the value to update the read 
cursor
-   size_t tlen = lg->bufsize;
-   void *t = rt(lg->buf, , lg->input_log, 1);
+   size_t tlen = lg->rbufsize;
+   void *t = rt(lg->rbuf, , lg->input_log, 1);
if (t == NULL) {
res = LOG_ERR;
}
@@ -429,13 +428,13 @@ log_read_updates(logger *lg, trans *tr, 
}
 
if (l->flag == LOG_UPDATE_CONST) {
-   size_t tlen = lg->bufsize;
-   void *t = rt(lg->buf, , lg->input_log, 1);
+   size_t tlen = lg->rbufsize;
+   void *t = rt(lg->rbuf, , lg->input_log, 1);
if (t == NULL) {
res = LOG_ERR;
} else {
-   lg->buf = t;
-   lg->bufsize = tlen;
+   lg->rbuf = t;
+   lg->rbufsize = tlen;
for(BUN p = 0; p<(BUN) nr; p++) {
if (r && BUNappend(r, t, true) != 
GDK_SUCCEED)
res = LOG_ERR;
@@ -454,32 +453,32 @@ log_read_updates(logger *lg, trans *tr, 
else
res = LOG_ERR;
} else {
-   size_t tlen = lg->bufsize/sizeof(int);
+   size_t tlen = lg->rbufsize/sizeof(int);
size_t cnt = 0, snr = (size_t)nr;
snr = (snr+31)/32;
assert(tlen);
for (; res == LOG_OK && snr > 0; 
snr-=cnt) {
cnt = snr>tlen?tlen:snr;
-   if 
(!mnstr_readIntArray(lg->input_log, lg->buf, cnt))
+   if 
(!mnstr_readIntArray(lg->input_log, lg->rbuf, cnt))
res = LOG_ERR;
}
}
} else {
if (!ATOMvarsized(tpe)) {
size_t cnt = 0, snr = (size_t)nr;
-   size_t tlen = 
lg->bufsize/ATOMsize(tpe), ntlen = lg->bufsize;
+   size_t tlen = 
lg->rbufsize/ATOMsize(tpe), ntlen = lg->rbufsize;
assert(tlen);
/* read in chunks of max
 * BUFSIZE/width rows */
   

MonetDB: default - merged

2023-03-31 Thread Niels Nes
Changeset: f3e04e450e6e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f3e04e450e6e
Modified Files:
gdk/gdk_logger.c
gdk/gdk_logger_internals.h
Branch: default
Log Message:

merged


diffs (24 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1074,8 +1074,6 @@ log_open_output(logger *lg)
GDKfree(filename);
}
new_range->id = lg->id;
-   new_range->first_tid = lg->tid;
-   new_range->last_tid = lg->tid;
new_range->last_ts = 0;
new_range->next = NULL;
if (lg->current)
diff --git a/gdk/gdk_logger_internals.h b/gdk/gdk_logger_internals.h
--- a/gdk/gdk_logger_internals.h
+++ b/gdk/gdk_logger_internals.h
@@ -15,8 +15,6 @@
 
 typedef struct logged_range_t {
ulng id;/* log file id */
-   int first_tid;  /* first */
-   int last_tid;   /* last tid */
ulng last_ts;   /* last stored timestamp */
struct logged_range_t *next;
 } logged_range;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2023-03-28 Thread Niels Nes
Changeset: 699b18e827e4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/699b18e827e4
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal.c
monetdb5/mal/mal_authorize.c
monetdb5/mal/mal_client.c
monetdb5/mal/mal_dataflow.c
monetdb5/mal/mal_embedded.c
monetdb5/mal/mal_import.c
monetdb5/mal/mal_internal.h
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_interpreter.h
monetdb5/mal/mal_private.h
monetdb5/mal/mal_session.c
monetdb5/modules/mal/tablet.c
sql/backends/monet5/sql.c
sql/server/rel_schema.c
sql/server/sql_mvc.c
Branch: default
Log Message:

merged with Sep2022


diffs (truncated from 407 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
@@ -945,7 +945,6 @@ int getBitConstant(MalBlkPtr mb, bit val
 int getBlockBegin(MalBlkPtr mb, int pc);
 int getBlockExit(MalBlkPtr mb, int pc);
 int getBteConstant(MalBlkPtr mb, bte val);
-Client getClientContext(void);
 int getDblConstant(MalBlkPtr mb, dbl val);
 str getExceptionMessage(const char *);
 str getExceptionMessageAndState(const char *);
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -43,93 +43,6 @@ MT_Lock mal_copyLock = MT_LOCK_INITI
 MT_Lock mal_delayLock = MT_LOCK_INITIALIZER(mal_delayLock);
 
 
-
-#ifdef HAVE_PTHREAD_H
-
-static pthread_key_t tl_client_key;
-
-static int
-initialize_tl_client_key(void)
-{
-   static bool initialized = false;
-   if (initialized)
-   return 0;
-
-   if (pthread_key_create(_client_key, NULL) != 0)
-   return -1;
-
-   initialized = true;
-   return 0;
-}
-
-/* declared in mal_interpreter.h so MAL operators can access it */
-Client
-getClientContext(void)
-{
-   if (initialize_tl_client_key())
-   return NULL;
-   return (Client) pthread_getspecific(tl_client_key);
-}
-
-/* declared in mal_private.h so only the MAL interpreter core can access it */
-Client
-setClientContext(Client cntxt)
-{
-   Client old = getClientContext();
-
-   if (pthread_setspecific(tl_client_key, cntxt) != 0)
-   GDKfatal("Failed to set thread local Client context");
-
-   return old;
-}
-
-#elif defined(WIN32)
-
-static DWORD tl_client_key = 0;
-
-static int
-initialize_tl_client_key(void)
-{
-   static bool initialized = false;
-   if (initialized)
-   return 0;
-
-   DWORD key = TlsAlloc();
-   if (key == TLS_OUT_OF_INDEXES)
-   return -1;
-
-   tl_client_key = key;
-   initialized = true;
-   return 0;
-}
-
-/* declared in mal_interpreter.h so MAL operators can access it */
-Client
-getClientContext(void)
-{
-   if (initialize_tl_client_key())
-   return NULL;
-   return (Client) TlsGetValue(tl_client_key);
-}
-
-/* declared in mal_private.h so only the MAL interpreter core can access it */
-Client
-setClientContext(Client cntxt)
-{
-   Client old = getClientContext();
-
-   if (TlsSetValue(tl_client_key, cntxt) == 0)
-   GDKfatal("Failed to set thread local Client context");
-
-   return old;
-}
-
-#else
-
-#error "no pthreads and no Win32, don't know what to do"
-
-#endif
-
 const char *
 mal_version(void)
 {
@@ -160,9 +73,6 @@ mal_init(char *modules[], bool embedded,
return -1;
}
 
-   if (initialize_tl_client_key() != 0)
-   return -1;
-
if (!MCinit())
return -1;
 #ifndef NDEBUG
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -292,9 +292,6 @@ MCinitClient(oid user, bstream *fin, str
MT_lock_set(_contextLock);
c = MCnewClient();
if (c) {
-   Client c_old = setClientContext(c);
-   (void) c_old;
-   assert(NULL == c_old);
c = MCinitClientRecord(c, user, fin, fout);
MT_thread_set_qry_ctx(>qryctx);
}
@@ -428,7 +425,6 @@ MCcloseClient(Client c)
c->sqlprofiler = 0;
free(c->handshake_options);
c->handshake_options = NULL;
-   setClientContext(NULL);
MT_thread_set_qry_ctx(NULL);
assert(c->qryctx.datasize == 0);
MT_sema_destroy(>s);
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -314,7 +314,6 @@ DFLOWworker(void *T)
cntxt = ATOMIC_PTR_GET(>cntxt);
while (1) {
MT_thread_set_qry_ctx(NULL);
-   setClientContext(NULL);
if (fnxt == 0) {
MT_thread_setworking(NULL);
cntxt = 

MonetDB: default - merged

2023-03-27 Thread Niels Nes
Changeset: 47f51e9ebeae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/47f51e9ebeae
Branch: default
Log Message:

merged


diffs (truncated from 398 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
@@ -756,8 +756,7 @@ void MCcloseClient(Client c);
 Client MCforkClient(Client father);
 Client MCgetClient(int id);
 Client MCinitClient(oid user, bstream *fin, stream *fout);
-size_t MCmemoryClaim(void);
-int MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt);
+int MCpushClientInput(Client c, bstream *new_input, int listing, const char 
*prompt);
 void MCstopClients(Client c);
 str MCsuspendClient(int id);
 int MCvalid(Client c);
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -88,11 +88,11 @@ MCinit(void)
 
MAL_MAXCLIENTS = /* client connections */ maxclients;
mal_clients = GDKzalloc(sizeof(ClientRec) * MAL_MAXCLIENTS);
-   if( mal_clients == NULL){
+   if (mal_clients == NULL) {
TRC_CRITICAL(MAL_SERVER, "Initialization failed: " 
MAL_MALLOC_FAIL "\n");
return false;
}
-   for (int i = 0; i < MAL_MAXCLIENTS; i++){
+   for (int i = 0; i < MAL_MAXCLIENTS; i++) {
ATOMIC_INIT(_clients[i].lastprint, 0);
ATOMIC_INIT(_clients[i].workers, 1);
ATOMIC_INIT(_clients[i].qryctx.datasize, 0);
@@ -103,7 +103,7 @@ MCinit(void)
 
 /* stack the files from which you read */
 int
-MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt)
+MCpushClientInput(Client c, bstream *new_input, int listing, const char 
*prompt)
 {
ClientInput *x = (ClientInput *) GDKmalloc(sizeof(ClientInput));
if (x == 0)
@@ -116,11 +116,7 @@ MCpushClientInput(Client c, bstream *new
c->bak = x;
c->fdin = new_input;
c->listing = listing;
-   c->prompt = prompt ? GDKstrdup(prompt) : GDKstrdup("");
-   if(c->prompt == 0) {
-   GDKfree(x);
-   return -1;
-   }
+   c->prompt = prompt ? prompt : "";
c->promptlength = strlen(c->prompt);
c->yycur = 0;
return 0;
@@ -134,7 +130,6 @@ MCpopClientInput(Client c)
/* missing protection against closing stdin stream */
bstream_destroy(c->fdin);
}
-   GDKfree(c->prompt);
c->fdin = x->fdin;
c->yycur = x->yycur;
c->listing = x->listing;
@@ -147,20 +142,16 @@ MCpopClientInput(Client c)
 static Client
 MCnewClient(void)
 {
-   Client c;
-
-   for (c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
-   if (c->idx == -1)
-   break;
+   for (Client c = mal_clients; c < mal_clients + MAL_MAXCLIENTS; c++) {
+   if (c->idx == -1) {
+   assert(c->mode == FREECLIENT);
+   c->mode = RUNCLIENT;
+   c->idx = (int) (c - mal_clients);
+   return c;
+   }
}
 
-   if (c == mal_clients + MAL_MAXCLIENTS)
-   return NULL;
-
-   assert(c->mode == FREECLIENT);
-   c->mode = RUNCLIENT;
-   c->idx = (int) (c - mal_clients);
-   return c;
+   return NULL;
 }
 
 /*
@@ -204,7 +195,7 @@ MCexitClient(Client c)
 {
MCresetProfiler(c->fdout);
// Remove any left over constant symbols
-   if( c->curprg)
+   if (c->curprg)
resetMalBlk(c->curprg->def);
if (c->father == NULL) { /* normal client */
if (c->fdout && c->fdout != GDKstdout)
@@ -220,7 +211,7 @@ MCexitClient(Client c)
c->fdin = NULL;
}
assert(c->query == NULL);
-   if(profilerStatus > 0) {
+   if (profilerStatus > 0) {
lng Tend = GDKusec();
profilerEvent(NULL,
  &(struct NonMalEvent)
@@ -231,8 +222,6 @@ MCexitClient(Client c)
 static Client
 MCinitClientRecord(Client c, oid user, bstream *fin, stream *fout)
 {
-   const char *prompt;
-
/* mal_contextLock is held when this is called */
c->user = user;
c->username = 0;
@@ -242,7 +231,7 @@ MCinitClientRecord(Client c, oid user, b
c->blkmode = 0;
 
c->fdin = fin ? fin : bstream_create(GDKstdin, 0);
-   if ( c->fdin == NULL){
+   if (c->fdin == NULL) {
c->mode = FREECLIENT;
c->idx = -1;
TRC_ERROR(MAL_SERVER, "No stdin channel available\n");
@@ -276,18 +265,8 @@ MCinitClientRecord(Client c, oid user, b
c->itrace = 0;
c->errbuf = 0;
 
-   prompt = PROMPT1;
-   c->prompt = GDKstrdup(prompt);
-   if ( c->prompt == NULL){
-   if (fin == NULL) {
-   c->fdin->s = NULL;
-   

MonetDB: default - merged with sep2022

2023-03-27 Thread Niels Nes
Changeset: 938b2efff127 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/938b2efff127
Modified Files:
gdk/gdk_aggr.c
sql/server/rel_select.c
Branch: default
Log Message:

merged with sep2022


diffs (12 lines):

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
@@ -972,7 +972,7 @@ table_ref(sql_query *query, symbol *tabl
}
}
if (temp_table && tableref->data.lval->t->type == 
type_symbol && tableref->data.lval->t->data.sym && 
tableref->data.lval->t->data.sym->data.lval->h->next->data.lval) /* AS with 
column aliases */
-   temp_table = rel_table_optname(sql, temp_table, 
tableref->data.lval->h->next->data.sym, refs);
+   temp_table = rel_table_optname(sql, temp_table, 
tableref->data.lval->t->data.sym, refs);
if (allowed)
return temp_table;
return sql_error(sql, 02, SQLSTATE(42000) "SELECT: 
access denied for %s to table '%s'", get_string_global_var(sql, 
"current_user"), tname);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2023-03-27 Thread Niels Nes
Changeset: bf20d7edd89f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bf20d7edd89f
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

merged with Sep2022


diffs (12 lines):

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
@@ -971,6 +971,8 @@ table_ref(sql_query *query, symbol *tabl
list_hash_clear(exps);
}
}
+   if (temp_table && tableref->data.lval->t->type == 
type_symbol && tableref->data.lval->t->data.sym && 
tableref->data.lval->t->data.sym->data.lval->h->next->data.lval) /* AS with 
column aliases */
+   temp_table = rel_table_optname(sql, temp_table, 
tableref->data.lval->h->next->data.sym, refs);
if (allowed)
return temp_table;
return sql_error(sql, 02, SQLSTATE(42000) "SELECT: 
access denied for %s to table '%s'", get_string_global_var(sql, 
"current_user"), tname);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2023-03-27 Thread Niels Nes
Changeset: 75fd97b8ffe5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/75fd97b8ffe5
Modified Files:
sql/server/rel_select.c
Branch: default
Log Message:

merged with Sep2022


diffs (13 lines):

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
@@ -968,9 +968,6 @@ table_ref(sql_query *query, symbol *tabl
noninternexp_setname(sql->sa, 
e, tname, NULL);
set_basecol(e);
}
-   if 
(tableref->data.lval->h->next->data.sym && 
tableref->data.lval->h->next->data.sym->data.lval->h->next->data.lval) { /* AS 
with column aliases */
-   temp_table = 
rel_table_optname(sql, temp_table, tableref->data.lval->h->next->data.sym, 
refs);
-   }
list_hash_clear(exps);
}
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2023-03-21 Thread Niels Nes
Changeset: 56baf8b63039 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/56baf8b63039
Branch: default
Log Message:

merged


diffs (288 lines):

diff --git a/monetdb5/optimizer/CMakeLists.txt 
b/monetdb5/optimizer/CMakeLists.txt
--- a/monetdb5/optimizer/CMakeLists.txt
+++ b/monetdb5/optimizer/CMakeLists.txt
@@ -45,7 +45,6 @@ target_sources(optimizer
   opt_pushselect.c opt_pushselect.h
   opt_profiler.c opt_profiler.h
   opt_postfix.c opt_postfix.h
-  opt_volcano.c opt_volcano.h
   opt_fastpath.c opt_fastpath.h
   opt_wrapper.c
   PUBLIC
diff --git a/monetdb5/optimizer/opt_fastpath.c 
b/monetdb5/optimizer/opt_fastpath.c
--- a/monetdb5/optimizer/opt_fastpath.c
+++ b/monetdb5/optimizer/opt_fastpath.c
@@ -38,7 +38,6 @@
 #include "opt_remap.h"
 #include "opt_remoteQueries.h"
 #include "opt_reorder.h"
-#include "opt_volcano.h"
 #include "opt_fastpath.h"
 #include "optimizer_private.h"
 #include "mal_interpreter.h"
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -105,43 +105,6 @@ static struct PIPELINES {
{"default_fast",
 "optimizer.defaultfast()",
 "stable", NULL, 1},
-/* Apr2022 update. I disabled the volcano_pipe because it has issues on it */
-#if 0
-/*
- * Volcano style execution produces a sequence of blocks from the source 
relation
- */
-   {"volcano_pipe",
-"optimizer.inline();"
-"optimizer.remap();"
-"optimizer.costModel();"
-"optimizer.coercions();"
-"optimizer.aliases();"
-"optimizer.evaluate();"
-"optimizer.emptybind();"
-"optimizer.deadcode();" /* Feb2021 update, I pushed deadcode optimizer 
earlier in the pipeline so it runs before mitosis, thus removing less 
instructions */
-"optimizer.pushselect();"
-"optimizer.aliases();"
-"optimizer.mitosis();"
-"optimizer.mergetable();"
-"optimizer.aliases();"
-"optimizer.constants();"
-"optimizer.commonTerms();"
-"optimizer.projectionpath();"
-"optimizer.deadcode();"
-"optimizer.matpack();"
-"optimizer.reorder();"
-"optimizer.dataflow();"
-"optimizer.querylog();"
-"optimizer.multiplex();"
-"optimizer.generator();"
-"optimizer.volcano();"
-"optimizer.candidates();"
-"optimizer.deadcode();"
-"optimizer.postfix();"
-"optimizer.garbageCollector();"
-"optimizer.profiler();",
-"stable", NULL, 1},
-#endif
 /* The no_mitosis pipe line is (and should be kept!) identical to the
  * default pipeline, except that optimizer mitosis is omitted.  It is
  * used mainly to make some tests work deterministically, and to check
diff --git a/monetdb5/optimizer/opt_volcano.c b/monetdb5/optimizer/opt_volcano.c
deleted file mode 100644
--- a/monetdb5/optimizer/opt_volcano.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * SPDX-License-Identifier: MPL-2.0
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0.  If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V.
- */
-
-/*
- * Selectively inject serialization operations when we know the
- * raw footprint of the query exceeds 80% of RAM.
- */
-
-#include "monetdb_config.h"
-#include "mal_instruction.h"
-#include "opt_volcano.h"
-
-// delaying the startup should not be continued throughout the plan
-// after the startup phase there should be intermediate work to do
-//A heuristic to check it
-#define MAXdelays 128
-
-str
-OPTvolcanoImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
-{
-   int i, limit, actions = 0;
-   int mvcvar = -1;
-   int count=0;
-   InstrPtr p,q, *old = NULL;
-   str msg = MAL_SUCCEED;
-
-   (void) cntxt;
-   (void) stk; /* to fool compilers */
-
-   if ( mb->inlineProp )
-   goto wrapup;
-
-   old = mb->stmt;
-   limit= mb->stop;
-   if ( newMalBlkStmt(mb, mb->ssize + 20) < 0)
-   throw(MAL,"optimizer.volcano", SQLSTATE(HY013) MAL_MALLOC_FAIL);
-
-   actions = 1;
-   for (i = 0; i < limit; i++) {
-   p = old[i];
-
-   pushInstruction(mb,p);
-   if( getModuleId(p) == sqlRef && getFunctionId(p)== mvcRef ){
-   mvcvar = getArg(p,0);
-   continue;
-   }
-
-   if( count < MAXdelays && getModuleId(p) == algebraRef ){
-   if( getFunctionId(p) == selectRef ||
-   getFunctionId(p) == thetaselectRef ||
-   getFunctionId(p) == likeselectRef ||
-   getFunctionId(p) == joinRef
-   ){
-   q= newInstruction(0,languageRef,blockRef);

MonetDB: default - merged

2023-03-20 Thread Niels Nes
Changeset: eb7052ece4d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/eb7052ece4d8
Branch: default
Log Message:

merged


diffs (truncated from 2141 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -46769,11 +46769,6 @@ pattern json.renderobject(X_0:any...):js
 JSONrenderobject;
 (empty)
 json
-resultSet
-command json.resultSet(X_0:bat[:uuid], X_1:bat[:lng], X_2:bat[:json]):json 
-JSONresultSet;
-Converts the json store into a single json string:
-json
 str
 command json.str(X_0:json):str 
 JSONjson2str;
@@ -48274,26 +48269,6 @@ pattern optimizer.inline(X_0:str, X_1:st
 OPTwrapper;
 Expand inline functions
 optimizer
-jit
-pattern optimizer.jit():str 
-OPTwrapper;
-(empty)
-optimizer
-jit
-pattern optimizer.jit(X_0:str, X_1:str):str 
-OPTwrapper;
-Propagate candidate lists in just-in-time optimization
-optimizer
-json
-pattern optimizer.json():str 
-OPTwrapper;
-(empty)
-optimizer
-json
-pattern optimizer.json(X_0:str, X_1:str):str 
-OPTwrapper;
-Unroll the mat.pack operation
-optimizer
 macro
 pattern optimizer.macro(X_0:str, X_1:str):void 
 OPTmacro;
@@ -48304,16 +48279,6 @@ pattern optimizer.macro(X_0:str, X_1:str
 OPTmacro;
 Inline a target function used in a specific function.
 optimizer
-mask
-pattern optimizer.mask():str 
-OPTwrapper;
-(empty)
-optimizer
-mask
-pattern optimizer.mask(X_0:str, X_1:str):str 
-OPTwrapper;
-Manipulate the MSK objects
-optimizer
 matpack
 pattern optimizer.matpack():str 
 OPTwrapper;
@@ -49734,21 +49699,21 @@ unsafe pattern sql.setVariable(X_0:int, 
 setVariable;
 Set the value of a session variable
 sql
-sql
 set_count_distinct
-unsafe pattern sql.set_count_distinct(X_0:str, X_1:str, X_2:str, X_3:lng):void
+unsafe pattern sql.set_count_distinct(X_0:str, X_1:str, X_2:str, X_3:lng):void 
 sql_set_count_distinct;
 Set count distinct for column
 sql
 set_max
-unsafe pattern sql.set_max(X_0:str, X_1:str, X_2:str, X_3:any_1):void
+unsafe pattern sql.set_max(X_0:str, X_1:str, X_2:str, X_3:any_1):void 
 sql_set_max;
 Set max for column
 sql
 set_min
-unsafe pattern sql.set_min(X_0:str, X_1:str, X_2:str, X_3:any_1):void
+unsafe pattern sql.set_min(X_0:str, X_1:str, X_2:str, X_3:any_1):void 
 sql_set_min;
 Set min for column
+sql
 set_protocol
 unsafe pattern sql.set_protocol(X_0:int):int 
 SQLset_protocol;
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
@@ -35204,11 +35204,6 @@ pattern json.renderobject(X_0:any...):js
 JSONrenderobject;
 (empty)
 json
-resultSet
-command json.resultSet(X_0:bat[:uuid], X_1:bat[:lng], X_2:bat[:json]):json 
-JSONresultSet;
-Converts the json store into a single json string:
-json
 str
 command json.str(X_0:json):str 
 JSONjson2str;
@@ -36704,26 +36699,6 @@ pattern optimizer.inline(X_0:str, X_1:st
 OPTwrapper;
 Expand inline functions
 optimizer
-jit
-pattern optimizer.jit():str 
-OPTwrapper;
-(empty)
-optimizer
-jit
-pattern optimizer.jit(X_0:str, X_1:str):str 
-OPTwrapper;
-Propagate candidate lists in just-in-time optimization
-optimizer
-json
-pattern optimizer.json():str 
-OPTwrapper;
-(empty)
-optimizer
-json
-pattern optimizer.json(X_0:str, X_1:str):str 
-OPTwrapper;
-Unroll the mat.pack operation
-optimizer
 macro
 pattern optimizer.macro(X_0:str, X_1:str):void 
 OPTmacro;
@@ -36734,16 +36709,6 @@ pattern optimizer.macro(X_0:str, X_1:str
 OPTmacro;
 Inline a target function used in a specific function.
 optimizer
-mask
-pattern optimizer.mask():str 
-OPTwrapper;
-(empty)
-optimizer
-mask
-pattern optimizer.mask(X_0:str, X_1:str):str 
-OPTwrapper;
-Manipulate the MSK objects
-optimizer
 matpack
 pattern optimizer.matpack():str 
 OPTwrapper;
@@ -38115,17 +38080,17 @@ setVariable;
 Set the value of a session variable
 sql
 set_count_distinct
-unsafe pattern sql.set_count_distinct(X_0:str, X_1:str, X_2:str, X_3:lng):void
+unsafe pattern sql.set_count_distinct(X_0:str, X_1:str, X_2:str, X_3:lng):void 
 sql_set_count_distinct;
 Set count distinct for column
 sql
 set_max
-unsafe pattern sql.set_max(X_0:str, X_1:str, X_2:str, X_3:any_1):void
+unsafe pattern sql.set_max(X_0:str, X_1:str, X_2:str, X_3:any_1):void 
 sql_set_max;
 Set max for column
 sql
 set_min
-unsafe pattern sql.set_min(X_0:str, X_1:str, X_2:str, X_3:any_1):void
+unsafe pattern sql.set_min(X_0:str, X_1:str, X_2:str, X_3:any_1):void 
 sql_set_min;
 Set min for column
 sql
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
@@ -4,6 +4,7 @@ int ATOMallocate(const char *nme);
 void *ATOMdup(int id, const void *val);
 uint8_t ATOMelmshift(int sz) __attribute__((__const__));
 char *ATOMformat(int id, const void *val);
+gdk_return ATOMheap(int id, Heap *hp, size_t cap) 
__attribute__((__warn_unused_result__));
 

MonetDB: default - merged with sep2022

2023-03-19 Thread Niels Nes
Changeset: 1720d839521d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1720d839521d
Modified Files:
gdk/gdk_join.c
gdk/gdk_private.h
gdk/gdk_select.c
sql/include/sql_catalog.h
Branch: default
Log Message:

merged with sep2022


diffs (266 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3304,8 +3304,8 @@ BATguess_uniques(BAT *b, struct canditer
 /* estimate the cost of doing a hashjoin with a hash on r; return value
  * is the estimated cost, the last three arguments receive some extra
  * information */
-static double
-joincost(BAT *r, struct canditer *lci, struct canditer *rci,
+double
+joincost(BAT *r, BUN lcount, struct canditer *rci,
 bool *hash, bool *phash, bool *cand)
 {
bool rhash;
@@ -3331,7 +3331,7 @@ joincost(BAT *r, struct canditer *lci, s
 * candidate types is essentially free */
rcost += log2((double) rci->nvals);
}
-   rcost *= lci->ncand;
+   rcost *= lcount;
if (BATtdense(r)) {
/* no need for a hash, and lookup is free */
rhash = false;  /* don't use it, even if it's there */
@@ -3376,38 +3376,41 @@ joincost(BAT *r, struct canditer *lci, s
 #endif
}
}
-   if (rci->ncand != BATcount(r) && rci->tpe != cand_mask) {
-   /* instead of using the hash on r (cost in rcost), we
-* can build a new hash on r taking the candidate list
-* into account; don't do this for masked candidate
-* since the searching of the candidate list
-* (canditer_idx) will kill us */
-   double rccost;
-   if (rhash && !prhash) {
-   rccost = (double) cnt / nheads;
-   } else {
-   MT_lock_set(>theaplock);
-   double unique_est = r->tunique_est;
-   MT_lock_unset(>theaplock);
-   if (unique_est == 0) {
-   unique_est = guess_uniques(r, rci);
-   if (unique_est < 0)
-   return -1;
+   if (cand) {
+   if (rci->ncand != BATcount(r) && rci->tpe != cand_mask) {
+   /* instead of using the hash on r (cost in
+* rcost), we can build a new hash on r taking
+* the candidate list into account; don't do
+* this for masked candidate since the searching
+* of the candidate list (canditer_idx) will
+* kill us */
+   double rccost;
+   if (rhash && !prhash) {
+   rccost = (double) cnt / nheads;
+   } else {
+   MT_lock_set(>theaplock);
+   double unique_est = r->tunique_est;
+   MT_lock_unset(>theaplock);
+   if (unique_est == 0) {
+   unique_est = guess_uniques(r, rci);
+   if (unique_est < 0)
+   return -1;
+   }
+   /* we have an estimate of the number of unique
+* values, assume some chains */
+   rccost = 1.1 * ((double) cnt / unique_est);
}
-   /* we have an estimate of the number of unique
-* values, assume some chains */
-   rccost = 1.1 * ((double) cnt / unique_est);
+   rccost *= lcount;
+   rccost += rci->ncand * 2.0; /* cost of building the 
hash */
+   if (rccost < rcost) {
+   rcost = rccost;
+   rcand = true;
+   }
}
-   rccost *= lci->ncand;
-   rccost += rci->ncand * 2.0; /* cost of building the hash */
-   if (rccost < rcost) {
-   rcost = rccost;
-   rcand = true;
-   }
+   *cand = rcand;
}
*hash = rhash;
*phash = prhash;
-   *cand = rcand;
return rcost;
 }
 
@@ -3913,7 +3916,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
goto doreturn;
}
}
-   rcost = joincost(r, , , , , );
+   rcost = joincost(r, lci.ncand, , , , );
if (rcost < 0) {
rc = GDK_FAIL;
goto doreturn;
@@ -3926,7 +3929,7 @@ leftjoin(BAT **r1p, BAT **r2p, BAT *l, B
bool lhash, plhash, lcand;
double lcost;
 
-   lcost = joincost(l, , , , , );
+  

MonetDB: default - merged with Sep2022

2023-03-11 Thread Niels Nes
Changeset: 444fdeb873a7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/444fdeb873a7
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/gdk_bbp.c
gdk/libbat.rc
monetdb5/mal/mal_interpreter.c
monetdb5/mal/mal_session.c
monetdb5/optimizer/opt_pushselect.c
monetdb5/tools/libmonetdb5.rc
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
sql/test/prepare/Tests/sqlancer_prepare.stable.out
sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
Branch: default
Log Message:

merged with Sep2022


diffs (truncated from 642 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -787,6 +787,7 @@ 44e45c9a451f6afd933773094ec25723f713d3be
 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_SP5_release
 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_25
 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_SP6_release
+700e099bfee85318da09aabcd78ec7ea6e8fb6ef Jul2021_29
 5c50a4071c86d1621e20a885a51cc36f2f23eec4 Sep2022_9
 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_11
 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_SP1_release
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -548,12 +548,19 @@ runMALsequence(Client cntxt, MalBlkPtr m
}
 
if (stk->status) {
-   while (stk->status == 'p')
-   MT_sleep_ms(50);
-   continue;
+   /* pause procedure from SYSMON */
+   if (stk->status == 'p') {
+   while (stk->status == 'p')
+   MT_sleep_ms(50);
+   continue;
+   }
+   /* stop procedure from SYSMON */
if (stk->status == 'q') {
stkpc = mb->stop;
-   ret = createException(MAL, "mal.interpreter", 
"Prematurely stopped client");
+   ret = createException(MAL, "mal.interpreter",
+ 
"Query with tag "OIDFMT" received stop signal",
+ 
mb->tag);
+   break;
}
}
 
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -368,7 +368,7 @@ MSscheduleClient(str command, str challe
mnstr_printf(c->fdout, "!%s\n", s);
mnstr_flush(c->fdout, MNSTR_FLUSH_DATA);
GDKfree(s);
-   c->mode = FINISHCLIENT;
+   MCcloseClient(c);
}
if (!GDKgetenv_isyes(mal_enableflag) &&
(strncasecmp("sql", lang, 3) != 0 && uid != 0)) 
{
diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -869,7 +869,11 @@ OPTpushselectImplementation(Client cntxt
getArg(u, 3) = getArg(q,2); /* update ids */
//getArg(u, 4) = getArg(s,0);
p = pushArgument(mb, u, getArg(s,0)); /* push 
at end */
+   /* make sure to resolve again */
+   u->token = ASSIGNsymbol;
u->typechk = TYPE_UNKNOWN;
+   u->fcn = NULL;
+   u->blk = NULL;
pushInstruction(mb,u);
oclean[i] = true;
continue;
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -336,8 +336,9 @@ static int
sqlid table_id = prp->id;
node *n;
int i, q, v, res = 0, added_to_cache = 0,  *lret, *rret;
-   size_t len = 1024, nr;
-   char *lname, *buf;
+   size_t len = 1024, nr, pwlen = 0;
+   char *lname = NULL, *buf = NULL, *mal_session_uuid, *err = NULL, 
*pwhash = NULL;
+   str username = NULL, password = NULL, msg = NULL;
sql_rel *r = rel;
 
if (table_id == 0) {
@@ -387,17 +388,25 @@ static int
if( c->curprg == NULL) {
GDKfree(lname);
sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   c->curprg = backup;
return -1;
}
lname[0] 

MonetDB: default - merged with sep2022

2023-03-09 Thread Niels Nes
Changeset: a0104be272e6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a0104be272e6
Modified Files:
clients/mapiclient/mclient.c
monetdb5/mal/mal_interpreter.c
Branch: default
Log Message:

merged with sep2022


diffs (60 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3578,7 +3578,6 @@ main(int argc, char **argv)
} else {
if (mode == SQL) {
setFormatter("sql");
-   mapi_set_size_header(mid, false);
} else {
setFormatter("raw");
mapi_set_size_header(mid, true);
diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -546,17 +546,19 @@ runMALsequence(Client cntxt, MalBlkPtr m
ret= createException(MAL, "mal.interpreter", 
"prematurely stopped client");
break;
}
+
+   if (stk->status) {
+   while (stk->status == 'p')
+   MT_sleep_ms(50);
+   continue;
+   if (stk->status == 'q') {
+   stkpc = mb->stop;
+   ret = createException(MAL, "mal.interpreter", 
"Prematurely stopped client");
+   }
+   }
+
 #ifndef NDEBUG
-   if (cntxt->itrace || stk->status) {
-   if (stk->status == 'p'){
-   // execution is paused
-   while (stk->status == 'p')
-   MT_sleep_ms(50);
-   continue;
-   }
-   if (stk->status == 'q')
-   stk->cmd = 'x';
-
+   if (cntxt->itrace) {
if (stk->cmd == 0)
stk->cmd = cntxt->itrace;
mdbStep(cntxt, mb, stk, stkpc);
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -3805,10 +3805,11 @@ def main(argv) :
 # fix up URLPREFIX
 if REV:
 URLPREFIX += '%s/' % REV.split()[0].rstrip('+')
-os.environ['REVISION'] = REV
 else:
 # if no revision known, can't refer to repository
 URLPREFIX = None
+if REV:
+os.environ['REVISION'] = REV
 
 global SOCK, HOST
 try:# try/finally to clean up sockdir
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2023-03-05 Thread Niels Nes
Changeset: 8f7ff330e13e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8f7ff330e13e
Modified Files:
testing/sqllogictest.py
Branch: default
Log Message:

merged with Sep2022


diffs (26 lines):

diff --git a/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test 
b/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
--- a/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
+++ b/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
@@ -1,8 +1,8 @@
-skipif arch=arm64
+skipif arch=aarch64
 statement error 22003!overflow in conversion of 9.2233720368547758e+18 to lng.
 select cast(power(2,63) as bigint) 
 
-onlyif arch=arm64
+onlyif arch=aarch64
 query I
 select cast(power(2,63) as bigint) 
 
diff --git a/testing/sqllogictest.py b/testing/sqllogictest.py
--- a/testing/sqllogictest.py
+++ b/testing/sqllogictest.py
@@ -44,6 +44,8 @@ from typing import Optional
 architecture = platform.machine()
 if architecture == 'AMD64': # Windows :-(
 architecture = 'x86_64'
+if architecture == 'arm64': # MacOS :-(
+architecture = 'aarch64'
 
 skipidx = re.compile(r'create index .* \b(asc|desc)\b', re.I)
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with sep2022

2023-03-04 Thread Niels Nes
Changeset: 8c1fe0bf1800 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8c1fe0bf1800
Branch: default
Log Message:

merged with sep2022


diffs (14 lines):

diff --git a/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test 
b/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
--- a/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
+++ b/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
@@ -1,8 +1,8 @@
-skipif arch=aarch64
+skipif arch=arm64
 statement error 22003!overflow in conversion of 9.2233720368547758e+18 to lng.
 select cast(power(2,63) as bigint) 
 
-onlyif arch=aarch64
+onlyif arch=arm64
 query I
 select cast(power(2,63) as bigint) 
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2023-03-04 Thread Niels Nes
Changeset: 46efc52a7f35 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/46efc52a7f35
Modified Files:
testing/sqllogictest.py
Branch: default
Log Message:

merged

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with sep2022

2023-03-04 Thread Niels Nes
Changeset: bbd80e082a3f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bbd80e082a3f
Modified Files:
testing/sqllogictest.py
Branch: default
Log Message:

merged with sep2022


diffs (truncated from 1800 to 300 lines):

diff --git a/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test 
b/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
--- a/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
+++ b/sql/test/BugTracker-2009/Tests/overflow.SF-2853458.test
@@ -1,6 +1,13 @@
+skipif arch=aarch64
 statement error 22003!overflow in conversion of 9.2233720368547758e+18 to lng.
 select cast(power(2,63) as bigint) 
 
+onlyif arch=aarch64
+query I
+select cast(power(2,63) as bigint) 
+
+9223372036854775807
+
 statement error 22003!overflow in conversion of 1.8446744073709552e+19 to lng.
 select cast(power(2,64) as bigint)
 
diff --git a/sql/test/Users/Tests/table_privs.test 
b/sql/test/Users/Tests/table_privs.test
--- a/sql/test/Users/Tests/table_privs.test
+++ b/sql/test/Users/Tests/table_privs.test
@@ -1,32 +1,24 @@
-@connection(id=mdb, username=monetdb, password=monetdb)
 statement ok
 CREATE USER my_user with password 'p1' name 'User with role' schema sys
 
-@connection(id=mdb)
 statement ok
 CREATE USER my_user2 with password 'p2' name 'User without role' schema sys
 
-@connection(id=mdb)
 statement ok
 CREATE SCHEMA my_schema
 
-@connection(id=mdb)
 statement ok
 CREATE table my_schema.test (i int, b bigint)
 
-@connection(id=mdb)
 statement ok
 GRANT SELECT on table my_schema.test to my_user
 
-@connection(id=mdb)
 statement ok
 GRANT INSERT on table my_schema.test to my_user
 
-@connection(id=mdb)
 statement ok
 GRANT UPDATE on table my_schema.test to my_user
 
-@connection(id=mdb)
 statement ok
 GRANT DELETE on table my_schema.test to my_user
 
diff --git a/sql/test/transactions/Tests/transaction_isolation2.test 
b/sql/test/transactions/Tests/transaction_isolation2.test
--- a/sql/test/transactions/Tests/transaction_isolation2.test
+++ b/sql/test/transactions/Tests/transaction_isolation2.test
@@ -1,44 +1,33 @@
-@connection(id=mdb1, username=monetdb, password=monetdb)
 statement ok
 start transaction
 
-@connection(id=mdb1)
 statement ok
 CREATE TABLE integers (i int)
 
-@connection(id=mdb1)
 statement ok
 insert into integers values (1),(2),(3),(NULL)
 
-@connection(id=mdb1)
 statement ok
 CREATE TABLE longs (i bigint)
 
-@connection(id=mdb1)
 statement ok
 CREATE TABLE doubles (d double precision)
 
-@connection(id=mdb1)
 statement ok
 insert into longs values (1),(2),(3)
 
-@connection(id=mdb1)
 statement ok
 insert into integers values (1),(2),(3)
 
-@connection(id=mdb1)
 statement ok
 alter table longs add primary key (i)
 
-@connection(id=mdb1)
 statement ok
 CREATE TABLE sys.myvar (c BIGINT)
 
-@connection(id=mdb1)
 statement ok
 commit
 
-@connection(id=mdb1)
 statement ok
 start transaction
 
@@ -46,7 +35,6 @@ start transaction
 statement ok
 start transaction
 
-@connection(id=mdb1)
 statement ok
 alter table integers add foreign key(i) references longs(i)
 
@@ -54,7 +42,6 @@ alter table integers add foreign key(i) 
 statement error 42000!ALTER TABLE: sys_integers_integers_i_fkey conflicts with 
another transaction
 alter table integers add foreign key(i) references longs(i)
 
-@connection(id=mdb1)
 statement ok
 commit
 
@@ -62,15 +49,12 @@ commit
 statement ok
 rollback
 
-@connection(id=mdb1)
 statement ok
 create trigger ups after delete on integers referencing old row as old_row for 
each row insert into longs values(0)
 
-@connection(id=mdb1)
 statement ok
 create trigger ups2 after delete on integers referencing old row as old_row 
for each row insert into longs values(10)
 
-@connection(id=mdb1)
 statement ok
 start transaction
 
@@ -78,7 +62,6 @@ start transaction
 statement ok
 start transaction
 
-@connection(id=mdb1)
 statement ok
 create or replace trigger ups after delete on integers referencing old row as 
old_row for each row insert into longs values(1)
 
@@ -86,7 +69,6 @@ create or replace trigger ups after dele
 statement error 42000!CREATE OR REPLACE TRIGGER: transaction conflict detected
 create or replace trigger ups after delete on integers referencing old row as 
old_row for each row insert into longs values(2)
 
-@connection(id=mdb1)
 statement ok
 commit
 
@@ -94,7 +76,6 @@ commit
 statement ok
 rollback
 
-@connection(id=mdb1)
 statement ok
 start transaction
 
@@ -102,7 +83,6 @@ start transaction
 statement ok
 start transaction
 
-@connection(id=mdb1)
 statement ok
 drop trigger ups
 
@@ -114,7 +94,6 @@ alter table doubles add primary key (d)
 statement error 42000!CREATE OR REPLACE TRIGGER: transaction conflict detected
 create or replace trigger ups after delete on integers referencing old row as 
old_row for each row insert into longs values(3)
 
-@connection(id=mdb1)
 statement ok
 commit
 
@@ -122,7 +101,6 @@ commit
 statement ok
 rollback
 
-@connection(id=mdb1)
 statement ok
 start transaction
 
@@ -130,7 +108,6 @@ start 

MonetDB: default - Merged triggers branch into default.

2023-02-22 Thread Sjoerd Mullender
Changeset: b3557c60c59c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b3557c60c59c
Modified Files:
sql/include/sql_catalog.h
sql/storage/sql_storage.h
sql/storage/store.c
Branch: default
Log Message:

Merged triggers branch into default.


diffs (truncated from 3354 to 300 lines):

diff --git a/clients/Tests/MAL-signatures-hge.test 
b/clients/Tests/MAL-signatures-hge.test
--- a/clients/Tests/MAL-signatures-hge.test
+++ b/clients/Tests/MAL-signatures-hge.test
@@ -48789,11 +48789,6 @@ command remote.connect(X_0:str, X_1:str,
 RMTconnectScen;
 returns a newly created connection for uri, using user name, password and 
scenario
 remote
-connect
-pattern remote.connect(X_0:str, X_1:str):str 
-RMTconnectTable;
-return a newly created connection for a table. username and password should be 
in the vault
-remote
 disconnect
 command remote.disconnect(X_0:str):void 
 RMTdisconnect;
@@ -49234,6 +49229,11 @@ command sql.date_trunc(X_0:str, X_1:time
 date_trunc;
 Truncate a timestamp to (millennium, 
century,decade,year,quarter,month,week,day,hour,minute,second, 
milliseconds,microseconds)
 sql
+decypher
+pattern sql.decypher(X_0:str):str 
+SQLdecypher;
+Return decyphered password
+sql
 delete
 unsafe pattern sql.delete(X_0:int, X_1:str, X_2:str, X_3:any):int 
 mvc_delete_wrap;
@@ -49724,11 +49724,6 @@ pattern sql.row_number(X_0:any_1, X_1:bi
 SQLrow_number;
 return the row_numer-ed groups
 sql
-rt_credentials
-pattern sql.rt_credentials(X_0:str) (X_1:bat[:str], X_2:bat[:str], 
X_3:bat[:str]) 
-sql_rt_credentials_wrap;
-Return the remote table credentials for the given table
-sql
 sessions
 pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], 
X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], 
X_7:bat[:int], X_8:bat[:int]) 
 sql_sessions_wrap;
@@ -50259,6 +50254,11 @@ pattern sqlcatalog.create_table(X_0:str,
 SQLcreate_table;
 Catalog operation create_table
 sqlcatalog
+create_table
+pattern sqlcatalog.create_table(X_0:str, X_1:str, X_2:ptr, X_3:int, X_4:str, 
X_5:str):void 
+SQLcreate_table;
+Catalog operation create_table
+sqlcatalog
 create_trigger
 pattern sqlcatalog.create_trigger(X_0:str, X_1:str, X_2:str, X_3:int, X_4:int, 
X_5:int, X_6:str, X_7:str, X_8:str, X_9:str, X_10:int):void 
 SQLcreate_trigger;
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
@@ -37219,11 +37219,6 @@ command remote.connect(X_0:str, X_1:str,
 RMTconnectScen;
 returns a newly created connection for uri, using user name, password and 
scenario
 remote
-connect
-pattern remote.connect(X_0:str, X_1:str):str 
-RMTconnectTable;
-return a newly created connection for a table. username and password should be 
in the vault
-remote
 disconnect
 command remote.disconnect(X_0:str):void 
 RMTdisconnect;
@@ -37639,6 +37634,11 @@ command sql.date_trunc(X_0:str, X_1:time
 date_trunc;
 Truncate a timestamp to (millennium, 
century,decade,year,quarter,month,week,day,hour,minute,second, 
milliseconds,microseconds)
 sql
+decypher
+pattern sql.decypher(X_0:str):str 
+SQLdecypher;
+Return decyphered password
+sql
 delete
 unsafe pattern sql.delete(X_0:int, X_1:str, X_2:str, X_3:any):int 
 mvc_delete_wrap;
@@ -38104,11 +38104,6 @@ pattern sql.row_number(X_0:any_1, X_1:bi
 SQLrow_number;
 return the row_numer-ed groups
 sql
-rt_credentials
-pattern sql.rt_credentials(X_0:str) (X_1:bat[:str], X_2:bat[:str], 
X_3:bat[:str]) 
-sql_rt_credentials_wrap;
-Return the remote table credentials for the given table
-sql
 sessions
 pattern sql.sessions() (X_0:bat[:int], X_1:bat[:str], X_2:bat[:timestamp], 
X_3:bat[:timestamp], X_4:bat[:str], X_5:bat[:int], X_6:bat[:int], 
X_7:bat[:int], X_8:bat[:int]) 
 sql_sessions_wrap;
@@ -38584,6 +38579,11 @@ pattern sqlcatalog.create_table(X_0:str,
 SQLcreate_table;
 Catalog operation create_table
 sqlcatalog
+create_table
+pattern sqlcatalog.create_table(X_0:str, X_1:str, X_2:ptr, X_3:int, X_4:str, 
X_5:str):void 
+SQLcreate_table;
+Catalog operation create_table
+sqlcatalog
 create_trigger
 pattern sqlcatalog.create_trigger(X_0:str, X_1:str, X_2:str, X_3:int, X_4:int, 
X_5:int, X_6:str, X_7:str, X_8:str, X_9:str, X_10:int):void 
 SQLcreate_trigger;
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
@@ -721,18 +721,8 @@ const char *wsaerror(int);
 
 # monetdb5
 str AUTHGeneratePasswordHash(str *res, const char *value);
-str AUTHRegisterGetPasswordHandler(get_user_password_handler callback);
-str AUTHRegisterGetUserNameHandler(get_user_name_handler callback);
-str AUTHRegisterGetUserOIDHandler(get_user_oid_handler callback);
-str AUTHaddRemoteTableCredentials(const char *local_table, const char 
*localuser, const char *uri, const char *remoteuser, const char *pass, bool 
pw_encrypted);
-str AUTHcheckCredentials(oid *ret, Client c, const char 

MonetDB: default - merged

2023-01-23 Thread Niels Nes
Changeset: 12047d4578bf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/12047d4578bf
Modified Files:
sql/storage/store.c
Branch: default
Log Message:

merged


diffs (truncated from 794 to 300 lines):

diff --git a/gdk/ChangeLog.Sep2022 b/gdk/ChangeLog.Sep2022
--- a/gdk/ChangeLog.Sep2022
+++ b/gdk/ChangeLog.Sep2022
@@ -1,6 +1,11 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Mon Jan 16 2023 Sjoerd Mullender 
+- Fixed a race condition that could lead to a bat being added to the SQL
+  catalog but nog being made persistent, causing a subsequent restart
+  of the system to fail (and crash).
+
 * Wed Dec 14 2022 Sjoerd Mullender 
 - Fixed a race condition where a hash could have been created on a
   bat using the old bat count while in another thread the bat count
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -97,17 +97,8 @@ typedef enum {LOG_OK, LOG_EOF, LOG_ERR} 
 static gdk_return bm_commit(logger *lg);
 static gdk_return tr_grow(trans *tr);
 
-static inline void
-log_lock(logger *lg)
-{
-   MT_lock_set(>lock);
-}
-
-static inline void
-log_unlock(logger *lg)
-{
-   MT_lock_unset(>lock);
-}
+#define log_lock(lg)   MT_lock_set(&(lg)->lock)
+#define log_unlock(lg) MT_lock_unset(&(lg)->lock)
 
 static inline bte
 find_type(logger *lg, int tpe)
@@ -1615,11 +1606,12 @@ cleanup_and_swap(logger *lg, int *r, con
return rcnt;
 }
 
+/* this function is called with log_lock() held; it releases the lock
+ * before returning */
 static gdk_return
 bm_subcommit(logger *lg)
 {
BUN p, q;
-   log_lock(lg);
BAT *catalog_bid = lg->catalog_bid;
BAT *catalog_id = lg->catalog_id;
BAT *dcatalog = lg->dcatalog;
@@ -1936,6 +1928,8 @@ log_load(int debug, const char *fn, cons
BBPretain(lg->catalog_id->batCacheid);
BBPretain(lg->dcatalog->batCacheid);
 
+   log_lock(lg);
+   /* bm_subcommit releases the lock */
if (bm_subcommit(lg) != GDK_SUCCEED) {
/* cannot commit catalog, so remove log */
MT_remove(filename);
@@ -3081,7 +3075,7 @@ bm_commit(logger *lg)
fprintf(stderr, "#bm_commit: create %d (%d)\n",
bid, BBP_lrefs(bid));
}
-   log_unlock(lg);
+   /* bm_subcommit releases the lock */
return bm_subcommit(lg);
 }
 
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1722,7 +1722,7 @@ BATselect(BAT *b, BAT *s, const void *tl
if ((oidxh = b->torderidx) != NULL)
HEAPincref(oidxh);
MT_lock_unset(>batIdxLock);
-   if (oidxh == NULL && pb) {
+   if (oidxh == NULL && pb != NULL) {
(void) BATcheckorderidx(pb);
MT_lock_set(>batIdxLock);
if ((oidxh = pb->torderidx) != NULL) {
@@ -1944,7 +1944,7 @@ BATselect(BAT *b, BAT *s, const void *tl
} else if (b->thash->nunique == bi.count)
estimate = 1;
}
-   if (estimate == BUN_NONE && (bi.key || (pb != NULL && pb->tkey))) {
+   if (estimate == BUN_NONE && (bi.key || (pb != NULL && pbi.key))) {
/* exact result size in special cases */
if (equi) {
estimate = 1;
@@ -2051,9 +2051,7 @@ BATselect(BAT *b, BAT *s, const void *tl
if (!equi &&
/* DISABLES CODE */ (0) && imprintable(bi.type) &&
(!bi.transient ||
-(parent != 0 &&
- pb != NULL &&
- !pbi.transient)) &&
+(pb != NULL && !pbi.transient)) &&
BATimprints(b) == GDK_SUCCEED) {
if (pb != NULL) {
MT_lock_set(>batIdxLock);
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -191,6 +191,9 @@ static struct winthread {
MT_Lock *lockwait;  /* lock we're waiting for */
MT_Sema *semawait;  /* semaphore we're waiting for */
MT_Cond *condwait;  /* condition variable we're waiting for */
+#ifdef LOCK_OWNER
+   MT_Lock *mylocks;   /* locks we're holding */
+#endif
struct winthread *joinwait; /* process we are joining with */
const char *working;/* what we're currently doing */
char algorithm[512];/* the algorithm used in the last operation */
@@ -211,21 +214,33 @@ static DWORD threadslot = TLS_OUT_OF_IND
 void
 dump_threads(void)
 {
-   TRC_DEBUG_IF(THRD) {
-   EnterCriticalSection(_cs);
-   for (struct winthread *w = winthreads; w; w = w->next) {
-   TRC_DEBUG_ENDIF(THRD, "%s, waiting for %s, working on 
%.200s\n",
-

MonetDB: default - merged with sep2022

2022-12-29 Thread Niels Nes
Changeset: fdd4fdd424f3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fdd4fdd424f3
Branch: default
Log Message:

merged with sep2022


diffs (78 lines):

diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -254,7 +254,7 @@ exp_print(mvc *sql, stream *fout, sql_ex
strcmp(exp_relname(e), e->l) == 0 &&
strcmp(exp_name(e), e->r) == 0)
alias = 0;
-   if (!exp_relname(e) && exp_name(e) && strcmp(exp_name(e), 
e->r)==0)
+   if (!exp_relname(e) && exp_name(e) && !e->l && 
strcmp(exp_name(e), e->r)==0)
alias = 0;
break;
case e_cmp:
diff --git 
a/sql/test/concurrent/Tests/many-concurrent-client-connections.timeout 
b/sql/test/concurrent/Tests/many-concurrent-client-connections.timeout
new file mode 100644
--- /dev/null
+++ b/sql/test/concurrent/Tests/many-concurrent-client-connections.timeout
@@ -0,0 +1,1 @@
+2
diff --git a/sql/test/concurrent/Tests/read-segment-after-free.timeout 
b/sql/test/concurrent/Tests/read-segment-after-free.timeout
--- a/sql/test/concurrent/Tests/read-segment-after-free.timeout
+++ b/sql/test/concurrent/Tests/read-segment-after-free.timeout
@@ -1,1 +1,1 @@
-2
+3
diff --git a/sql/test/concurrent/Tests/smart-segment-merge.timeout 
b/sql/test/concurrent/Tests/smart-segment-merge.timeout
new file mode 100644
--- /dev/null
+++ b/sql/test/concurrent/Tests/smart-segment-merge.timeout
@@ -0,0 +1,1 @@
+4
diff --git a/sql/test/concurrent/Tests/truncate-insert-flood.timeout 
b/sql/test/concurrent/Tests/truncate-insert-flood.timeout
new file mode 100644
--- /dev/null
+++ b/sql/test/concurrent/Tests/truncate-insert-flood.timeout
@@ -0,0 +1,1 @@
+2
diff --git a/sql/test/miscellaneous/Tests/groupby_error.test 
b/sql/test/miscellaneous/Tests/groupby_error.test
--- a/sql/test/miscellaneous/Tests/groupby_error.test
+++ b/sql/test/miscellaneous/Tests/groupby_error.test
@@ -406,7 +406,7 @@ project (
 | | | table("sys"."tab2") [ "tab2"."myk" as "myalias1"."myk", "tab2"."ups" 
UNIQUE as "myalias1"."ups" ]
 | | ) [ ("myalias0"."part" UNIQUE) = ("myalias1"."myk") ]
 | ) [ "myalias1"."ups", "myalias0"."part", "myalias0"."tet" as "track" ] [ 
"myalias0"."part", "track", "myalias0"."tet", "sys"."count"() NOT NULL as 
"%1"."%1" ]
-) [ "myalias0"."part", "myalias0"."tet", "%1"."%1" NOT NULL as "mycount", 
"track" ]
+) [ "myalias0"."part" as "part", "myalias0"."tet" as "tet", "%1"."%1" NOT NULL 
as "mycount", "track" ]
 
 query  rowsort
 select
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -914,7 +914,7 @@ project (
 | group by (
 | |  [  [ tinyint(2) "1", tinyint(2) "2", tinyint(2) "3" ] as "x"."x", "x"."x" 
NOT NULL as "x1" ]
 | ) [ "x"."x" NOT NULL ] [ "x"."x" NOT NULL, "x1" NOT NULL ]
-) [ "x"."x" NOT NULL UNIQUE, "x1" NOT NULL ]
+) [ "x"."x" NOT NULL UNIQUE as "x", "x1" NOT NULL ]
 
 query II rowsort
 SELECT x AS x, x + 1 AS x1 FROM (VALUES (1),(2),(3)) x(x) GROUP BY x, x1
@@ -936,7 +936,7 @@ project (
 | | |  [  [ tinyint(2) "1", tinyint(2) "2", tinyint(2) "3" ] as "x"."x" ]
 | | ) [ "x"."x" NOT NULL, "sys"."sql_add"("x"."x" NOT NULL, tinyint(2) "1") 
NOT NULL as "x1" ]
 | ) [ "x"."x" NOT NULL ] [ "x"."x" NOT NULL, "x1" NOT NULL ]
-) [ "x"."x" NOT NULL UNIQUE, "x1" NOT NULL ]
+) [ "x"."x" NOT NULL UNIQUE as "x", "x1" NOT NULL ]
 
 query II rowsort
 SELECT x AS x, (10 + x) * 2 - 29 AS x1 FROM (VALUES (1),(2),(3),(4),(5)) x(x) 
GROUP BY x, x1
@@ -962,7 +962,7 @@ project (
 | | |  [  [ tinyint(3) "1", tinyint(3) "2", tinyint(3) "3", tinyint(3) "4", 
tinyint(3) "5" ] as "x"."x" ]
 | | ) [ "x"."x" NOT NULL, "sys"."sql_add"("x"."x" NOT NULL, tinyint(5) "10") 
NOT NULL as "%7"."%7", "sys"."sql_mul"("%7"."%7" NOT NULL, tinyint(2) "2") NOT 
NULL as "%10"."%10", "sys"."sql_sub"("%10"."%10" NOT NULL, smallint(10) "29") 
NOT NULL as "x1" ]
 | ) [ "x"."x" NOT NULL ] [ "x"."x" NOT NULL, "x1" NOT NULL ]
-) [ "x"."x" NOT NULL UNIQUE, "x1" NOT NULL ]
+) [ "x"."x" NOT NULL UNIQUE as "x", "x1" NOT NULL ]
 
 query I nosort
 SELECT count(1) FROM (SELECT 
0.642700575141694319114549216465093195438385009765 % 3) x(x) GROUP BY 
2+(0+round(x.x, 1))
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2022-11-05 Thread Niels Nes
Changeset: 573080742d74 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/573080742d74
Branch: default
Log Message:

merged


diffs (truncated from 1218 to 300 lines):

diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -2317,7 +2317,7 @@ BATsetaccess(BAT *b, restrict_t newmode)
BATcheck(b, NULL);
if (newmode != BAT_READ &&
(isVIEW(b) || (ATOMIC_GET(>theap->refs) & HEAPREFS) > 1)) {
-   BAT *bn = COLcopy(b, b->ttype, true, TRANSIENT);
+   BAT *bn = COLcopy(b, b->ttype, true, b->batRole);
BBPunfix(b->batCacheid);
if (bn == NULL)
return NULL;
diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c
--- a/monetdb5/mal/mal_client.c
+++ b/monetdb5/mal/mal_client.c
@@ -500,6 +500,7 @@ MCcloseClient(Client c)
c->handshake_options = NULL;
setClientContext(NULL);
MT_thread_set_qry_ctx(NULL);
+   assert(c->qryctx.datasize == 0);
MT_sema_destroy(>s);
MT_lock_set(_contextLock);
if (shutdowninprogress) {
diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -87,9 +87,9 @@ printBATproperties(stream *f, BAT *b)
if (BBP_refs(b->batCacheid) - 1)
mnstr_printf(f, " refs=%d ", BBP_refs(b->batCacheid));
if (b->theap->refs)
-   mnstr_printf(f, " views=%llu", ATOMIC_GET(>theap->refs));
+   mnstr_printf(f, " views=%llu", (unsigned long long) 
ATOMIC_GET(>theap->refs));
if (b->tvheap->refs)
-   mnstr_printf(f, " shared vheaps=%llu", 
ATOMIC_GET(>tvheap->refs));
+   mnstr_printf(f, " shared vheaps=%llu", (unsigned long long) 
ATOMIC_GET(>tvheap->refs));
if (b->theap->parentid != b->batCacheid)
mnstr_printf(f, "view on %s ", BBP_logical(b->theap->parentid));
 }
diff --git a/monetdb5/mal/mal_factory.c b/monetdb5/mal/mal_factory.c
--- a/monetdb5/mal/mal_factory.c
+++ b/monetdb5/mal/mal_factory.c
@@ -122,6 +122,8 @@ runFactory(Client cntxt, MalBlkPtr mb, M
}
if (mb->errors)
throw(MAL, "factory.call", PROGRAM_GENERAL);
+   QryCtx *qc = MT_thread_get_qry_ctx();
+   MT_thread_set_qry_ctx(NULL);
if (firstcall ){
/* initialize the stack */
for(i= psig->argc; i< mb->vtop; i++) {
@@ -144,6 +146,7 @@ runFactory(Client cntxt, MalBlkPtr mb, M
 } else {
msg = reenterMAL(cntxt, mb, pl->pc, -1, pl->stk);
}
+   MT_thread_set_qry_ctx(qc);
/* propagate change in debugging status */
if (cmd && pl->stk && pl->stk->cmd != cmd && cmd != 'x')
for (; stk; stk = stk->up)
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
@@ -107,7 +107,7 @@ static str
 CLTInfo(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
bat *ret=  getArgReference_bat(stk,pci,0);
-   bat *ret2=  getArgReference_bat(stk,pci,0);
+   bat *ret2=  getArgReference_bat(stk,pci,1);
BAT *b = COLnew(0, TYPE_str, 12, TRANSIENT);
BAT *bn = COLnew(0, TYPE_str, 12, TRANSIENT);
char buf[32]; /* 32 bytes are enough */
diff --git a/monetdb5/modules/mal/tokenizer.c b/monetdb5/modules/mal/tokenizer.c
--- a/monetdb5/modules/mal/tokenizer.c
+++ b/monetdb5/modules/mal/tokenizer.c
@@ -124,7 +124,7 @@ TKNZRopen(void *ret, str *in)
}
tokenDepth = 0;
 
-   TRANS = COLnew(0, TYPE_str, MAX_TKNZR_DEPTH + 1, TRANSIENT);
+   TRANS = COLnew(0, TYPE_str, MAX_TKNZR_DEPTH + 1, SYSTRANS);
if (TRANS == NULL) {
MT_lock_unset(_contextLock);
throw(MAL, "tokenizer.open", SQLSTATE(HY013) MAL_MALLOC_FAIL);
diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Thu Nov  3 2022 Martin van Dinther 
+- System views sys.dependency_tables_on_functions and
+  dependency_views_on_functions have been extended with column: function_id.
+
 * Fri Sep 30 2022 Joeri van Ruth 
 - When loading data using COPY BINARY INTO, apply default values instead of 
just
   inserting NULLs.
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
@@ -5407,8 +5407,8 @@ sql_update_default(Client c, mvc *sql, s
" INSERT INTO 
sys.dump_statements VALUES ((SELECT COUNT(*) FROM sys.dump_statements) + 1, 
'COMMIT;');\n"
" RETURN 
sys.dump_statements;\n"
"END;\n"
-   

MonetDB: default - merged with sep2022

2022-11-05 Thread Niels Nes
Changeset: 7de45731ff81 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7de45731ff81
Modified Files:
clients/mapiclient/mclient.c
sql/backends/monet5/UDF/pyapi3/pyapi3.c
sql/backends/monet5/sql_scenario.c
Branch: default
Log Message:

merged with sep2022


diffs (truncated from 1617 to 300 lines):

diff --git a/clients/mapiclient/dotmonetdb.c b/clients/mapiclient/dotmonetdb.c
--- a/clients/mapiclient/dotmonetdb.c
+++ b/clients/mapiclient/dotmonetdb.c
@@ -15,7 +15,6 @@
 void
 parse_dotmonetdb(DotMonetdb *dotfile)
 {
-   char *cfile;
FILE *config = NULL;
char buf[FILENAME_MAX];
 
@@ -29,10 +28,43 @@ parse_dotmonetdb(DotMonetdb *dotfile)
 * (3 is standard shell syntax: use XDG_CONFIG_HOME if set, else use
 * $HOME/.config in its place)
 */
+#ifdef NATIVE_WIN32
+   wchar_t *cfile;
+   wchar_t wbuf[FILENAME_MAX];
+#define CF "%ls"   /* format to print cfile */
+
+   if ((cfile = _wgetenv(L"DOTMONETDBFILE")) == NULL) {
+   /* no environment variable: use a default */
+   cfile = L".monetdb";
+   if ((config = _wfopen(cfile, L"r")) == NULL) {
+   const wchar_t *xdg = _wgetenv(L"XDG_CONFIG_HOME");
+   const wchar_t *home = _wgetenv(L"HOME");
+   int len = -1;
+   cfile = wbuf;
+   if (xdg != NULL)
+   len = _snwprintf(wbuf, sizeof(wbuf), 
L"%ls%lcmonetdb", xdg, DIR_SEP);
+   else if (home != NULL)
+   len = _snwprintf(wbuf, sizeof(wbuf), 
L"%ls%lc.config%lcmonetdb", home, DIR_SEP, DIR_SEP);
+   if (len == -1 || len >= FILENAME_MAX || (config = 
_wfopen(wbuf, L"r")) == NULL) {
+   if (home) {
+   len = _snwprintf(wbuf, sizeof(wbuf), 
L"%ls%lc.monetdb", home, DIR_SEP);
+   if (len >= 0 && len < FILENAME_MAX)
+   config = _wfopen(wbuf, L"r");
+   }
+   }
+   }
+   } else if (*cfile != 0 && (config = _wfopen(cfile, L"r")) == NULL) {
+   fprintf(stderr, "failed to open file '%ls': %s\n",
+   cfile, strerror(errno));
+   }
+#else
+   char *cfile;
+#define CF "%s"/* format to print cfile */
+
if ((cfile = getenv("DOTMONETDBFILE")) == NULL) {
/* no environment variable: use a default */
cfile = ".monetdb";
-   if ((config = MT_fopen(cfile, "r")) == NULL) {
+   if ((config = fopen(cfile, "r")) == NULL) {
const char *xdg = getenv("XDG_CONFIG_HOME");
const char *home = getenv("HOME");
int len = -1;
@@ -41,18 +73,19 @@ parse_dotmonetdb(DotMonetdb *dotfile)
len = snprintf(buf, sizeof(buf), "%s%cmonetdb", 
xdg, DIR_SEP);
else if (home != NULL)
len = snprintf(buf, sizeof(buf), 
"%s%c.config%cmonetdb", home, DIR_SEP, DIR_SEP);
-   if (len == -1 || len >= FILENAME_MAX || (config = 
MT_fopen(buf, "r")) == NULL) {
+   if (len == -1 || len >= FILENAME_MAX || (config = 
fopen(buf, "r")) == NULL) {
if (home) {
len = snprintf(buf, sizeof(buf), 
"%s%c.monetdb", home, DIR_SEP);
if (len >= 0 && len < FILENAME_MAX)
-   config = MT_fopen(buf, "r");
+   config = fopen(buf, "r");
}
}
}
-   } else if (*cfile != 0 && (config = MT_fopen(cfile, "r")) == NULL) {
+   } else if (*cfile != 0 && (config = fopen(cfile, "r")) == NULL) {
fprintf(stderr, "failed to open file '%s': %s\n",
cfile, strerror(errno));
}
+#endif
 
*dotfile = (DotMonetdb) {0};
 
@@ -67,7 +100,7 @@ parse_dotmonetdb(DotMonetdb *dotfile)
if (buf[0] == '\0' || buf[0] == '#')
continue;
if ((q = strchr(buf, '=')) == NULL) {
-   fprintf(stderr, "%s:%d: syntax error: %s\n",
+   fprintf(stderr, CF ":%d: syntax error: %s\n",
cfile, line, buf);
continue;
}
@@ -91,7 +124,7 @@ parse_dotmonetdb(DotMonetdb *dotfile)
/* make sure we don't set garbage */
if (strcmp(q, "sql") != 0 &&

MonetDB: default - merged with sep2022

2022-09-07 Thread Niels Nes
Changeset: af72ae9ce826 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/af72ae9ce826
Branch: default
Log Message:

merged with sep2022


diffs (62 lines):

diff --git a/monetdb5/optimizer/opt_mitosis.c b/monetdb5/optimizer/opt_mitosis.c
--- a/monetdb5/optimizer/opt_mitosis.c
+++ b/monetdb5/optimizer/opt_mitosis.c
@@ -15,7 +15,8 @@
 str
 OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr 
pci)
 {
-   int i, j, limit, slimit, estimate = 0, pieces = 1, mito_parts = 0, 
mito_size = 0, row_size = 0, mt = -1;
+   int i, j, limit, slimit, estimate = 0, pieces = 1, mito_parts = 0, 
mito_size = 0, row_size = 0, mt = -1, nr_cols = 0,
+   nr_aggrs = 0;
str schema = 0, table = 0;
BUN r = 0, rowcnt = 0;  /* table should be sizeable to consider 
parallel execution*/
InstrPtr p, q, *old, target = 0;
@@ -51,6 +52,8 @@ OPTmitosisImplementation(Client cntxt, M
if (p->retc == 2 && isMatJoinOp(p))
maxslices = threads;
 
+   nr_aggrs += (p->argc > 2 && getModuleId(p) == aggrRef);
+
if (p->argc > 2 && getModuleId(p) == aggrRef &&
getFunctionId(p) != subcountRef &&
getFunctionId(p) != subminRef &&
@@ -113,10 +116,13 @@ OPTmitosisImplementation(Client cntxt, M
 * single subplan should ideally fit together.
 */
r = getRowCnt(mb, getArg(p, 0));
+   if (r == rowcnt)
+   nr_cols++;
if (r > rowcnt) {
/* the rowsize depends on the column types, assume 
void-headed */
row_size = ATOMsize(getBatType(getArgType(mb,p,0)));
rowcnt = r;
+   nr_cols = 1;
target = p;
estimate++;
r = 0;
@@ -151,6 +157,9 @@ OPTmitosisImplementation(Client cntxt, M
if (cntxt->memorylimit == 0 || pieces <= 1){
 */
if (pieces <= 1){
+   /* improve memory usage estimation */
+   if (nr_cols > 1 || nr_aggrs > 1)
+   argsize = (nr_cols + nr_aggrs) * sizeof(lng);
/* We haven't assigned the number of pieces.
 * Determine the memory available for this client
 */
@@ -181,11 +190,13 @@ OPTmitosisImplementation(Client cntxt, M
/* the number of pieces affects SF-100, going beyond 8x 
increases
 * the optimizer costs beyond the execution time
 */
-   pieces = 4 * (int) ceil((double)rowcnt / m / threads);
+   pieces = ((int) ceil((double)rowcnt / m / threads));
+   if (pieces <= threads)
+   pieces = threads;
} else if (rowcnt > MINPARTCNT) {
/* exploit parallelism, but ensure minimal partition size to
 * limit overhead */
-   pieces = 4 * (int) ceil(MIN((double)rowcnt / 
MINPARTCNT, threads));
+   pieces = MIN((int) ceil((double)rowcnt / MINPARTCNT), 
threads);
}
}
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with sep2022

2022-09-05 Thread Niels Nes
Changeset: d70e05683053 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d70e05683053
Modified Files:
clients/odbc/tests/ODBCmetadata.c
Branch: default
Log Message:

merged with sep2022


diffs (truncated from 473 to 300 lines):

diff --git a/clients/odbc/driver/SQLSpecialColumns.c 
b/clients/odbc/driver/SQLSpecialColumns.c
--- a/clients/odbc/driver/SQLSpecialColumns.c
+++ b/clients/odbc/driver/SQLSpecialColumns.c
@@ -165,7 +165,7 @@ MNDBSpecialColumns(ODBCStmt *stmt,
size_t querylen;
 
/* determine if we need to add a query against the tmp.* tables 
*/
-   bool addTmpQuery = (SchemaName == NULL)
+   bool inclTmpKey = (SchemaName == NULL)
|| (SchemaName != NULL
 && (strcmp((const char *) SchemaName, "tmp") 
== 0
  || strchr((const char *) SchemaName, '%') != 
NULL
@@ -205,37 +205,141 @@ MNDBSpecialColumns(ODBCStmt *stmt,
}
 
/* construct the query */
-   querylen = 5000 + (sch ? strlen(sch) : 0) + (tab ? strlen(tab) 
: 0);
-   if (addTmpQuery)
-   querylen *= 2;
+   querylen = 6000 + (sch ? strlen(sch) : 0) + (tab ? strlen(tab) 
: 0);
query = malloc(querylen);
if (query == NULL)
goto nomem;
 
+   /* When there is a PK for the table we return the pkey columns.
+* When there is No PK but there are multiple unique 
constraints, we need to pick one.
+* In the current implementation we return the first uc (lowest 
sys.keys.id).
+* When there is no PK or unique constraints and it is not a
+* view, we return all the columns of the table.
+*
+* Instead of the first uc (in case of multiple) we could 
potentially use the uc which has
+*  a) the least number of columns and
+*  b) the most efficient datatype (integers) or smallest 
total(size in bytes).
+* That's much more complex to do in SQL than the current 
implementation.
+* The current implementation (picking first uc) is fast and
+* gives a correct result, hence preferred.
+*/
+
+   /* 1st cte: syskeys */
+   pos += strcpy_len(query + pos,
+   "with syskeys as ("
+   /* all pkeys */
+   "SELECT \"id\", \"table_id\" FROM \"sys\".\"keys\" 
WHERE \"type\" = 0 "
+   "UNION ALL "
+   /* and first unique constraint of a table when table 
has no pkey */
+   "SELECT \"id\", \"table_id\" FROM \"sys\".\"keys\" 
WHERE \"type\" = 1 "
+   "AND \"table_id\" NOT IN (select \"table_id\" from 
\"sys\".\"keys\" where \"type\" = 0) "
+   "AND (\"table_id\", \"id\") IN (select \"table_id\", 
min(\"id\") from \"sys\".\"keys\" where \"type\" = 1 group by \"table_id\"))",
+   querylen - pos);
+   if (inclTmpKey) {
+   /* we must also include the primary key or unique 
constraint of local temporary tables which are stored in tmp.keys */
+   /* 2nd cte: tmpkeys */
+   pos += strcpy_len(query + pos,
+   ", tmpkeys as ("
+   "SELECT \"id\", \"table_id\" FROM \"tmp\".\"keys\" 
WHERE \"type\" = 0 "
+   "UNION ALL "
+   "SELECT \"id\", \"table_id\" FROM \"tmp\".\"keys\" 
WHERE \"type\" = 1 "
+   "AND \"table_id\" NOT IN (select \"table_id\" from 
\"tmp\".\"keys\" where \"type\" = 0) "
+   "AND (\"table_id\", \"id\") IN (select \"table_id\", 
min(\"id\") from \"tmp\".\"keys\" where \"type\" = 1 group by \"table_id\"))",
+   querylen - pos);
+   }
+   /* 3rd cte: tableids */
+   pos += strcpy_len(query + pos,
+   ", tableids as ("
+   "SELECT t.\"id\" "
+   "FROM \"sys\".\"tables\" t "
+   "JOIN \"sys\".\"schemas\" s ON t.\"schema_id\" = 
s.\"id\" "
+   "WHERE t.\"type\" NOT IN (1, 11)",  /* exclude all 
VIEWs and SYSTEM VIEWs */
+   querylen - pos);
+   /* add the selection condition */
+   if (NameLength1 > 0 && CatalogName != NULL) {
+   /* filtering requested on catalog name */
+   if (strcmp((char *) CatalogName, stmt->Dbc->dbname) != 
0) {
+   /* catalog name does not match the database 
name, so return no rows */
+   pos += strcpy_len(query + pos, " and 1=2", 
querylen - pos);
+

MonetDB: default - merged

2022-09-03 Thread Niels Nes
Changeset: 40d06637d960 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/40d06637d960
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

merged

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with Sep2022

2022-09-03 Thread Niels Nes
Changeset: d791a75b3b5a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d791a75b3b5a
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

merged with Sep2022


diffs (truncated from 4166 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -771,3 +771,4 @@ 59de1ee118d4eccc072c0cf3938f90635a7db311
 59de1ee118d4eccc072c0cf3938f90635a7db311 Jan2022_SP3_release
 38ba6e40ba9148c762fe4a4b40f4937f86e516b6 Jul2021_25
 470e524a786ee0e94c7901ec98d95ac351a0e472 Sep2022_root
+9785fa2a471fe32495e07479edf110335ddaa750 Jan2022_17
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -81,7 +81,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Jan2022-SP3/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Jan2022-SP4/%{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
@@ -849,6 +849,300 @@ fi
 %endif
 
 %changelog
+* Thu Aug 11 2022 Sjoerd Mullender  - 11.43.17-20220811
+- Rebuilt.
+- GH#2507: SQL: Implement complementary EXTRACT functionality
+- GH#2508: SQL:rel_optimizer apply min/max only on source table in join
+- GH#2511: SQL: describe object
+- GH#2512: SQL: Improve (i)like preformance on diverse stringdata
+- GH#2516: SQL: increase cost of a like operation
+- GH#2521: Optimise out group by operator in SQL level by constraint
+- GH#2525: SQL: CSV Vaults
+- GH#2526: SQL: level 3 naming
+- GH#2605: functions to retrieve warnings from the server in Mapi
+- GH#2608: Missing various functions used by Hibernate
+- GH#2630: Poor performance using length(...) = length(...) in conjuction
+  with a equjoin
+- GH#2749: Rewrite like without modifiers as = query early in the process
+- GH#2804: binary "export": COPY  INTO
+  
+- GH#2853: Give proper error message when starting database that needs
+  upgrade with --readonly
+- GH#2858: use of configure conditionals on Windows not complete and
+  consistent
+- GH#2941: please add transaction functions to php driver
+- GH#2948: Document MonetDB's usage of indices
+- GH#3001: Rewrite BETWEEN in column first notation, with constant
+  arguments last
+- GH#3005: When IN is presented with a single element, optimise to =
+- GH#3006: Keep result of UNION sorted when inputs are sorted
+- GH#3015: SQL-92 defines BIT and BIT VARYING
+- GH#3044: Exception handling in procedures and functions
+- GH#3162: If we insert and delete a set of records monet db is not
+  freeing up memory
+- GH#3187: Documentation suggests changing escape character is possible -
+  how to disable it entirely?
+- GH#3203: allow to set user/password for funnel connections
+- GH#3242: Steps for repair database
+- GH#3244: Rename default database "demo"
+- GH#3301: CHAR comparisons do not pad strings of different lengths
+- GH#3322: Run a statement each time a connection is created via ODBC
+- GH#3324: "copy subquery into file " doesnt support writing binary data
+  into file
+- GH#3327: Transactional behaviour of BinaryBulkLoad
+- GH#3355: Control the amount of (temp) space
+- GH#3378: possible to support double x boolean type casting in the next
+  update?
+- GH#3400: Support Backticks in SQL queries and redundant size
+  restrictions in DDL statements
+- GH#3405: Add bulk versions of json functions
+- GH#3410: Bogus (?) "Maximum concurrent client limit reached (65)"
+- GH#3413: Database corrupted after few days on database restart
+- GH#3426: Extend SQL triggers to fire on system events such as AFTER LOGON
+- GH#3441: Explicit WITHOUT TIME ZONE
+- GH#3499: Unresponsive mserver ("unknown state: 4" in logs on restart)
+- GH#3501: Starting database fails because of locale settings
+- GH#3509: add support for formatted conversion to string using function:
+  to_char(num_ts_val, 'format_mask')
+- GH#3517: scalar function round(num) is not supported
+- GH#3539: Configurable parsing for ETL and bulk loading
+- GH#3548: mitosis splits an unhelpful table when applied to unions
+- GH#3550: Distribution-adaptive grouping is gone
+- GH#3559: Harddrive fills and crashes database during live data insertion
+  via mapi library client.
+- GH#3569: Add support for: ALTER TABLE [schema1.]tablename ADD CONSTRAINT
+  [tbl_constr_name] CHECK (logical_expression)
+- GH#3570: Server dies on status or start my-first-db
+- GH#3590: string concat on a column is expensive
+- GH#3610: exittimeout property not being honoured
+- GH#3618: Illegal instruction thrown when releasing db
+- GH#3668: UNIQUE INDEX constraint is not enforced during inserts and
+  updates
+- GH#3670: COPY BINARY 

MonetDB: default - merged with jan2022

2022-07-08 Thread Niels Nes
Changeset: 254b834861db for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/254b834861db
Modified Files:
sql/storage/store.c
Branch: default
Log Message:

merged with jan2022


diffs (13 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2331,7 +2331,8 @@ store_manager(sqlstore *store)
break;
 
MT_thread_setworking("flushing");
-   res = store_apply_deltas(store);
+   while (res == LOG_OK && store->logger_api.changes(store) > 0)
+   res = store_apply_deltas(store);
 
if (res != LOG_OK) {
MT_lock_unset(>flush);
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with jan2022

2022-07-05 Thread Niels Nes
Changeset: ec881cc10860 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ec881cc10860
Modified Files:
sql/storage/store.c
Branch: default
Log Message:

merged with jan2022


diffs (69 lines):

diff --git a/common/stream/stdio_stream.c b/common/stream/stdio_stream.c
--- a/common/stream/stdio_stream.c
+++ b/common/stream/stdio_stream.c
@@ -55,7 +55,8 @@ file_write(stream *restrict s, const voi
if (elmsize && cnt) {
size_t rc = fwrite(buf, elmsize, cnt, fp);
 
-   if (!rc && ferror(fp)) {
+   if (rc != cnt) {
+   // only happens if fwrite encountered an error.
mnstr_set_error_errno(s, MNSTR_WRITE_ERROR, "write 
error");
return -1;
}
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -72,11 +72,25 @@ static struct tl_error_buf *get_tl_error
 
 static pthread_key_t tl_error_key;
 
+static void
+clear_main_tl_error_buf(void)
+{
+   void *p = pthread_getspecific(tl_error_key);
+   if (p != NULL) {
+   pthread_setspecific(tl_error_key, NULL);
+   free(p);
+   }
+}
+
 static int
 tl_error_init(void)
 {
if (pthread_key_create(_error_key, free) != 0)
return -1;
+   // Turns out the destructor registered with pthread_key_create() does 
not
+   // always run for the main thread. This atexit hook clears the main 
thread's
+   // error buffer to avoid this being reported as a memory leak.
+   atexit(clear_main_tl_error_buf);
return 0;
 }
 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2101,7 +2101,6 @@ store_init(int debug, store_type store_t
for(int i = 0; icolumn_locks[i], "sqlstore_column");
 
-   MT_lock_set(>flush);
MT_lock_set(>lock);
 
/* initialize empty bats */
@@ -2208,6 +2207,7 @@ store_apply_deltas(sqlstore *store)
store_lock(store);
ulng oldest = store_oldest_pending(store);
store_unlock(store);
+   TRC_DEBUG(SQL_STORE, "Store aplly deltas (" ULLFMT ")\n", oldest-1);
if (oldest)
res = store->logger_api.flush(store, oldest-1);
return res;
@@ -2322,6 +2322,7 @@ store_manager(sqlstore *store)
MT_lock_set(>commit);
MT_lock_set(>flush);
if (store->logger_api.changes(store) <= 0) {
+   TRC_DEBUG(SQL_STORE, "Store flusher, no changes\n");
MT_lock_unset(>commit);
continue;
}
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged properties into default

2022-05-02 Thread Pedro Ferreira
Changeset: 9ec792882357 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9ec792882357
Branch: default
Log Message:

Merged properties into default


diffs (truncated from 8518 to 300 lines):

diff --git a/monetdb5/modules/atoms/CMakeLists.txt 
b/monetdb5/modules/atoms/CMakeLists.txt
--- a/monetdb5/modules/atoms/CMakeLists.txt
+++ b/monetdb5/modules/atoms/CMakeLists.txt
@@ -18,7 +18,7 @@ target_sources(atoms
   url.c
   uuid.c
   json.c
-  mtime.c
+  mtime.c mtime.h
   inet.c
   identifier.c
   xml.c xml.h
diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -29,11 +29,9 @@
  */
 
 #include "monetdb_config.h"
-#include "gdk.h"
-#include "gdk_time.h"
+#include "mtime.h"
 #include "mal_client.h"
-#include "mal_interpreter.h"
-#include "mal_exception.h"
+
 
 #ifndef HAVE_STRPTIME
 extern char *strptime(const char *, const char *, struct tm *);
@@ -486,13 +484,6 @@ bailout:   
\
 #define func2_noexcept(FUNC, RET, PARAM1, PARAM2) RET = FUNC(PARAM1, PARAM2)
 #define func2_except(FUNC, RET, PARAM1, PARAM2) msg = FUNC(, PARAM1, 
PARAM2); if (msg) break
 
-/* TODO change dayint again into an int instead of lng */
-static inline lng
-date_diff_imp(const date d1, const date d2)
-{
-   int diff = date_diff(d1, d2);
-   return is_int_nil(diff) ? lng_nil : (lng) diff * (lng) (24*60*60*1000);
-}
 func2(MTIMEdate_diff, "diff",
  date, date, lng, date_diff_imp, func2_noexcept,
  DEC_VAR, DEC_VAR, DEC_VAR_R, DEC_INT,
@@ -506,28 +497,6 @@ func2(MTIMEdaytime_diff_msec, "diff",
  GET_NEXT_VAR, GET_NEXT_VAR,
  APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
 
-static inline str
-date_sub_msec_interval(date *ret, date d, lng ms)
-{
-   if (is_date_nil(d) || is_lng_nil(ms)) {
-   *ret = date_nil;
-   return MAL_SUCCEED;
-   }
-   if (is_date_nil((*ret = date_add_day(d, (int) (-ms / 
(24*60*60*1000))
-   throw(MAL, "mtime.date_sub_msec_interval", SQLSTATE(22003) 
"overflow in calculation");
-   return MAL_SUCCEED;
-}
-static inline str
-date_add_msec_interval(date *ret, date d, lng ms)
-{
-   if (is_date_nil(d) || is_lng_nil(ms)) {
-   *ret = date_nil;
-   return MAL_SUCCEED;
-   }
-   if (is_date_nil((*ret = date_add_day(d, (int) (ms / (24*60*60*1000))
-   throw(MAL, "mtime.date_add_msec_interval", SQLSTATE(22003) 
"overflow in calculation");
-   return MAL_SUCCEED;
-}
 func2(MTIMEdate_sub_msec_interval, "date_sub_msec_interval",
  date, lng, date, date_sub_msec_interval, func2_except,
  DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
@@ -541,28 +510,6 @@ func2(MTIMEdate_add_msec_interval, "date
  GET_NEXT_VAR, GET_NEXT_VAR,
  APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
 
-static inline str
-timestamp_sub_msec_interval(timestamp *ret, timestamp ts, lng ms)
-{
-   if (is_timestamp_nil(ts) || is_lng_nil(ms)) {
-   *ret = timestamp_nil;
-   return MAL_SUCCEED;
-   }
-   if (is_timestamp_nil((*ret = timestamp_add_usec(ts, -ms * 1000
-   throw(MAL, "mtime.timestamp_sub_msec_interval", SQLSTATE(22003) 
"overflow in calculation");
-   return MAL_SUCCEED;
-}
-static inline str
-timestamp_add_msec_interval(timestamp *ret, timestamp ts, lng ms)
-{
-   if (is_timestamp_nil(ts) || is_lng_nil(ms)) {
-   *ret = timestamp_nil;
-   return MAL_SUCCEED;
-   }
-   if (is_timestamp_nil((*ret = timestamp_add_usec(ts, ms * 1000
-   throw(MAL, "mtime.timestamp_add_msec_interval", SQLSTATE(22003) 
"overflow in calculation");
-   return MAL_SUCCEED;
-}
 func2(MTIMEtimestamp_sub_msec_interval, "timestamp_sub_msec_interval",
  timestamp, lng, timestamp, timestamp_sub_msec_interval, func2_except,
  DEC_VAR_R, DEC_VAR_R, DEC_VAR_R, DEC_INT,
@@ -576,28 +523,6 @@ func2(MTIMEtimestamp_add_msec_interval, 
  GET_NEXT_VAR, GET_NEXT_VAR,
  APPEND_VAR, FINISH_INT_SINGLE, CLEAR_NOTHING)
 
-static inline str
-timestamp_sub_month_interval(timestamp *ret, timestamp ts, int m)
-{
-   if (is_timestamp_nil(ts) || is_int_nil(m)) {
-   *ret = timestamp_nil;
-   return MAL_SUCCEED;
-   }
-   if (is_timestamp_nil((*ret = timestamp_add_month(ts, -m
-   throw(MAL, "mtime.timestamp_sub_month_interval", 
SQLSTATE(22003) "overflow in calculation");
-   return MAL_SUCCEED;
-}
-static inline str
-timestamp_add_month_interval(timestamp *ret, timestamp ts, int m)
-{
-   if (is_timestamp_nil(ts) || is_int_nil(m)) {
-   *ret = timestamp_nil;
-   return MAL_SUCCEED;
-   }
-   if (is_timestamp_nil((*ret = timestamp_add_month(ts, m
-   

MonetDB: default - Merged with Jan2022

2022-04-26 Thread Pedro Ferreira
Changeset: 9440025edd3d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9440025edd3d
Modified Files:
gdk/gdk_aggr.c
sql/server/rel_optimize_sel.c
sql/server/rel_optimizer.c
sql/test/SQLancer/Tests/sqlancer08.test
Branch: default
Log Message:

Merged with Jan2022


diffs (115 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -1815,7 +1815,17 @@ BATprod(void *res, int tp, BAT *b, BAT *
}   \
} while (0)
 
-/* calculate group averages with optional candidates list */
+/* There are three functions that are used for calculating averages.
+ * The first one (BATgroupavg) returns averages as a floating point
+ * value, the other two (BATgroupavg3 and BATgroupavg3combine) work
+ * together to return averages in the domain type (which should be an
+ * integer type). */
+
+/* Calculate group averages with optional candidates list.  The average
+ * that is calculated is returned in a dbl, independent of the type of
+ * the input.  The average is calculated exactly, so not in a floating
+ * point which could potentially losse bits during processing
+ * (e.g. average of 2**62 and a billion 1's). */
 gdk_return
 BATgroupavg(BAT **bnp, BAT **cntsp, BAT *b, BAT *g, BAT *e, BAT *s, int tp, 
bool skip_nils, bool abort_on_error, int scale)
 {
@@ -2008,13 +2018,14 @@ BATgroupavg(BAT **bnp, BAT **cntsp, BAT 
return GDK_FAIL;
 }
 
-/* An exact numeric average of a bunch of values consists of three parts: the
- * average rounded down (towards minus infinity), the number of values that
- * participated in the calculation, and the remainder.  The remainder is in the
- * range 0 (inclusive) to count (not inclusive).  BATgroupavg3 calculates these
- * values for each given group.  The function below, BATgroupavg3combine,
- * combines averages calculated this way to correct, rounded or truncated
- * towards zero (depending on the symbol TRUNCATE_NUMBERS) averages. */
+/* An exact numeric average of a bunch of values consists of three
+ * parts: the average rounded down (towards minus infinity), the number
+ * of values that participated in the calculation, and the remainder.
+ * The remainder is in the range 0 (inclusive) to count (not inclusive).
+ * BATgroupavg3 calculates these values for each given group.  The
+ * function below, BATgroupavg3combine, combines averages calculated
+ * this way to correct averages by rounding or truncating towards zero
+ * (depending on the symbol TRUNCATE_NUMBERS). */
 gdk_return
 BATgroupavg3(BAT **avgp, BAT **remp, BAT **cntp, BAT *b, BAT *g, BAT *e, BAT 
*s, bool skip_nils)
 {
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
@@ -3835,10 +3835,10 @@ point_select_on_unique_column(sql_rel *r
 static sql_rel *
 rel_push_select_up_(visitor *v, sql_rel *rel)
 {
-   if ((is_join(rel->op) || is_semi(rel->op)) && !is_single(rel)) {
+   if ((is_innerjoin(rel->op) || is_left(rel->op) || is_right(rel->op) || 
is_semi(rel->op)) && !is_single(rel)) {
sql_rel *l = rel->l, *r = rel->r;
-   bool can_pushup_left = is_select(l->op) && !rel_is_ref(l) && 
!is_single(l),
-can_pushup_right = is_select(r->op) && !rel_is_ref(r) 
&& !is_single(r) && !is_semi(rel->op);
+   bool can_pushup_left = is_select(l->op) && !rel_is_ref(l) && 
!is_single(l) && (is_innerjoin(rel->op) || is_left(rel->op) || 
is_semi(rel->op)),
+can_pushup_right = is_select(r->op) && !rel_is_ref(r) 
&& !is_single(r) && (is_innerjoin(rel->op) || is_right(rel->op));
 
if (can_pushup_left || can_pushup_right) {
if (can_pushup_left)
@@ -3877,5 +3877,5 @@ bind_push_select_up(visitor *v, global_p
 {
int flag = v->sql->sql_optimizer;
return gp->opt_level == 1 && gp->cnt[op_select] && (gp->cnt[op_join] || 
gp->cnt[op_left] ||
-  gp->cnt[op_right] || gp->cnt[op_full] || gp->cnt[op_semi] || 
gp->cnt[op_anti]) && (flag & push_select_up) ? rel_push_select_up : NULL;
+  gp->cnt[op_right] || gp->cnt[op_semi] || gp->cnt[op_anti]) 
&& (flag & push_select_up) ? rel_push_select_up : NULL;
 }
diff --git a/sql/test/SQLancer/Tests/sqlancer08.test 
b/sql/test/SQLancer/Tests/sqlancer08.test
--- a/sql/test/SQLancer/Tests/sqlancer08.test
+++ b/sql/test/SQLancer/Tests/sqlancer08.test
@@ -423,3 +423,43 @@ ROLLBACK
 statement error 22003!overflow in conversion of 789092170 to bte.
 SELECT round(- (((-443710828)||(1616633099))), 789092170)
 
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE "rt0" ("c0" BOOLEAN,"c1" BOOLEAN NOT NULL, CONSTRAINT 
"rt0_c1_pkey" PRIMARY KEY ("c1"))
+
+statement ok rowcount 2
+INSERT INTO "rt0" VALUES (NULL, false), (false, true)
+
+query I nosort
+SELECT rt0.c1 FROM rt0 FULL OUTER JOIN 

MonetDB: default - Merged with Jan2022

2022-04-25 Thread Pedro Ferreira
Changeset: 3e981b046658 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3e981b046658
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

Merged with Jan2022


diffs (37 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -763,3 +763,4 @@ cab90a348501b045e19cee5cebcc44f3800bd0a8
 5872f047d97c98d3a848514438b8f97fa446855d Jan2022_11
 025239a5a6f122042798c0f1132a2c6298514e06 Jan2022_13
 025239a5a6f122042798c0f1132a2c6298514e06 Jan2022_SP2_release
+2e54857a91306cc6304825c5596f65d00595db6b Jul2021_23
diff --git a/buildtools/conf/Maddlog b/buildtools/conf/Maddlog
--- a/buildtools/conf/Maddlog
+++ b/buildtools/conf/Maddlog
@@ -189,6 +189,9 @@ fi
 
 file=ChangeLog.$RANDOM
 
+# make sure we get the correct day and month names
+export LC_ALL=en_US.utf-8
+
 case "$CL" in
 */*)
 cd "${CL%/*}"
diff --git a/sql/ChangeLog.Jan2022 b/sql/ChangeLog.Jan2022
--- a/sql/ChangeLog.Jan2022
+++ b/sql/ChangeLog.Jan2022
@@ -1,6 +1,12 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Mon Apr 25 2022 Sjoerd Mullender 
+- GLOBAL TEMPORARY tables are now treated like LOCAL TEMPORARY tables
+  as far as the table content is concerned.  The schema information
+  stays global.  This fixes an issue with concurrent access and cleanup
+  of stale data.
+
 * Thu Apr 14 2022 Sjoerd Mullender 
 - The NO CONSTRAINT option of the COPY INTO query has been removed.
   It didn't work and it was never a good idea anyway.
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022

2022-04-15 Thread Pedro Ferreira
Changeset: c2e3aa57817b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c2e3aa57817b
Modified Files:
sql/server/rel_schema.c
sql/test/miscellaneous/Tests/simple_selects.test
Branch: default
Log Message:

Merged with Jan2022


diffs (145 lines):

diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -378,6 +378,10 @@ column_constraint_type(mvc *sql, const c
(void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
%s: key %s already exists", (kt == pkey) ? "PRIMARY KEY" : "UNIQUE", name);
return res;
}
+   if (ol_find_name(t->idxs, name) || mvc_bind_idx(sql, ss, name)) 
{
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
%s: an index named '%s' already exists, and it would conflict with the key", kt 
== pkey ? "PRIMARY KEY" : "UNIQUE", name);
+   return res;
+   }
switch (mvc_create_ukey(, sql, t, name, kt)) {
case -1:
(void) sql_error(sql, 02, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
@@ -461,6 +465,10 @@ column_constraint_type(mvc *sql, const c
(void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: key '%s' already exists", name);
return res;
}
+   if (ol_find_name(t->idxs, name) || mvc_bind_idx(sql, ss, name)) 
{
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: an index named '%s' already exists, and it would conflict with the 
key", name);
+   return res;
+   }
 
/* find unique referenced key */
if (n->next->data.lval) {
@@ -719,6 +727,10 @@ table_foreign_key(mvc *sql, const char *
(void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: key '%s' already exists", name);
return SQL_ERR;
}
+   if (ol_find_name(t->idxs, name) || mvc_bind_idx(sql, ss, name)) 
{
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: an index named '%s' already exists, and it would conflict with the 
key", name);
+   return SQL_ERR;
+   }
if (n->next->next->data.lval) { /* find unique referenced key */
dnode *rnms = n->next->next->data.lval->h;
list *cols = sa_list(sql->sa);
@@ -825,6 +837,10 @@ table_constraint_type(mvc *sql, const ch
(void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
%s: key '%s' already exists", kt == pkey ? "PRIMARY KEY" : "UNIQUE", name);
return SQL_ERR;
}
+   if (ol_find_name(t->idxs, name) || mvc_bind_idx(sql, ss, name)) 
{
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
%s: an index named '%s' already exists, and it would conflict with the key", kt 
== pkey ? "PRIMARY KEY" : "UNIQUE", name);
+   return SQL_ERR;
+   }
 
switch (mvc_create_ukey(, sql, t, name, kt)) {
case -1:
@@ -2200,6 +2216,8 @@ rel_create_index(mvc *sql, char *iname, 
return sql_error(sql, 02, SQLSTATE(42000) "CREATE INDEX: index 
name cannot contain just digit characters (0 through 9)");
if ((i = mvc_bind_idx(sql, t->s, iname)))
return sql_error(sql, 02, SQLSTATE(42S11) "CREATE INDEX: name 
'%s' already in use", iname);
+   if (ol_find_name(t->keys, iname) || mvc_bind_key(sql, t->s, iname))
+   return sql_error(sql, 02, SQLSTATE(42000) "CREATE INDEX: a key 
named '%s' already exists, and it would conflict with the index", iname);
if (!isTable(t))
return sql_error(sql, 02, SQLSTATE(42S02) "CREATE INDEX: cannot 
create index on %s '%s'", TABLE_TYPE_DESCRIPTION(t->type, t->properties), 
tname);
nt = dup_sql_table(sql->sa, t);
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -1034,6 +1034,42 @@ statement ok
 START TRANSACTION
 
 statement ok
+create table x (x int primary key)
+
+statement ok
+create table y (y int)
+
+statement ok
+create index ups on y(y)
+
+statement error 42000!CONSTRAINT FOREIGN KEY: an index named 'ups' already 
exists, and it would conflict with the key
+alter table y add constraint ups foreign key (y) references x (x)
+
+statement ok
+ROLLBACK
+
+statement ok
+START TRANSACTION
+
+statement ok
+create table x (x int primary key)
+
+statement ok
+create table y (y int)
+
+statement ok
+alter table y add constraint ups2 foreign key (y) references x (x)
+
+statement error 

MonetDB: default - Merged with Jan2022

2022-04-15 Thread Pedro Ferreira
Changeset: 475f2ed2233c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/475f2ed2233c
Modified Files:
sql/storage/store.c
sql/test/miscellaneous/Tests/All
Branch: default
Log Message:

Merged with Jan2022


diffs (60 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -411,9 +411,9 @@ load_key(sql_trans *tr, sql_table *t, re
}
 
/* find idx with same name */
-   sql_base *i = os_find_name(nk->t->s->idxs, tr, nk->base.name);
-   if (i) {
-   nk->idx = (sql_idx*)i;
+   node *n = ol_find_name(t->idxs, nk->base.name);
+   if (n) {
+   nk->idx = (sql_idx*)n->data;
nk->idx->key = nk;
}
return nk;
@@ -2885,12 +2885,9 @@ key_dup(sql_trans *tr, sql_key *k, sql_t
nk->idx = NULL;
 
if (k->idx) {
-   sql_base *b = os_find_name(nk->t->s->idxs, tr, nk->base.name);
-
-   if (b) {
-   nk->idx = (sql_idx *)b;
-   nk->idx->key = nk;
-   }
+   node *n = ol_find_name(t->idxs, nk->base.name);
+   nk->idx = (sql_idx *)n->data;
+   nk->idx->key = nk;
}
 
if (nk->type != fkey) {
diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All
--- a/sql/test/miscellaneous/Tests/All
+++ b/sql/test/miscellaneous/Tests/All
@@ -26,3 +26,4 @@ NOT_ASSERT?sqlfuncnames
 sequences
 analyze_test
 blobs
+temp_tables
diff --git a/sql/test/miscellaneous/Tests/temp_tables.SQL.py 
b/sql/test/miscellaneous/Tests/temp_tables.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/miscellaneous/Tests/temp_tables.SQL.py
@@ -0,0 +1,15 @@
+from MonetDBtesting.sqltest import SQLTestCase
+
+# another temp tables test case
+with SQLTestCase() as mdb1:
+mdb1.connect(username="monetdb", password="monetdb")
+mdb1.execute("CREATE GLOBAL TEMPORARY TABLE t2(c0 INT, c1 TIME UNIQUE) ON 
COMMIT DELETE ROWS;").assertSucceeded()
+
+with SQLTestCase() as mdb2:
+mdb2.connect(username="monetdb", password="monetdb")
+mdb2.execute("INSERT INTO tmp.t2(c1) VALUES(TIME 
'13:35:22');").assertSucceeded().assertRowCount(1)
+
+with SQLTestCase() as mdb3:
+mdb3.connect(username="monetdb", password="monetdb")
+mdb3.execute("INSERT INTO tmp.t2(c1, c0) VALUES(TIME '13:41:34', 
66);").assertSucceeded().assertRowCount(1)
+mdb3.execute("DROP TABLE tmp.t2;").assertSucceeded()
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022 branch.

2022-04-15 Thread Sjoerd Mullender
Changeset: e58dc246250d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e58dc246250d
Modified Files:
gdk/gdk_calc_private.h
Branch: default
Log Message:

Merged with Jan2022 branch.


diffs (46 lines):

diff --git a/gdk/gdk_calc_private.h b/gdk/gdk_calc_private.h
--- a/gdk/gdk_calc_private.h
+++ b/gdk/gdk_calc_private.h
@@ -157,7 +157,7 @@
 #elif HAVE___INT128
 #define LNGMUL_CHECK(lft, rgt, dst, max, on_overflow)  \
MULI4_WITH_CHECK(lft, rgt, lng, dst, max, __int128, on_overflow)
-#elif defined(_MSC_VER) && defined(_M_AMD64)
+#elif defined(_MSC_VER) && defined(_M_AMD64) && !defined(__INTEL_COMPILER)
 #include 
 #pragma intrinsic(_mul128)
 #define LNGMUL_CHECK(lft, rgt, dst, max, on_overflow)  \
diff --git a/sql/test/Tests/load_with_offset.test 
b/sql/test/Tests/load_with_offset.test
--- a/sql/test/Tests/load_with_offset.test
+++ b/sql/test/Tests/load_with_offset.test
@@ -136,7 +136,7 @@ NULL
 a
 b
 
-statement error 42000!syntax error in: "copy 9 records into my_test from stdin 
using delimiters '|',E'\n' null as '' no"
+statement error 42000!
 COPY 9 RECORDS INTO my_test FROM stdin USING DELIMITERS '|',E'\n' NULL as '' 
NO CONSTRAINT
 
 
diff --git a/testing/utils.py b/testing/utils.py
--- a/testing/utils.py
+++ b/testing/utils.py
@@ -9,16 +9,14 @@ def parse_mapi_err_msg(error:str=''):
 """
 err_code = None
 err_msg = None
-tmp = error.split('!')
+tmp = error.split('!', 1)
 if len(tmp) > 1:
 try:
 err_code = tmp[0].strip()
 except (ValueError, TypeError):
 pass
-# reconstruct
-err_msg = ('!'.join(tmp[1:])).strip()
+err_msg = tmp[1].strip()
 elif len(tmp) == 1:
 if tmp[0]:
 err_msg = tmp[0].strip()
 return err_code, err_msg
-
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022

2022-04-14 Thread Pedro Ferreira
Changeset: 08ea6d1ac05e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/08ea6d1ac05e
Modified Files:
clients/mapiclient/mhelp.c
Branch: default
Log Message:

Merged with Jan2022


diffs (33 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -109,15 +109,15 @@ SQLhelp sqlhelp1[] = {
 "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/transactions/"},
{"COPY BINARY",
 "Append binary representations into a table",
-"COPY [( BIG | LITTLE | NATIVE) ENDIAN] BINARY INTO qname 
[column_list] FROM string [',' ...] [ON { CLIENT | SERVER }] [NO CONSTRAINT]",
+"COPY [( BIG | LITTLE | NATIVE) ENDIAN] BINARY INTO qname 
[column_list] FROM string [',' ...] [ON { CLIENT | SERVER }]",
 "qname,column_list",
 "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/binary-loading/"},
{"COPY INTO",
 "Parse a csv file into a table or write a query result to a csv file",
 "COPY [nrofrecords] INTO qname [column_list] FROM string [',' ...] 
[headerlist] [ON { CLIENT | SERVER }] [ separators]\n"
-" [NULL [AS] string] [LOCKED] [BEST EFFORT] [NO CONSTRAINT] [FWF '(' 
integer [',' ...] ')'\n"
+" [NULL [AS] string] [BEST EFFORT] [FWF '(' integer [',' ...] ')'\n"
 "COPY [nrofrecords] INTO qname [column_list] FROM STDIN [headerlist] [ 
separators]\n"
-" [NULL [AS] string] [LOCKED] [BEST EFFORT] [NO CONSTRAINT]\n"
+" [NULL [AS] string] [BEST EFFORT]\n"
 "COPY query_expression INTO [STDOUT | string [ON { CLIENT | SERVER }]] 
[separators] [NULL [AS] string]",
 "nrofrecords,qname,column_list,headerlist,separators",
 "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-loading/copy-from/"},
diff --git a/sql/ChangeLog.Jan2022 b/sql/ChangeLog.Jan2022
--- a/sql/ChangeLog.Jan2022
+++ b/sql/ChangeLog.Jan2022
@@ -1,3 +1,7 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Thu Apr 14 2022 Sjoerd Mullender 
+- The NO CONSTRAINT option of the COPY INTO query has been removed.
+  It didn't work and it was never a good idea anyway.
+
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged with default

2022-04-14 Thread Niels Nes
Changeset: 7c2d2c4f3b9d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7c2d2c4f3b9d
Modified Files:
debian/control
gdk/gdk_align.c
gdk/gdk_batop.c
gdk/gdk_calc_private.h
gdk/gdk_logger.c
gdk/gdk_private.h
gdk/gdk_storage.c
gdk/gdk_string.c
gdk/gdk_utils.c
monetdb5/modules/atoms/str.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/include/sql_relation.h
sql/server/rel_updates.c
sql/server/sql_parser.y
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: default
Log Message:

merged with default


diffs (truncated from 338 to 300 lines):

diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -17,7 +17,8 @@ X-Python-Version: >= 2.6
 
 Package: libmonetdb25
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends},
+ libmonetdb-stream25 (= ${source:Version})
 Conflicts: libmonetdb5-server-geom (<< ${source:Version})
 Description: MonetDB core library
  MonetDB is a database management system that is developed from a
@@ -34,7 +35,8 @@ Description: MonetDB core library
 Package: libmonetdb-dev
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends},
- libmonetdb25, libmonetdb-stream-dev
+ libmonetdb25 (= ${source:Version}),
+ libmonetdb-stream-dev (= ${source:Version})
 Description: MonetDB development files
  MonetDB is a database management system that is developed from a
  main-memory perspective with use of a fully decomposed storage model,
@@ -71,7 +73,8 @@ Description: MonetDB stream library deve
 
 Package: libmonetdb-client25
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends},
+ libmonetdb-stream25 (= ${source:Version})
 Description: MonetDB client/server interface library
  MonetDB is a database management system that is developed from a
  main-memory perspective with use of a fully decomposed storage model,
@@ -96,7 +99,9 @@ Description: MonetDB client/server inter
 
 Package: monetdb-client
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends},
+ libmonetdb-client25 (= ${source:Version}),
+ libmonetdb-stream25 (= ${source:Version})
 Recommends: monetdb5-sql (= ${source:Version}),
  monetdb5-server (= ${source:Version})
 Description: MonetDB database client
@@ -112,7 +117,8 @@ Description: MonetDB database client
 
 Package: libmonetdb-client-odbc
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, odbcinst
+Depends: ${shlibs:Depends}, ${misc:Depends}, odbcinst,
+ libmonetdb-client25 (= ${source:Version})
 Description: MonetDB ODBC driver
  MonetDB is a database management system that is developed from a
  main-memory perspective with use of a fully decomposed storage model,
@@ -124,6 +130,9 @@ Description: MonetDB ODBC driver
 Package: monetdb-client-testing
 Architecture: any
 Depends: ${shlibs:Depends}, libmonetdb-client-odbc (= ${source:Version}),
+ libmonetdb-client25 (= ${source:Version}),
+ libmonetdb-stream25 (= ${source:Version}),
+ libmonetdb25 (= ${source:Version}),
  monetdb5-server (= ${source:Version}),
  libdbd-monetdb-perl (>= 1.0),
  php-monetdb (>= 1.0),
@@ -143,6 +152,8 @@ Package: libmonetdb5-server-geom
 Section: libs
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends},
+ libmonetdb-stream25 (= ${source:Version}),
+ libmonetdb25 (= ${source:Version}),
  monetdb5-server (= ${source:Version})
 Description: MonetDB5 SQL GIS support module
  MonetDB is a database management system that is developed from a
@@ -157,6 +168,7 @@ Package: libmonetdb5-server-cfitsio
 Section: libs
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends},
+ libmonetdb25 (= ${source:Version}),
  monetdb5-server (= ${source:Version})
 Description: MonetDB5 add on module for FITS files
  MonetDB is a database management system that is developed from a
@@ -169,7 +181,10 @@ Description: MonetDB5 add on module for 
 
 Package: monetdb5-server
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser,
+ libmonetdb-client25 (= ${source:Version}),
+ libmonetdb-stream25 (= ${source:Version}),
+ libmonetdb25 (= ${source:Version}),
 Recommends: monetdb5-sql (= ${source:Version})
 Suggests: monetdb-client (= ${source:Version})
 Conflicts: monetdb5-server-hugeint (<< 11.38.0),
@@ -202,6 +217,8 @@ Description: MonetDB database server ver
 Package: monetdb5-sql
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends},
+ libmonetdb-client25 (= ${source:Version}),
+ libmonetdb-stream25 (= ${source:Version}),
  monetdb5-server (= ${source:Version})
 Conflicts: monetdb5-sql-hugeint (<< 11.38.0)
 Replaces: monetdb5-sql-hugeint (<< 11.38.0)
@@ -231,6 +248,7 @@ Description: MonetDB SQL support for mon
 Package: monetdb-python3
 Architecture: any
 Depends: 

MonetDB: default - Merged with Jan2022

2022-04-13 Thread Pedro Ferreira
Changeset: 819bfb3503d5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/819bfb3503d5
Modified Files:
sql/server/rel_schema.c
sql/test/miscellaneous/Tests/simple_selects.test
Branch: default
Log Message:

Merged with Jan2022


diffs (55 lines):

diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -434,6 +434,14 @@ column_constraint_type(mvc *sql, const c
}
if (!rt)
return SQL_ERR;
+   if (!rt->s) { /* disable foreign key on declared table */
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: cannot create foreign key with declared tables");
+   return res;
+   }
+   if (isTempSchema(t->s) != isTempSchema(rt->s)) { /* disable 
foreign key between temp and non temp */
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: cannot create foreign key between temporary and non temporary 
tables");
+   return res;
+   }
if (!ns || !*ns) { /* add this to be safe */
(void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: key name name cannot be empty");
return res;
@@ -680,6 +688,14 @@ table_foreign_key(mvc *sql, const char *
int ref_actions = n->next->next->next->next->data.i_val;
 
assert(n->next->next->next->next->type == type_int);
+   if (!ft->s) { /* disable foreign key on declared table */
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: cannot create foreign key with declared tables");
+   return SQL_ERR;
+   }
+   if (isTempSchema(t->s) != isTempSchema(ft->s)) { /* disable 
foreign key between temp and non temp */
+   (void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: cannot create foreign key between temporary and non temporary 
tables");
+   return SQL_ERR;
+   }
if (!ns || !*ns) { /* add this to be safe */
(void) sql_error(sql, 02, SQLSTATE(42000) "CONSTRAINT 
FOREIGN KEY: key name name cannot be empty");
return SQL_ERR;
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -1006,6 +1006,18 @@ drop index tmp.ups
 statement ok
 drop table x
 
+statement ok
+START TRANSACTION
+
+statement ok
+create temp table foo (i int primary key) on commit preserve rows
+
+statement error 42000!CONSTRAINT FOREIGN KEY: cannot create foreign key 
between temporary and non temporary tables
+create table bar (i int, FOREIGN KEY (i) REFERENCES foo(i))
+
+statement ok
+ROLLBACK
+
 # some private functions related errors
 statement error 42000!SELECT: no such binary operator 
'scale_up'(decimal,tinyint)
 select scale_up(12.1, 10)
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022

2022-04-08 Thread Pedro Ferreira
Changeset: 94d45b99eff7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/94d45b99eff7
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
testing/Mtest.py.in
Branch: default
Log Message:

Merged with Jan2022


diffs (truncated from 449 to 300 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -559,9 +559,51 @@ timestamp_delta( sql_trans *tr, sql_delt
return d;
 }
 
+static sql_table *
+find_tmp_table(sql_trans *tr, sql_table *t)
+{
+   assert(isGlobal(t));
+   assert(tr->tmp == t->s);
+   node *n = cs_find_id(>localtmps, t->base.id);
+   sql_table *lt = NULL;
+
+   if (n)
+   lt = (sql_table*)n->data;
+   if (!lt) {
+   lt = globaltmp_instantiate(tr, t);
+   /* TODO prepend to not mark as new */
+   if (lt)
+   cs_add(>localtmps, lt, true);
+   }
+   return lt;
+}
+
+static sql_column *
+find_tmp_column(sql_trans *tr, sql_column *c)
+{
+   assert(isGlobal(c->t));
+   sql_table *lt = find_tmp_table(tr, c->t);
+   if (lt)
+   return find_sql_column(lt, c->base.name);
+   return NULL;
+}
+
+static sql_idx *
+find_tmp_idx(sql_trans *tr, sql_idx *i)
+{
+   assert(isGlobal(i->t));
+   sql_table *lt = find_tmp_table(tr, i->t);
+   if (lt)
+   return find_sql_idx(lt, i->base.name);
+   return NULL;
+}
+
 static sql_delta *
 temp_col_timestamp_delta( sql_trans *tr, sql_column *c)
 {
+   if (isGlobal(c->t))
+   c = find_tmp_column(tr, c);
+   assert (!isGlobal(c->t));
assert(isTempTable(c->t));
sql_delta *d = temp_delta(ATOMIC_PTR_GET(>data), tr->tid);
if (!d) {
@@ -620,6 +662,9 @@ timestamp_storage( sql_trans *tr, storag
 static storage *
 temp_tab_timestamp_storage( sql_trans *tr, sql_table *t)
 {
+   if (isGlobal(t))
+   t = find_tmp_table(tr, t);
+   assert(!isGlobal(t));
assert(isTempTable(t));
storage *d = temp_storage(ATOMIC_PTR_GET(>data), tr->tid);
if (!d) {
@@ -908,7 +953,7 @@ older_delta( sql_delta *d, sql_trans *tr
 }
 
 static BAT *
-bind_ubat(sql_trans *tr, sql_delta *d, int access, int type, size_t cnt)
+bind_ubat(sql_trans *tr, sql_delta *d, bool temp, int access, int type, size_t 
cnt)
 {
assert(tr->active);
sql_delta *o = NULL;
@@ -922,22 +967,24 @@ bind_ubat(sql_trans *tr, sql_delta *d, i
return NULL;
}
}
-   while ((o = older_delta(d, tr)) != NULL) {
-   BAT *oui = NULL, *ouv = NULL;
-   if (!oui)
-   oui = cs_bind_ubat(>cs, RD_UPD_ID, type, cnt);
-   if (access == RD_UPD_VAL)
-   ouv = cs_bind_ubat(>cs, RD_UPD_VAL, type, cnt);
-   if (!ui || !oui || (access == RD_UPD_VAL && (!uv || !ouv))) {
-   bat_destroy(ui);
-   bat_destroy(uv);
-   bat_destroy(oui);
-   bat_destroy(ouv);
-   return NULL;
+   if (!temp) {
+   while ((o = older_delta(d, tr)) != NULL) {
+   BAT *oui = NULL, *ouv = NULL;
+   if (!oui)
+   oui = cs_bind_ubat(>cs, RD_UPD_ID, type, 
cnt);
+   if (access == RD_UPD_VAL)
+   ouv = cs_bind_ubat(>cs, RD_UPD_VAL, type, 
cnt);
+   if (!ui || !oui || (access == RD_UPD_VAL && (!uv || 
!ouv))) {
+   bat_destroy(ui);
+   bat_destroy(uv);
+   bat_destroy(oui);
+   bat_destroy(ouv);
+   return NULL;
+   }
+   if ((ui = merge_updates(ui, , oui, ouv)) == NULL)
+   return NULL;
+   d = o;
}
-   if ((ui = merge_updates(ui, , oui, ouv)) == NULL)
-   return NULL;
-   d = o;
}
if (uv) {
bat_destroy(ui);
@@ -962,7 +1009,7 @@ bind_ucol(sql_trans *tr, sql_column *c, 
 
type = b->ttype;
}
-   BAT *bn = bind_ubat(tr, d, access, type, cnt);
+   BAT *bn = bind_ubat(tr, d, isTempTable(c->t), access, type, cnt);
unlock_column(tr->store, c->base.id);
return bn;
 }
@@ -978,7 +1025,7 @@ bind_uidx(sql_trans *tr, sql_idx * i, in
unlock_column(tr->store, i->base.id);
return NULL;
}
-   BAT *bn = bind_ubat(tr, d, access, type, cnt);
+   BAT *bn = bind_ubat(tr, d, isTempTable(i->t), access, type, cnt);
unlock_column(tr->store, i->base.id);
return bn;
 }
@@ 

MonetDB: default - Merged branch join-idx-improvements into defa...

2022-04-06 Thread Sjoerd Mullender
Changeset: 17a236c4bfce for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/17a236c4bfce
Branch: default
Log Message:

Merged branch join-idx-improvements into default.


diffs (83 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4093,20 +4093,37 @@ insert_check_fkey(backend *be, list *ins
sql_subtype *bt = sql_bind_localtype("bit");
sql_subfunc *ne = sql_bind_func_result(sql, "sys", "<>", F_FUNC, true, 
bt, 2, lng, lng);
 
+stmt *nonil_rows = NULL;
for (node *m = k->columns->h; m; m = m->next) {
sql_kc *c = m->data;
 
/* foreach column add predicate */
stmt_add_column_predicate(be, c->c);
-   }
-
-   if (pin && list_length(pin->op4.lval))
+   
+// foreach column aggregate the nonil (literally 'null') values.
+// mind that null values are valid fkeys with undefined value so
+// we won't have an entry for them in the idx_inserts col
+   s = list_fetch(inserts, c->c->colnr);
+   nonil_rows = stmt_selectnonil(be, s, nonil_rows);
+   }
+
+   if (!s && pin && list_length(pin->op4.lval))
s = pin->op4.lval->h->data;
+
+// we want to make sure that the data column(s) has the same number
+// of (nonil) rows as the index column. if that is **not** the case
+// then we are obviously dealing with an invalid foreign key 
if (s->key && s->nrcols == 0) {
-   s = stmt_binop(be, stmt_aggr(be, idx_inserts, NULL, NULL, cnt, 
1, 0, 1), stmt_atom_lng(be, 1), NULL, ne);
+   s = stmt_binop(be, 
+   stmt_aggr(be, idx_inserts, NULL, NULL, cnt, 1, 1, 1), 
+   stmt_aggr(be, const_column(be, nonil_rows), NULL, NULL, 
cnt, 1, 1, 1), 
+   NULL, ne);
} else {
-   /* releqjoin.count <> inserts[col1].count */
-   s = stmt_binop(be, stmt_aggr(be, idx_inserts, NULL, NULL, cnt, 
1, 0, 1), stmt_aggr(be, column(be, s), NULL, NULL, cnt, 1, 0, 1), NULL, ne);
+   /* relThetaJoin.notNull.count <> inserts[notNull(col1) && ... 
&& notNull(colN)].count */
+   s = stmt_binop(be, 
+   stmt_aggr(be, idx_inserts, NULL, NULL, cnt, 1, 1, 1), 
+   stmt_aggr(be, column(be, nonil_rows), NULL, NULL, cnt, 
1, 1, 1), 
+   NULL, ne);
}
 
/* s should be empty */
diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -142,11 +142,14 @@ static sql_rel *
 rel_insert_join_idx(mvc *sql, const char* alias, sql_idx *i, sql_rel *inserts)
 {
char *iname = sa_strconcat( sql->sa, "%", i->base.name);
-   int need_nulls = 0;
node *m, *o;
sql_trans *tr = sql->session->tr;
sql_key *rk = (sql_key*)os_find_id(tr->cat->objects, tr, 
((sql_fkey*)i->key)->rkey);
sql_rel *rt = rel_basetable(sql, rk->t, rk->t->base.name);
+   int selfref = (rk->t->base.id == i->t->base.id);
+   int need_nulls = 0;
+   if (selfref)
+   TRC_DEBUG(SQL_TRANS, "Self-reference index\n");
 
sql_subtype *bt = sql_bind_localtype("bit");
sql_subfunc *or = sql_bind_func_result(sql, "sys", "or", F_FUNC, true, 
bt, 2, bt, bt);
@@ -162,6 +165,7 @@ rel_insert_join_idx(mvc *sql, const char
if (c->c->null)
need_nulls = 1;
}
+   need_nulls = 0;
/* NULL and NOT NULL, for 'SIMPLE MATCH' semantics */
/* AND joins expressions */
for (m = i->columns->h, o = rk->columns->h; m && o; m = m->next, o = 
o->next) {
@@ -213,7 +217,7 @@ rel_insert_join_idx(mvc *sql, const char
}
 
pexps = rel_projections(sql, nnlls, NULL, 1, 1);
-   nnlls = rel_crossproduct(sql->sa, nnlls, rt, op_join);
+   nnlls = rel_crossproduct(sql->sa, nnlls, rt, op_left/*op_join*/);
nnlls->exps = join_exps;
nnlls = rel_project(sql->sa, nnlls, pexps);
/* add row numbers */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022

2022-03-31 Thread Pedro Ferreira
Changeset: 569e990addc1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/569e990addc1
Modified Files:
gdk/gdk_batop.c
gdk/gdk_heap.c
sql/server/rel_select.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
sql/test/BugTracker-2022/Tests/All
sql/test/miscellaneous/Tests/simple_selects.test
Branch: default
Log Message:

Merged with Jan2022


diffs (truncated from 442 to 300 lines):

diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -349,8 +349,6 @@ append_varsized_bat(BAT *b, BATiter *ni,
/* if b is still empty, in the transient farm, and n
 * is read-only, we replace b's vheap with a reference
 * to n's */
-   /* make sure locking happens in a predictable order:
-* lowest id first */
MT_lock_set(>theaplock);
if (b->tvheap->parentid != b->batCacheid)
BBPunshare(b->tvheap->parentid);
@@ -417,6 +415,30 @@ append_varsized_bat(BAT *b, BATiter *ni,
MT_lock_unset(>theaplock);
HEAPdecref(oh, false);
}
+   if (BATcount(b) == 0 && BATatoms[b->ttype].atomFix == NULL &&
+   ci->tpe == cand_dense && ci->ncand == ni->count) {
+   /* just copy the heaps */
+   if (HEAPgrow(>theaplock, >tvheap, ni->vhfree, false) != 
GDK_SUCCEED)
+   return GDK_FAIL;
+   memcpy(b->theap->base, ni->base, ni->hfree);
+   memcpy(b->tvheap->base, ni->vh->base, ni->vhfree);
+   b->theap->free = ni->hfree;
+   b->tvheap->free = ni->vhfree;
+   BATsetcount(b, ni->count);
+   b->tnil = ni->nil;
+   b->tnonil = ni->nonil;
+   b->tsorted = ni->sorted;
+   b->tnosorted = ni->b->tnosorted;
+   b->trevsorted = ni->revsorted;
+   b->tnorevsorted = ni->b->tnorevsorted;
+   b->tkey = ni->key;
+   b->tnokey[0] = ni->b->tnokey[0];
+   b->tnokey[1] = ni->b->tnokey[1];
+   b->tminpos = ni->minpos;
+   b->tmaxpos = ni->maxpos;
+   b->tunique_est = ni->unique_est;
+   return GDK_SUCCEED;
+   }
/* copy data from n to b */
r = BATcount(b);
MT_rwlock_wrlock(>thashlock);
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -1098,7 +1098,11 @@ HEAP_malloc(BAT *b, size_t nbytes)
size_t newsize;
 
assert(heap->free + MAX(heap->free, nbytes) <= VAR_MAX);
+#if SIZEOF_SIZE_T == 4
newsize = MIN(heap->free, (size_t) 1 << 20);
+#else
+   newsize = MIN(heap->free, (size_t) 1 << 30);
+#endif
newsize = (size_t) roundup_8(heap->free + MAX(newsize, nbytes));
assert(heap->free <= VAR_MAX);
block = (size_t) heap->free;/* current end-of-heap */
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
@@ -1141,9 +1141,14 @@ rel_column_ref(sql_query *query, sql_rel
if (!exp && inner)
if (!(exp = rel_bind_column(sql, inner, name, f, 0)) && 
sql->session->status == -ERR_AMBIGUOUS)
return NULL;
-   if (!exp && inner && is_sql_aggr(f) && is_groupby(inner->op))
-   if (!(exp = rel_bind_column(sql, inner->l, name, f, 0)) 
&& sql->session->status == -ERR_AMBIGUOUS)
+   if (!exp && inner && is_sql_aggr(f) && (is_groupby(inner->op) 
|| is_select(inner->op))) {
+   /* if inner is selection, ie having clause, get the 
left relation to reach group by */
+   sql_rel *gp = inner;
+   while (gp && is_select(gp->op))
+   gp = gp->l;
+   if (gp && gp->l && !(exp = rel_bind_column(sql, gp->l, 
name, f, 0)) && sql->session->status == -ERR_AMBIGUOUS)
return NULL;
+   }
if (!exp && query && query_has_outer(query)) {
int i;
 
@@ -1226,9 +1231,14 @@ rel_column_ref(sql_query *query, sql_rel
if (!exp && rel && inner)
if (!(exp = rel_bind_column2(sql, inner, tname, cname, 
f)) && sql->session->status == -ERR_AMBIGUOUS)
return NULL;
-   if (!exp && inner && is_sql_aggr(f) && is_groupby(inner->op))
-   if (!(exp = rel_bind_column2(sql, inner->l, tname, 
cname, f)) && sql->session->status == -ERR_AMBIGUOUS)
+   if (!exp && inner && is_sql_aggr(f) && (is_groupby(inner->op) 
|| is_select(inner->op))) {
+   /* if inner is selection, ie having clause, get the 
left relation to reach group by */
+ 

MonetDB: default - Merged with Jan2022

2022-03-22 Thread Pedro Ferreira
Changeset: 811bfa374343 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/811bfa374343
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

Merged with Jan2022


diffs (20 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -758,3 +758,4 @@ 00463fdd0d51d7ce058549a82bc74efaea6035a2
 db3cec8ea853884e857fcfb413428116cb95e786 Jul2021_17
 8c015afafb5903ea59b0e2cffac1138a0d82e007 Jul2021_19
 8c015afafb5903ea59b0e2cffac1138a0d82e007 Jul2021_SP4_release
+cab90a348501b045e19cee5cebcc44f3800bd0a8 Jul2021_21
diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py
--- a/NT/mkodbcwxs.py
+++ b/NT/mkodbcwxs.py
@@ -90,7 +90,7 @@ def main():
vcpkg.format(r'bin\bz2.dll'),
vcpkg.format(r'bin\charset-1.dll'), # for iconv-2.dll
vcpkg.format(r'bin\lz4.dll'),
-   vcpkg.format(r'bin\lzma.dll'),
+   vcpkg.format(r'bin\liblzma.dll'),
vcpkg.format(r'bin\zlib1.dll')])
 print(r'')
 id = comp(features, id, 12,
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged sqloptimizer into default

2022-03-21 Thread Pedro Ferreira
Changeset: 8de8eb82145c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/8de8eb82145c
Modified Files:
sql/server/sql_mvc.c
Branch: default
Log Message:

Merged sqloptimizer into default


diffs (truncated from 19893 to 300 lines):

diff --git a/sql/backends/monet5/CMakeLists.txt 
b/sql/backends/monet5/CMakeLists.txt
--- a/sql/backends/monet5/CMakeLists.txt
+++ b/sql/backends/monet5/CMakeLists.txt
@@ -32,7 +32,6 @@ set(sql_public_headers
   $
   $
   $
-  $
   $
   $
   $
@@ -66,7 +65,6 @@ set(sql_public_headers
   $
   $
   $
-  $
   $
   $
   $
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
@@ -3904,7 +3904,7 @@ sql_parse(backend *be, sql_schema *s, co
sql_rel *rel = rel_parse(be->mvc, s, query, mode);
stmt *sq = NULL;
 
-   if (rel && (rel = sql_processrelation(be->mvc, rel, 1, 1, 1)))
+   if (rel && (rel = sql_processrelation(be->mvc, rel, 0, 1, 1, 1)))
sq = rel_bin(be, rel);
return sq;
 }
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -123,11 +123,12 @@ sql_symbol2relation(backend *be, symbol 
sql_query *query = query_create(be->mvc);
lng Tbegin;
int extra_opts = be->mvc->emode != m_prepare;
+   int profile = be->mvc->emode == m_plan;
 
rel = rel_semantic(query, sym);
Tbegin = GDKusec();
if (rel)
-   rel = sql_processrelation(be->mvc, rel, 1, extra_opts, 
extra_opts);
+   rel = sql_processrelation(be->mvc, rel, profile, 1, extra_opts, 
extra_opts);
if (rel)
rel = rel_partition(be->mvc, rel);
if (rel && (rel_no_mitosis(be->mvc, rel) || 
rel_need_distinct_query(rel)))
@@ -148,6 +149,7 @@ sqlcleanup(backend *be, int err)
 
/* some statements dynamically disable caching */
be->mvc->sym = NULL;
+   be->mvc->runs = NULL;
if (be->mvc->ta)
be->mvc->ta = sa_reset(be->mvc->ta);
if (be->mvc->sa)
@@ -450,7 +452,7 @@ create_table_or_view(mvc *sql, char *sna
 
r = rel_parse(sql, s, nt->query, m_deps);
if (r)
-   r = sql_processrelation(sql, r, 0, 0, 0);
+   r = sql_processrelation(sql, r, 0, 0, 0, 0);
if (r) {
list *blist = rel_dependencies(sql, r);
if (mvc_create_dependencies(sql, blist, nt->base.id, 
VIEW_DEPENDENCY)) {
diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c
--- a/sql/backends/monet5/sql_cat.c
+++ b/sql/backends/monet5/sql_cat.c
@@ -571,7 +571,7 @@ create_trigger(mvc *sql, char *sname, ch
}
r = rel_parse(sql, s, buf, m_deps);
if (r)
-   r = sql_processrelation(sql, r, 0, 0, 0);
+   r = sql_processrelation(sql, r, 0, 0, 0, 0);
if (r) {
list *blist = rel_dependencies(sql, r);
if (mvc_create_dependencies(sql, blist, 
tri->base.id, TRIGGER_DEPENDENCY)) {
@@ -1060,7 +1060,7 @@ create_func(mvc *sql, char *sname, char 
}
r = rel_parse(sql, s, buf, m_deps);
if (r)
-   r = sql_processrelation(sql, r, 0, 0, 0);
+   r = sql_processrelation(sql, r, 0, 0, 0, 0);
if (r) {
node *n;
list *blist = rel_dependencies(sql, r);
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -530,6 +530,7 @@ SQLstatementIntern(Client c, const char 
/* passed over to query cache, used during dumpproc */
m->sa = NULL;
m->sym = NULL;
+   m->runs = NULL;
m->params = NULL;
/* register name in the namespace */
if (be->q) {
@@ -632,6 +633,7 @@ endofcompile:
sa_destroy(m->sa);
m->sa = NULL;
m->sym = NULL;
+   m->runs = NULL;
/* variable stack maybe resized, ie we need to keep the new stack */
label = m->label;
status = m->session->status;
@@ -775,7 +777,7 @@ RAstatement(Client c, MalBlkPtr mb, MalS
refs = sa_list(m->sa);
rel = rel_read(m, *expr, , refs);
if (*opt && rel)
-   rel = sql_processrelation(m, rel, 0, 0, 0);
+   rel = sql_processrelation(m, rel, 0, 0, 0, 0);
if (!rel) {
if (strlen(m->errstr) > 6 && m->errstr[5] == '!')
msg = createException(SQL, "RAstatement", "%s", 
m->errstr);
@@ 

MonetDB: default - Merged with Jan2022

2022-03-18 Thread Pedro Ferreira
Changeset: b729c688d7d7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b729c688d7d7
Modified Files:
gdk/gdk_bbp.c
Branch: default
Log Message:

Merged with Jan2022


diffs (51 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1878,7 +1878,7 @@ heap_entry(FILE *fp, BATiter *bi, BUN si
   b->tvarsized,
   (unsigned short) b->tsorted |
   ((unsigned short) b->trevsorted << 7) |
-  (((unsigned short) b->tkey & 0x01) << 8) |
+  ((unsigned short) b->tkey << 8) |
   ((unsigned short) BATtdense(b) << 9) |
   ((unsigned short) b->tnonil << 10) |
   ((unsigned short) b->tnil << 11),
diff --git a/sql/backends/monet5/generator/generator.c 
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -419,7 +419,7 @@ VLTgenerator_subselect(Client cntxt, Mal
}
if (cand)
BBPunfix(cand->batCacheid);
-   BATsetcount(bn, (BUN) n);
+   BATsetcount(bn, n);
bn->tsorted = true;
bn->trevsorted = BATcount(bn) <= 1;
bn->tkey = true;
@@ -567,11 +567,11 @@ VLTgenerator_subselect(Client cntxt, Mal
 
 str VLTgenerator_thetasubselect(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
-   int c= 0, anti =0,tpe;
+   int anti =0,tpe;
bat cndid =0;
BAT *cand = 0, *bn = NULL;
struct canditer ci = (struct canditer) {.tpe = cand_dense};
-   BUN cap,j;
+   BUN cap,j, c = 0;
oid o = 0;
InstrPtr p;
str oper;
@@ -741,10 +741,10 @@ str VLTgenerator_thetasubselect(Client c
 
 str VLTgenerator_projection(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
-   int c= 0, tpe;
+   int tpe;
bat *ret;
BAT *b, *bn = NULL;
-   BUN cnt;
+   BUN cnt, c = 0;
oid *ol = NULL, o= 0;
InstrPtr p;
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2022-03-14 Thread Niels Nes
Changeset: 2d4810d81cc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2d4810d81cc6
Branch: default
Log Message:

merged


diffs (truncated from 852 to 300 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -62,12 +62,12 @@ mapiportre = re.compile(r'mapi:monetdb:/
 geos_version = '@GEOS_VERSION@'.split('.')
 
 # default is no color (these three functions may get redefined)
-def prred(str, write = sys.stdout.write):
-write(str)
-def prgreen(str, write = sys.stdout.write):
-write(str)
-def prpurple(str, write = sys.stdout.write):
-write(str)
+def prred(str):
+print(str, end='')
+def prgreen(str):
+print(str, end='')
+def prpurple(str):
+print(str, end='')
 if isatty:
 if os.name != 'nt':
 # color output a little
@@ -75,24 +75,24 @@ if isatty:
 GREEN = '\033[0;32m'
 PURPLE = '\033[1;35m'   # actually magenta
 BLACK = '\033[0;0m'
-def prred(str, write = sys.stdout.write):
+def prred(str):
 try:
-write(RED)
-write(str)
+print(RED, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prgreen(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prgreen(str):
 try:
-write(GREEN)
-write(str)
+print(GREEN, end='')
+print(str, end='')
 finally:
-write(BLACK)
-def prpurple(str, write = sys.stdout.write):
+print(BLACK, end='')
+def prpurple(str):
 try:
-write(PURPLE)
-write(str)
+print(PURPLE, end='')
+print(str, end='')
 finally:
-write(BLACK)
+print(BLACK, end='')
 else:
 try:
 import ctypes
@@ -115,36 +115,27 @@ if isatty:
 return wattr
 reset = get_csbi_attributes(handle)
 def prred(str,
-  write=sys.stdout.write,
-  flush=sys.stdout.flush,
   scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x4)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prgreen(str,
-write=sys.stdout.write,
-flush=sys.stdout.flush,
 
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x2)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 def prpurple(str,
- write=sys.stdout.write,
- flush=sys.stdout.flush,
  
scta=ctypes.windll.kernel32.SetConsoleTextAttribute):
 try:
-flush()
+print(end='', flush=True)
 scta(handle, 0x5)
-write(str)
-flush()
+print(str, end='', flush=True)
 finally:
 scta(handle, reset)
 
@@ -166,7 +157,7 @@ if os.path.exists('/usr/bin/coredumpctl'
 pass
 
 def ErrExit(msg):
-sys.stderr.write(msg + '\n')
+print(msg, file=sys.stderr, flush=True)
 sys.exit(1)
 
 def _configure(str):
@@ -581,8 +572,6 @@ class Timer:
 self.timer.cancel()
 self.timer = None
 
-STDOUT = sys.stdout
-STDERR = sys.stdout # err
 REV = ''# revision (output of hg id), default unknown
 
 black = 'black' # #00
@@ -622,9 +611,8 @@ random.seed(time.time())
  AlarmHandler(signum, frame) #
 
 def ErrMsg(TEXT) :
-STDOUT.flush()
-STDERR.write("\n%s:  ERROR:  %s\n\n" % (THISFILE, TEXT))
-STDERR.flush()
+print(end='', flush=True)
+print("\n%s:  ERROR:  %s\n" % (THISFILE, TEXT), file=sys.stderr, 
flush=True)
 ### ErrMsg(TEXT) #
 
 def ErrXit(TEXT) :
@@ -634,12 +622,11 @@ def ErrXit(TEXT) :
 
 def Warn(TEXT) :
 try:
-STDOUT.flush()
+print(end='', flush=True)
 except IOError:
 pass
 try:
-STDERR.write("\n%s  Warning:  %s\n\n" % (THISFILE, TEXT))
-STDERR.flush()
+print("\n%s  Warning:  %s\n" % 

MonetDB: default - Merged with Jan2022

2022-03-10 Thread Pedro Ferreira
Changeset: 3a8b7121fb92 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3a8b7121fb92
Modified Files:
sql/server/rel_exp.c
sql/test/prepare/Tests/sqlancer_prepare.sql
sql/test/prepare/Tests/sqlancer_prepare.stable.out
sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
Branch: default
Log Message:

Merged with Jan2022


diffs (226 lines):

diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022
--- a/gdk/ChangeLog.Jan2022
+++ b/gdk/ChangeLog.Jan2022
@@ -5,7 +5,7 @@
 - Fixed a bug in the append code for msk (bit mask) bats.
 - Conversions from floating point types to integral types that involve
   multiplication now use the "long double" as intermediate type, thereby
-  using as few significant bits as is feasible.
+  loosing as few significant bits as is feasible.
 - Found and fixed another source for the now infamous BBPcheckbats error
   that sometimes occurs at startup of the server.
 
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -3035,15 +3035,11 @@ set_exp_type(mvc *sql, sql_subtype *type
(void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
return -1;
}
-   if (e->tpe.type)
-   return 0;
-
if (e->type == e_column) {
const char *nrname = (const char*) e->l, *nename = (const 
char*) e->r;
/* find all the column references and set the type */
-   if (rel_find_parameter(sql, type, rel, nrname, nename) < 0)
-   return -1;
e->tpe = *type;
+   return rel_find_parameter(sql, type, rel, nrname, nename);
} else if (e->type == e_atom && e->f) {
list *atoms = e->f;
if (!list_empty(atoms))
@@ -3051,10 +3047,10 @@ set_exp_type(mvc *sql, sql_subtype *type
if (set_exp_type(sql, type, rel, n->data) < 0) 
/* set recursively */
return -1;
e->tpe = *type;
+   return 1; /* on a list of atoms, everything should be found */
} else if (e->type == e_atom && !e->l && !e->r && !e->f) {
-   if (set_type_param(sql, type, e->flag) != 0)
-   return -1;
e->tpe = *type;
+   return set_type_param(sql, type, e->flag) == 0 ? 1 : 0;
} else if (exp_is_rel(e)) { /* for relation expressions, restart cycle 
*/
rel = (sql_rel*) e->l;
/* limiting to these cases */
@@ -3062,9 +3058,8 @@ set_exp_type(mvc *sql, sql_subtype *type
return 0;
sql_exp *re = rel->exps->h->data;
 
-   if (set_exp_type(sql, type, rel, re) < 0) /* set recursively */
-   return -1;
e->tpe = *type;
+   return set_exp_type(sql, type, rel, re); /* set recursively */
}
return 0;
 }
@@ -3072,10 +3067,7 @@ set_exp_type(mvc *sql, sql_subtype *type
 int
 rel_set_type_param(mvc *sql, sql_subtype *type, sql_rel *rel, sql_exp *exp, 
int upcast)
 {
-   sql_exp *e = exp;
-   int is_rel = exp_is_rel(exp);
-
-   if (!type || !exp || (exp->type != e_atom && exp->type != e_column && 
!is_rel))
+   if (!type || !exp || (exp->type != e_atom && exp->type != e_column && 
!exp_is_rel(exp)))
return -1;
 
/* use largest numeric types */
@@ -3088,7 +3080,7 @@ rel_set_type_param(mvc *sql, sql_subtype
else if (upcast && type->type->eclass == EC_FLT)
type = sql_bind_localtype("dbl");
 
-   return set_exp_type(sql, type, rel, e);
+   return set_exp_type(sql, type, rel, exp);
 }
 
 /* try to do an in-place conversion
@@ -3240,9 +3232,12 @@ exp_values_set_supertype(mvc *sql, sql_e
return values;
 }
 
+/* return -1 on error, 0 not found, 1 found */
 static int
 rel_find_parameter(mvc *sql, sql_subtype *type, sql_rel *rel, const char 
*relname, const char *expname)
 {
+   int res = 0;
+
if (mvc_highwater(sql)) {
(void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
return -1;
@@ -3260,7 +3255,7 @@ rel_find_parameter(mvc *sql, sql_subtype
e = exps_bind_column(rel->exps, nename, NULL, NULL, 1);
}
if (!e)
-   return 0;
+   return 0; /* not found */
/* set order by column types */
if (is_simple_project(rel->op) && !list_empty(rel->r)) {
sql_exp *ordere = NULL;
@@ -3276,8 +3271,9 @@ rel_find_parameter(mvc *sql, sql_subtype
nrname = (const char*) e->l;
nename = (const char*) e->r;
e->tpe = *type;
-   } else if ((e->type == e_atom || exp_is_rel(e)) && 

MonetDB: default - Merged with Jan2022

2022-03-10 Thread Pedro Ferreira
Changeset: b11559466301 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b11559466301
Modified Files:
.bumpversion.cfg
MonetDB.spec
clients/mapilib/mapi.rc
clients/odbc/driver/driver.rc
clients/odbc/winsetup/setup.rc
cmake/monetdb-versions.cmake
gdk/gdk_calc.c
gdk/gdk_calc_private.h
gdk/libbat.rc
monetdb5/tools/libmonetdb5.rc
Branch: default
Log Message:

Merged with Jan2022


diffs (58 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -755,3 +755,4 @@ f458e1c71c73d6bd9636369c1406eadb74f016bf
 f458e1c71c73d6bd9636369c1406eadb74f016bf Jan2022_SP1_release
 00463fdd0d51d7ce058549a82bc74efaea6035a2 Jul2021_15
 00463fdd0d51d7ce058549a82bc74efaea6035a2 Jul2021_SP3_release
+db3cec8ea853884e857fcfb413428116cb95e786 Jul2021_17
diff --git a/clients/ChangeLog.Jan2022 b/clients/ChangeLog.Jan2022
--- a/clients/ChangeLog.Jan2022
+++ b/clients/ChangeLog.Jan2022
@@ -2,9 +2,9 @@
 # This file is updated with Maddlog
 
 * Wed Feb 16 2022 Sjoerd Mullender 
-- Improved the handling of the \r command in mclient.  It now properly
-  counts the header of table, and when a (very) long table is being
-  printed and aborted part way in the built-in pager, not all data is
-  transferred to the client (and then discarded).  Instead at most 1000
-  rows are transferred.
+- Improved the handling of the \r (internal pager) command in mclient.
+  It now properly counts the header of table, and when a (very) long
+  table is being printed and aborted part way in the built-in pager, not
+  all data is transferred to the client (and then discarded).  Instead
+  at most 1000 rows are transferred.
 
diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022
--- a/gdk/ChangeLog.Jan2022
+++ b/gdk/ChangeLog.Jan2022
@@ -1,3 +1,11 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Wed Mar  9 2022 Sjoerd Mullender 
+- Fixed a bug in the append code for msk (bit mask) bats.
+- Conversions from floating point types to integral types that involve
+  multiplication now use the "long double" as intermediate type, thereby
+  using as few significant bits as is feasible.
+- Found and fixed another source for the now infamous BBPcheckbats error
+  that sometimes occurs at startup of the server.
+
diff --git a/gdk/gdk_calc_private.h b/gdk/gdk_calc_private.h
--- a/gdk/gdk_calc_private.h
+++ b/gdk/gdk_calc_private.h
@@ -666,13 +666,6 @@ typedef long double ldouble;
 #ifdef TRUNCATE_NUMBERS
 #define rounddbl(x)(x)
 #else
-#ifdef HAVE_HGE
-/* can't round to hge via lng since we might loose significant bits, so
- * just keep it long double */
 #define rounddbl(x)roundl(x)
-#else
-/* round long double to long long int in one go */
-#define rounddbl(x)llroundl(x)
 #endif
 #endif
-#endif
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2022-03-08 Thread Niels Nes
Changeset: 97accbdb33ab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/97accbdb33ab
Modified Files:
sql/server/rel_unnest.c
Branch: default
Log Message:

merged


diffs (38 lines):

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
@@ -2050,7 +2050,7 @@ rel_in_value_exp(sql_query *query, sql_r
}
}
if (!e) {
-   if (add_select && rel && *rel && 
!is_project((*rel)->op) && !is_select((*rel)->op))
+   if (add_select && rel && *rel && 
!is_project((*rel)->op) && !is_select((*rel)->op) && !is_base((*rel)->op))
*rel = rel_select(sql->sa, *rel, NULL);
e = exp_in_func(sql, le, values, (sc->token == SQL_IN), 
is_tuple);
}
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -1522,9 +1522,7 @@ push_up_set(mvc *sql, sql_rel *rel, list
set_processed(ns);
if (single || is_single(s))
set_single(ns);
-   if (need_distinct(s))
-   set_distinct(ns);
-   if (need_distinct)
+   if (need_distinct || need_distinct(s))
set_distinct(ns);
 
if (is_join(rel->op)) {
diff --git a/sql/test/subquery/Tests/subquery6.test 
b/sql/test/subquery/Tests/subquery6.test
--- a/sql/test/subquery/Tests/subquery6.test
+++ b/sql/test/subquery/Tests/subquery6.test
@@ -407,7 +407,7 @@ select 1 = any(ColID), max(totalsales) f
 statement error 42000!SELECT: cannot use non GROUP BY column 
'tbl_productsales.colid' in query results without an aggregate function
 select 1 in (ColID), max(totalsales) from tbl_ProductSales
 
-statement error 42000!SELECT: cannot use non GROUP BY column in query results 
without an aggregate function
+statement error 42000!SELECT: cannot use non GROUP BY column 
'tbl_productsales.colid' in query results without an aggregate function
 select 1 in (ColID, (select 1)), max(totalsales) from tbl_ProductSales
 
 statement error 42000!Tuple matching at projections not implemented in the 
backend yet
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022

2022-03-07 Thread Pedro Ferreira
Changeset: 88b72f1f0c74 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/88b72f1f0c74
Modified Files:
sql/storage/store.c
sql/test/BugTracker-2022/Tests/All
Branch: default
Log Message:

Merged with Jan2022


diffs (78 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -5784,6 +5784,7 @@ create_sql_ic(sqlstore *store, sql_alloc
 sql_idx *
 create_sql_idx_done(sql_trans *tr, sql_idx *i)
 {
+   (void) tr;
if (i && i->key && hash_index(i->type)) {
int ncols = list_length(i->columns);
for (node *n = i->columns->h ; n ; n = n->next) {
@@ -5792,9 +5793,6 @@ create_sql_idx_done(sql_trans *tr, sql_i
kc->c->unique = (ncols == 1) ? 2 : MAX(kc->c->unique, 
1);
}
}
-   /* should we switch to oph_idx ? */
-   if (i->type == hash_idx && list_length(i->columns) == 1 && 
sql_trans_is_sorted(tr, ((sql_kc*)i->columns->h->data)->c))
-   i->type = no_idx;
return i;
 }
 
diff --git a/sql/test/BugTracker-2022/Tests/All 
b/sql/test/BugTracker-2022/Tests/All
--- a/sql/test/BugTracker-2022/Tests/All
+++ b/sql/test/BugTracker-2022/Tests/All
@@ -4,3 +4,4 @@ insert-not-null.Bug-7232
 recreate-view.Bug-7241
 HAVE_LIBPY3?python-udf-inside-udf.Bug-7252
 empty-MAL.Bug-7259
+pkey-restart.Bug-7263
diff --git a/sql/test/BugTracker-2022/Tests/pkey-restart.Bug-7263.SQL.py 
b/sql/test/BugTracker-2022/Tests/pkey-restart.Bug-7263.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2022/Tests/pkey-restart.Bug-7263.SQL.py
@@ -0,0 +1,29 @@
+import os, tempfile
+
+try:
+from MonetDBtesting import process
+except ImportError:
+import process
+from MonetDBtesting.sqltest import SQLTestCase
+
+with tempfile.TemporaryDirectory() as farm_dir:
+os.mkdir(os.path.join(farm_dir, 'db1'))
+
+with process.server(mapiport='0', dbname='db1', 
dbfarm=os.path.join(farm_dir, 'db1'), stdin = process.PIPE, stdout = 
process.PIPE, stderr = process.PIPE) as s:
+with SQLTestCase() as mdb:
+mdb.connect(database='db1', port=s.dbport, username="monetdb", 
password="monetdb")
+mdb.execute("CREATE TABLE x (k int PRIMARY KEY, v 
int);").assertSucceeded()
+mdb.execute("INSERT INTO x VALUES(1, 1);").assertSucceeded()
+mdb.execute("SELECT k, v FROM 
x;").assertSucceeded().assertDataResultMatch([(1,1)])
+mdb.execute("INSERT INTO x VALUES(1, 
2);").assertFailed(err_code="40002", err_message="INSERT INTO: PRIMARY KEY 
constraint 'x.x_k_pkey' violated")
+mdb.execute("SELECT k, v FROM 
x;").assertSucceeded().assertDataResultMatch([(1,1)])
+s.communicate()
+
+with process.server(mapiport='0', dbname='db1', 
dbfarm=os.path.join(farm_dir, 'db1'), stdin = process.PIPE, stdout = 
process.PIPE, stderr = process.PIPE) as s:
+with SQLTestCase() as mdb:
+mdb.connect(database='db1', port=s.dbport, username="monetdb", 
password="monetdb")
+mdb.execute("SELECT k, v FROM 
x;").assertSucceeded().assertDataResultMatch([(1,1)])
+mdb.execute("INSERT INTO x VALUES(1, 
2);").assertFailed(err_code="40002", err_message="INSERT INTO: PRIMARY KEY 
constraint 'x.x_k_pkey' violated")
+mdb.execute("SELECT k, v FROM 
x;").assertSucceeded().assertDataResultMatch([(1,1)])
+mdb.execute("DROP TABLE x;").assertSucceeded()
+s.communicate()
diff --git a/sql/test/prepare/Tests/prepare-insert-into.sql 
b/sql/test/prepare/Tests/prepare-insert-into.sql
--- a/sql/test/prepare/Tests/prepare-insert-into.sql
+++ b/sql/test/prepare/Tests/prepare-insert-into.sql
@@ -1,3 +1,5 @@
+START TRANSACTION;
+
 CREATE TABLE "TestBulkDataInsert" (c1 BIGINT NOT NULL PRIMARY KEY, c2 
VARCHAR(50) NOT NULL, c3 CLOB);
 
 INSERT INTO "TestBulkDataInsert" SELECT * FROM 
(VALUES(1,'1a','1b'),(2,'2a','2b'),(3,'3a','3b')) vt3(c1,c2,c3);
@@ -26,3 +28,5 @@ exec **('16a', 17, '17b');
 SELECT * FROM "TestBulkDataInsert";
 
 DROP TABLE "TestBulkDataInsert";
+
+ROLLBACK;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - merged

2022-03-04 Thread Niels Nes
Changeset: efd698743a90 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/efd698743a90
Branch: default
Log Message:

merged


diffs (14 lines):

diff --git a/sql/test/SQLancer/Tests/sqlancer23.test 
b/sql/test/SQLancer/Tests/sqlancer23.test
--- a/sql/test/SQLancer/Tests/sqlancer23.test
+++ b/sql/test/SQLancer/Tests/sqlancer23.test
@@ -79,6 +79,10 @@ query I nosort
 SELECT 1 FROM t0 FULL OUTER JOIN (SELECT 1) AS x(x) ON least(t0.c0 = 
ANY(SELECT 1 FROM t0), TRUE)
 
 
+query I nosort
+SELECT 1 FROM t0 WHERE t0.c0 = (VALUES ((SELECT t0.c0)))
+
+
 statement ok
 ROLLBACK
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Merged with Jan2022

2022-03-04 Thread Pedro Ferreira
Changeset: 253d4c864a86 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/253d4c864a86
Modified Files:
gdk/gdk_calc.c
gdk/gdk_calc_private.h
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_select.c
Branch: default
Log Message:

Merged with Jan2022


diffs (truncated from 564 to 300 lines):

diff --git a/gdk/gdk_calc_private.h b/gdk/gdk_calc_private.h
--- a/gdk/gdk_calc_private.h
+++ b/gdk/gdk_calc_private.h
@@ -659,7 +659,6 @@ typedef double ldouble;
 #ifdef TRUNCATE_NUMBERS
 #define rounddbl(x)(x)
 #else
-#define rounddbl(x)roundl(x)
 #define rounddbl(x)round(x)
 #endif
 #else
@@ -667,7 +666,13 @@ typedef long double ldouble;
 #ifdef TRUNCATE_NUMBERS
 #define rounddbl(x)(x)
 #else
+#ifdef HAVE_HGE
+/* can't round to hge via lng since we might loose significant bits, so
+ * just keep it long double */
+#define rounddbl(x)roundl(x)
+#else
 /* round long double to long long int in one go */
 #define rounddbl(x)llroundl(x)
 #endif
 #endif
+#endif
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -3023,13 +3023,56 @@ exps_reset_freevar(list *exps)
}
 }
 
-int
-rel_set_type_param(mvc *sql, sql_subtype *type, sql_rel *rel, sql_exp 
*rel_exp, int upcast)
+static int rel_find_parameter(mvc *sql, sql_subtype *type, sql_rel *rel, const 
char *relname, const char *expname);
+
+static int
+set_exp_type(mvc *sql, sql_subtype *type, sql_rel *rel, sql_exp *e)
 {
-   sql_rel *r = rel;
-   int is_rel = exp_is_rel(rel_exp);
-
-   if (!type || !rel_exp || (rel_exp->type != e_atom && rel_exp->type != 
e_column && !is_rel))
+   if (mvc_highwater(sql)) {
+   (void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
+   return -1;
+   }
+   if (e->tpe.type)
+   return 0;
+
+   if (e->type == e_column) {
+   const char *nrname = (const char*) e->l, *nename = (const 
char*) e->r;
+   /* find all the column references and set the type */
+   if (rel_find_parameter(sql, type, rel, nrname, nename) < 0)
+   return -1;
+   e->tpe = *type;
+   } else if (e->type == e_atom && e->f) {
+   list *atoms = e->f;
+   if (!list_empty(atoms))
+   for (node *n = atoms->h; n; n = n->next)
+   if (set_exp_type(sql, type, rel, n->data) < 0) 
/* set recursively */
+   return -1;
+   e->tpe = *type;
+   } else if (e->type == e_atom && !e->l && !e->r && !e->f) {
+   if (set_type_param(sql, type, e->flag) != 0)
+   return -1;
+   e->tpe = *type;
+   } else if (exp_is_rel(e)) { /* for relation expressions, restart cycle 
*/
+   rel = (sql_rel*) e->l;
+   /* limiting to these cases */
+   if (!is_project(rel->op) || list_length(rel->exps) != 1)
+   return 0;
+   sql_exp *re = rel->exps->h->data;
+
+   if (set_exp_type(sql, type, rel, re) < 0) /* set recursively */
+   return -1;
+   e->tpe = *type;
+   }
+   return 0;
+}
+
+int
+rel_set_type_param(mvc *sql, sql_subtype *type, sql_rel *rel, sql_exp *exp, 
int upcast)
+{
+   sql_exp *e = exp;
+   int is_rel = exp_is_rel(exp);
+
+   if (!type || !exp || (exp->type != e_atom && exp->type != e_column && 
!is_rel))
return -1;
 
/* use largest numeric types */
@@ -3039,22 +3082,10 @@ rel_set_type_param(mvc *sql, sql_subtype
 #else
type = sql_bind_localtype("lng");
 #endif
-   if (upcast && type->type->eclass == EC_FLT)
+   else if (upcast && type->type->eclass == EC_FLT)
type = sql_bind_localtype("dbl");
 
-   if (is_rel)
-   r = (sql_rel*) rel_exp->l;
-
-   if ((rel_exp->type == e_atom && (rel_exp->l || rel_exp->r || 
rel_exp->f)) || rel_exp->type == e_column || is_rel) {
-   /* it's not a parameter set possible parameters below */
-   const char *relname = exp_relname(rel_exp), *expname = 
exp_name(rel_exp);
-   if (rel_set_type_recurse(sql, type, r, , ) < 0)
-   return -1;
-   } else if (set_type_param(sql, type, rel_exp->flag) != 0)
-   return -1;
-
-   rel_exp->tpe = *type;
-   return 0;
+   return set_exp_type(sql, type, rel, e);
 }
 
 /* try to do an in-place conversion
@@ -3207,199 +3238,89 @@ exp_values_set_supertype(mvc *sql, sql_e
 }
 
 static int
-exp_set_list_recurse(mvc *sql, sql_subtype *type, sql_exp *e, const char 
**relname, const char** expname)
-{
-   if (mvc_highwater(sql)) {
-   (void) sql_error(sql, 10, SQLSTATE(42000) "Query too complex: 
running out of stack space");
-   

  1   2   3   4   5   6   7   8   9   10   >