Changeset: c89b98402032 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c89b98402032
Modified Files:
        sql/common/sql_types.c
        sql/include/sql_catalog.h
        sql/server/rel_psm.c
        sql/server/rel_select.c
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/server/sql_parser.y
        sql/server/sql_scan.c
        sql/storage/sql_storage.h
        sql/test/Dependencies/Tests/dependency_owner_schema_3.test
        sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.test
Branch: clean_parser
Log Message:

merged with recursive_cte


diffs (truncated from 9422 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -835,3 +835,4 @@ dce400b68239412b1835fb28bd183bf50f5e8692
 dce400b68239412b1835fb28bd183bf50f5e8692 Aug2024_release
 ab5d60be21cd1c65e9de476d71a86c2995f70785 Aug2024_5
 ab5d60be21cd1c65e9de476d71a86c2995f70785 Aug2024_SP1_release
+30e6380820842b9e0325536eb22d7cb3843ab095 Aug2024_7
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -95,7 +95,7 @@ Group: Applications/Databases
 License: MPL-2.0
 URL: https://www.monetdb.org/
 BugURL: https://github.com/MonetDB/MonetDB/issues
-Source: 
https://www.monetdb.org/downloads/sources/Aug2024-SP1/MonetDB-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Aug2024-SP2/MonetDB-%{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
@@ -989,6 +989,26 @@ rm "${RPM_BUILD_ROOT}"%{_unitdir}/monetd
 %endif
 
 %changelog
+* Mon Dec 16 2024 Sjoerd Mullender <sjo...@acm.org> - 11.51.7-20241216
+- Rebuilt.
+- GH#7112: Need keyboard shortcut to interrupt query execution rather than
+  session
+- GH#7205: Unpredictable performance when performing joins over nested
+  queries
+- GH#7574: Assertion failure at `rel2bin_select` when using `STARTSWITH`
+- GH#7588: incorrect output with single row inputs for var_samp(c) over()
+- GH#7589: "SELECT * FROM sessions" crashes monetdb/e
+- GH#7593: A value is being returned with unnecessary scientific notation
+- GH#7595: SQLTestCase leaks pymonetdb connections
+- GH#7597: Upgrade + quick restart causes database inconsistency
+- GH#7599: str_to_date fails when combined with SQL CASE clause
+- GH#7602: COPY INTO from multiple files causes an assertion error.
+- GH#7603: COPY INTO from three or more files crashes the server.
+- GH#7604: file_loader() causes server crash when csv file contains too
+  few field separators or contains empty lines
+- GH#7607: Adding a column of serial type fails with "Access denied for
+  <user> to schema 'sys'"
+
 * Thu Oct 24 2024 Sjoerd Mullender <sjo...@acm.org> - 11.51.5-20241024
 - Rebuilt.
 - GH#7281: UDFs defined at compile time in a user schema should not become
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
@@ -1035,6 +1035,7 @@ const char grant_rolesRef[];
 const char groupRef[];
 const char groupbyRef[];
 const char groupdoneRef[];
+const char groupedfirstnRef[];
 const char growRef[];
 int hasSideEffects(MalBlkPtr mb, InstrPtr p, int strict);
 const char hgeRef[];
diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake
--- a/cmake/monetdb-versions.cmake
+++ b/cmake/monetdb-versions.cmake
@@ -44,7 +44,7 @@ set(MONETDB_VERSION "${MONETDB_VERSION_M
 # common/options and common/utils)
 set(GDK_VERSION_MAJOR "29")
 set(GDK_VERSION_MINOR "0")
-set(GDK_VERSION_PATCH "1")
+set(GDK_VERSION_PATCH "2")
 set(GDK_VERSION 
"${GDK_VERSION_MAJOR}.${GDK_VERSION_MINOR}.${GDK_VERSION_PATCH}")
 
 # version of the MAPI library (subdirectory clients/mapilib)
@@ -57,7 +57,7 @@ set(MAPI_VERSION "${MAPI_VERSION_MAJOR}.
 # extras, and tools/utils/msabaoth.[ch])
 set(MONETDB5_VERSION_MAJOR "36")
 set(MONETDB5_VERSION_MINOR "0")
-set(MONETDB5_VERSION_PATCH "2")
+set(MONETDB5_VERSION_PATCH "3")
 set(MONETDB5_VERSION 
"${MONETDB5_VERSION_MAJOR}.${MONETDB5_VERSION_MINOR}.${MONETDB5_VERSION_PATCH}")
 
 # version of the MONETDBE library (subdirectory tools/monetdbe)
@@ -75,5 +75,5 @@ set(STREAM_VERSION "${STREAM_VERSION_MAJ
 # version of the SQL library (subdirectory sql)
 set(SQL_VERSION_MAJOR "15")
 set(SQL_VERSION_MINOR "0")
-set(SQL_VERSION_PATCH "2")
+set(SQL_VERSION_PATCH "3")
 set(SQL_VERSION 
"${SQL_VERSION_MAJOR}.${SQL_VERSION_MINOR}.${SQL_VERSION_PATCH}")
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,26 @@
+monetdb (11.51.7) unstable; urgency=low
+
+  * Rebuilt.
+  * GH#7112: Need keyboard shortcut to interrupt query execution rather than
+    session
+  * GH#7205: Unpredictable performance when performing joins over nested
+    queries
+  * GH#7574: Assertion failure at `rel2bin_select` when using `STARTSWITH`
+  * GH#7588: incorrect output with single row inputs for var_samp(c) over()
+  * GH#7589: "SELECT * FROM sessions" crashes monetdb/e
+  * GH#7593: A value is being returned with unnecessary scientific notation
+  * GH#7595: SQLTestCase leaks pymonetdb connections
+  * GH#7597: Upgrade + quick restart causes database inconsistency
+  * GH#7599: str_to_date fails when combined with SQL CASE clause
+  * GH#7602: COPY INTO from multiple files causes an assertion error.
+  * GH#7603: COPY INTO from three or more files crashes the server.
+  * GH#7604: file_loader() causes server crash when csv file contains too
+    few field separators or contains empty lines
+  * GH#7607: Adding a column of serial type fails with "Access denied for
+    <user> to schema 'sys'"
+
+ -- Sjoerd Mullender <sjo...@acm.org>  Mon, 16 Dec 2024 12:45:20 +0100
+
 monetdb (11.51.5) unstable; urgency=low
 
   * Rebuilt.
diff --git a/monetdb5/mal/mal_namespace.c b/monetdb5/mal/mal_namespace.c
--- a/monetdb5/mal/mal_namespace.c
+++ b/monetdb5/mal/mal_namespace.c
@@ -197,6 +197,7 @@ const char grantRef[] = "grant";
 const char grant_rolesRef[] = "grant_roles";
 const char groupbyRef[] = "groupby";
 const char groupdoneRef[] = "groupdone";
+const char groupedfirstnRef[] = "groupedfirstn";
 const char groupRef[] = "group";
 const char growRef[] = "grow";
 const char hgeRef[] = "hge";
@@ -462,6 +463,7 @@ initNamespace(void)
        fixName(grant_rolesRef);
        fixName(groupbyRef);
        fixName(groupdoneRef);
+       fixName(groupedfirstnRef);
        fixName(groupRef);
        fixName(growRef);
        fixName(hgeRef);
diff --git a/monetdb5/mal/mal_namespace.h b/monetdb5/mal/mal_namespace.h
--- a/monetdb5/mal/mal_namespace.h
+++ b/monetdb5/mal/mal_namespace.h
@@ -123,6 +123,7 @@ mal_export const char grantRef[];
 mal_export const char grant_rolesRef[];
 mal_export const char groupbyRef[];
 mal_export const char groupdoneRef[];
+mal_export const char groupedfirstnRef[];
 mal_export const char groupRef[];
 mal_export const char growRef[];
 mal_export const char hgeRef[];
diff --git a/monetdb5/optimizer/opt_mergetable.c 
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -2317,6 +2317,8 @@ OPTmergetableImplementation(Client cntxt
                }
 
                /* pack if there is a group statement following a groupdone (ie 
aggr(distinct)) */
+               if (getModuleId(p) == algebraRef && getFunctionId(p) == 
groupedfirstnRef)
+                               groupdone = 1;
                if (getModuleId(p) == groupRef && p->argc == 5
                        && (getFunctionId(p) == subgroupRef
                                || getFunctionId(p) == subgroupdoneRef
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
@@ -67,13 +67,15 @@ OPTmitosisImplementation(Client cntxt, M
                nr_aggrs += (p->argc > 2 && getModuleId(p) == aggrRef);
                nr_maps += (isMapOp(p));
 
-               if (p->argc > 2 && getModuleId(p) == aggrRef
+               if ((getModuleId(p) == algebraRef &&
+                   getFunctionId(p) == groupedfirstnRef) ||
+                   (p->argc > 2 && getModuleId(p) == aggrRef
                        && getFunctionId(p) != subcountRef && getFunctionId(p) 
!= subminRef
                        && getFunctionId(p) != submaxRef && getFunctionId(p) != 
subavgRef
                        && getFunctionId(p) != subsumRef && getFunctionId(p) != 
subprodRef
                        && getFunctionId(p) != countRef && getFunctionId(p) != 
minRef
                        && getFunctionId(p) != maxRef && getFunctionId(p) != 
avgRef
-                       && getFunctionId(p) != sumRef && getFunctionId(p) != 
prodRef) {
+                       && getFunctionId(p) != sumRef && getFunctionId(p) != 
prodRef)) {
                        pieces = 0;
                        goto bailout;
                }
diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test 
b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test
--- a/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test
+++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyloader3_01.test
@@ -86,7 +86,7 @@ DROP LOADER myfunc2
 statement ok
 DROP LOADER myfunc3
 
-query ITTTIIIIIIII rowsort
+query ITTTIIIIIIIII rowsort
 SELECT * FROM functions WHERE name='myfunc'
 ----
 
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
@@ -188,7 +188,7 @@ list_find_column(backend *be, list *l, c
                                const char *nme = column_name(be->mvc->sa, s);
 
                                if (rnme && strcmp(rnme, rname) == 0 &&
-                                           strcmp(nme, name) == 0) {
+                                               strcmp(nme, name) == 0) {
                                        res = s;
                                        break;
                                }
@@ -215,7 +215,7 @@ list_find_column(backend *be, list *l, c
                        const char *nme = column_name(be->mvc->sa, n->data);
 
                        if (rnme && strcmp(rnme, rname) == 0 &&
-                                   strcmp(nme, name) == 0) {
+                                       strcmp(nme, name) == 0) {
                                res = n->data;
                                break;
                        }
@@ -543,7 +543,7 @@ handle_in_exps(backend *be, sql_exp *ce,
                        ?sql_bind_func(sql, "sys", "=", tail_type(c), 
tail_type(c), F_FUNC, true, true)
                        :sql_bind_func(sql, "sys", "<>", tail_type(c), 
tail_type(c), F_FUNC, true, true);
                sql_subfunc *a = (in)?sql_bind_func(sql, "sys", "or", bt, bt, 
F_FUNC, true, true)
-                                    :sql_bind_func(sql, "sys", "and", bt, bt, 
F_FUNC, true, true);
+                                        :sql_bind_func(sql, "sys", "and", bt, 
bt, F_FUNC, true, true);
 
                for (n = nl->h; n; n = n->next) {
                        sql_exp *e = n->data;
@@ -948,19 +948,19 @@ exp2bin_named_placeholders(backend *be, 
                InstrPtr q = newAssignment(be->mb);
 
                if (!q || !t || !s) {
-            sql_error(be->mvc, 10, SQLSTATE(42000) MAL_MALLOC_FAIL);
+                       sql_error(be->mvc, 10, SQLSTATE(42000) MAL_MALLOC_FAIL);
                        return NULL;
                }
-        int type = t->type->localtype, varid = 0;
-
-        snprintf(arg, IDLENGTH, "A%d", argc);
-        if ((varid = newVariable(be->mb, arg, strlen(arg), type)) < 0) {
-            sql_error(be->mvc, 10, SQLSTATE(42000) "Internal error while 
compiling statement: variable id too long");
+               int type = t->type->localtype, varid = 0;
+
+               snprintf(arg, IDLENGTH, "A%d", argc);
+               if ((varid = newVariable(be->mb, arg, strlen(arg), type)) < 0) {
+                       sql_error(be->mvc, 10, SQLSTATE(42000) "Internal error 
while compiling statement: variable id too long");
                        return NULL;
-        }
+               }
                if (q)
                        getDestVar(q) = varid;
-        q = pushArgument(be->mb, q, s->nr);
+               q = pushArgument(be->mb, q, s->nr);
                pushInstruction(be->mb, q);
        }
        return NULL;
@@ -1416,7 +1416,7 @@ is_const_func(sql_subfunc *f, list *attr
        if (list_length(attr) != 2)
                return false;
        if (strcmp(f->func->base.name, "quantile") == 0 ||
-           strcmp(f->func->base.name, "quantile_avg") == 0)
+               strcmp(f->func->base.name, "quantile_avg") == 0)
                return true;
        return false;
 }
@@ -1682,10 +1682,17 @@ exp_bin(backend *be, sql_exp *e, stmt *l
        }       break;
        case e_aggr: {
                list *attr = e->l;
+               list *r = e->r;
                stmt *as = NULL;
                sql_subfunc *a = e->f;
 
                assert(sel == NULL);
+                       /* cases
+                        * 0) count(*)
+                        * 1) general aggregation
+                        * 2) aggregation with required order (quantile etc)
+                        * 3) aggregation with optional order by, group_concat, 
xml_agg
+                        * */
                if (attr && attr->h) {
                        node *en;
                        list *l = sa_list(sql->sa);
@@ -1738,6 +1745,37 @@ exp_bin(backend *be, sql_exp *e, stmt *l
                                        return NULL;
                                append(l, stmt_project(be, u, a));
                        }
+                       if (r) {
+                               list *obe = r->h->data;
+                               if (obe && obe->h) {
+                                       stmt *orderby = NULL, *orderby_vals, 
*orderby_ids, *orderby_grp;
+                                       /* order by */
+                                       if (grp) {
+                                               orderby = stmt_order(be, grp, 
true, true);
+
+                                               orderby_vals = stmt_result(be, 
orderby, 0);
+                                               orderby_ids = stmt_result(be, 
orderby, 1);
+                                               orderby_grp = stmt_result(be, 
orderby, 2);
+                                       }
+                                       for (node *n = obe->h; n; n = n->next) {
+                                               sql_exp *oe = n->data;
+                                               stmt *os = exp_bin(be, oe, 
left, right, NULL, NULL, NULL, sel, depth+1, 0, push);
+                                               if (orderby)
+                                                       orderby = 
stmt_reorder(be, os, is_ascending(oe), nulls_last(oe), orderby_ids, 
orderby_grp);
+                                               else
+                                                       orderby = 
stmt_order(be, os, is_ascending(oe), nulls_last(oe));
+                                               orderby_vals = stmt_result(be, 
orderby, 0);
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to