Changeset: da0ca3cf5baa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da0ca3cf5baa
Added Files:
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128
Modified Files:
        buildtools/doc/windowsbuild.rst
        clients/mapiclient/dump.c
        gdk/gdk_aggr.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_upgrades.c
        sql/backends/monet5/sql_user.c
        sql/backends/monet5/vaults/fits/fits.c
        sql/backends/monet5/vaults/lidar/lidar.c
        sql/include/sql_catalog.h
        sql/jdbc/tests/Tests/BugSetQueryTimeout_Bug_3357.stable.out
        
sql/jdbc/tests/Tests/Bug_Connect_as_voc_getMetaData_Failure_Bug_6388.stable.out
        sql/scripts/51_sys_schema_extension.sql
        sql/server/rel_schema.c
        sql/server/rel_updates.c
        sql/server/sql_mvc.c
        sql/server/sql_mvc.h
        sql/server/sql_parser.y
        sql/server/sql_privileges.c
        sql/storage/bat/bat_logger.c
        sql/storage/sql_storage.h
        sql/storage/store.c
        sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
        sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
        sql/test/pg_regress/Tests/update.stable.out
        sql/test/sys-schema/Tests/check_Not_Nullable_columns.sql
        sql/test/sys-schema/Tests/check_Not_Nullable_columns.stable.out
        sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: analytics
Log Message:

Merge with default


diffs (truncated from 53447 to 300 lines):

diff --git a/buildtools/doc/windowsbuild.rst b/buildtools/doc/windowsbuild.rst
--- a/buildtools/doc/windowsbuild.rst
+++ b/buildtools/doc/windowsbuild.rst
@@ -813,50 +813,24 @@ parameter may contain something like::
 Building Installers
 ~~~~~~~~~~~~~~~~~~~
 
-Installers can be built either using the full-blown Visual Studio user
-interface or on the command line.  To use the user interface, open one
-or more of the files ``MonetDB5-SQL-Installer.sln``,
-``MonetDB-ODBC-Driver.sln``, and ``MonetDB5-Geom-Module.sln`` in the
-installation folder and select ``Build`` -> ``Build Solution``.  To use
-the command line, execute one or more of the commands in the
-installation folder::
+The installers are built using the WiX Toolset.  The WiX Toolset can
+be installed using Chocolatey.
 
- devenv MonetDB5-SQL-Installer.sln /build
- devenv MonetDB-ODBC-Driver.sln /build
- devenv MonetDB5-Geom-Module.sln /build
+The Python scripts ``mksqlwxs.py`` and ``mkodbcwxs.py`` in the ``NT``
+subdirectory are used to create the files
+``MonetDB5-SQL-Installer.wxs`` and ``MonetDB-ODBC-Installer.wxs``.
+This happens as part of the normal build process.
 
-In both cases, use the solutions (``.sln`` files) that are
-appropriate.
+These files then need to be processed using the ``candle`` command
+from the WiX Toolset::
 
-There is an annoying bug in Visual Studio on Windows64 that affects
-the MonetDB5-Geom-Module installer.  The installer contains code to
-check the registry to find out where MonetDB5/SQL is installed.  The
-bug is that the 64 bit installer will check the 32-bit section of the
-registry.  The code can be fixed by editing the generated installer
-(``.msi`` file) using e.g. the program ``orca`` from Microsoft.  Open
-the installer in ``orca`` and locate the table ``RegLocator``.  In the
-Type column, change the value from ``2`` to ``18`` and save the file.
-Alternatively, use the following Python script to fix the ``.msi``
-file::
+  candle.exe -nologo -arch x64 MonetDB5-SQL-Installer.wxs
+
+Use ``-arch x86`` for 32 bit Windows.
 
- # Fix a .msi (Windows Installer) file for a 64-bit registry search.
- # Microsoft refuses to fix a bug in Visual Studio so that for a 64-bit
- # build, the registry search will look in the 32-bit part of the
- # registry instead of the 64-bit part of the registry.  This script
- # fixes the .msi to look in the correct part.
-
- import msilib
- import sys
- import glob
+This command produces a file ``MonetDB5-SQL-Installer.wixobj`` which
+needs to be processed with the ``light`` command from the toolset::
 
- def fixmsi(f):
-     db = msilib.OpenDatabase(f, msilib.MSIDBOPEN_DIRECT)
-     v = db.OpenView('UPDATE RegLocator SET Type = 18 WHERE Type = 2')
-     v.Execute(None)
-     v.Close()
-     db.Commit()
+  light.exe -nologo -sice:ICO03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension 
MonetDB5-SQL-Installer.wixobj
 
- if __name__ == '__main__':
-     for f in sys.argv[1:]:
-        for g in glob.glob(f):
-            fixmsi(g)
+The same for the ODBC driver.
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1036,7 +1036,7 @@ describe_table(Mapi mid, const char *sch
                }
                /* the table is a real table */
                mnstr_printf(toConsole, "CREATE %sTABLE \"%s\".\"%s\" ",
-                           (type == 3 || type == 12 || type == 13 || type == 
14 || type == 15) ? "MERGE " :
+                           type == 3 ? "MERGE " :
                            type == 4 ? "STREAM " :
                            type == 5 ? "REMOTE " :
                            type == 6 ? "REPLICA " :
@@ -1061,29 +1061,40 @@ describe_table(Mapi mid, const char *sch
                        mnstr_printf(toConsole, " ON '%s' WITH USER '%s' 
ENCRYPTED PASSWORD '%s'", view, rt_user, rt_hash);
                        mapi_close_handle(hdl);
                        hdl = NULL;
-               } else if(type >= 12 && type <= 15) { /* partitioned table */
-                       const char *phow = (type == 12 || type == 14) ? 
"VALUES" : "RANGE";
-                       const char *pusing = (type == 12 || type == 13) ? "ON" 
: "USING";
-                       const char *expr = NULL;
+               } else if(type == 3) { /* A merge table might be partitioned */
+                       int properties = 0;
 
-                       if(type == 12 || type == 13) { /* by column */
-                               snprintf(query, maxquerylen,
-                                                "SELECT c.name FROM schemas s, 
tables t, columns c, table_partitions tp "
-                                                "WHERE s.name = '%s' AND 
t.name = '%s' AND s.id = t.schema_id AND t.id = c.table_id "
-                                                "AND c.id = tp.column_id", 
schema, tname);
-                       } else { /* by expression */
-                               snprintf(query, maxquerylen,
-                                                "SELECT tp.expression FROM 
schemas s, tables t, table_partitions tp "
-                                                "WHERE s.name = '%s' AND 
t.name = '%s' AND s.id = t.schema_id AND t.id = tp.table_id",
-                                                schema, tname);
-                       }
+                       snprintf(query, maxquerylen, "SELECT tp.type FROM 
table_partitions tp WHERE tp.table_id = '%d'", table_id);
                        if ((hdl = mapi_query(mid, query)) == NULL || 
mapi_error(mid))
                                goto bailout;
                        while(mapi_fetch_row(hdl) != 0)
-                               expr = mapi_fetch_field(hdl, 0);
-                       mnstr_printf(toConsole, " PARTITION BY %s %s (%s)", 
phow, pusing, expr);
+                               properties = atoi(mapi_fetch_field(hdl, 0));
                        mapi_close_handle(hdl);
-                       hdl = NULL;
+
+                       if(properties) {
+                               bool list = (properties & 2) == 2, column = 
(properties & 4) == 4;
+                               const char *phow = list ? "VALUES" : "RANGE";
+                               const char *pusing = column ? "ON" : "USING";
+                               const char *expr = NULL;
+
+                               if(column) { /* by column */
+                                       snprintf(query, maxquerylen,
+                                                        "SELECT c.name FROM 
schemas s, tables t, columns c, table_partitions tp "
+                                                        "WHERE s.name = '%s' 
AND t.name = '%s' AND s.id = t.schema_id AND t.id = c.table_id "
+                                                        "AND c.id = 
tp.column_id", schema, tname);
+                               } else { /* by expression */
+                                       snprintf(query, maxquerylen,
+                                                        "SELECT tp.expression 
FROM schemas s, tables t, table_partitions tp "
+                                                        "WHERE s.name = '%s' 
AND t.name = '%s' AND s.id = t.schema_id AND t.id = tp.table_id",
+                                                        schema, tname);
+                               }
+                               if ((hdl = mapi_query(mid, query)) == NULL || 
mapi_error(mid))
+                                       goto bailout;
+                               while(mapi_fetch_row(hdl) != 0)
+                                       expr = mapi_fetch_field(hdl, 0);
+                               mnstr_printf(toConsole, " PARTITION BY %s %s 
(%s)", phow, pusing, expr);
+                               mapi_close_handle(hdl);
+                       }
                }
                mnstr_printf(toConsole, ";\n");
                comment_on(toConsole, "TABLE", schema, tname, NULL, remark);
@@ -2040,7 +2051,7 @@ dump_database(Mapi mid, stream *toConsol
                               "t.type AS type "
                        "FROM sys.schemas s, "
                              "sys._tables t "
-                       "WHERE t.type IN (0, 3, 4, 5, 6, 12, 13, 14, 15) AND "
+                       "WHERE t.type IN (0, 3, 4, 5, 6) AND "
                              "t.system = FALSE AND "
                              "s.id = t.schema_id AND "
                              "s.name <> 'tmp' "
@@ -2092,7 +2103,7 @@ dump_database(Mapi mid, stream *toConsol
                               "t.type AS type "
                        "FROM sys.schemas s, "
                              "sys._tables t "
-                       "WHERE t.type IN (0, 3, 4, 5, 6, 12, 13, 14, 15) AND "
+                       "WHERE t.type IN (0, 3, 4, 5, 6) AND "
                              "t.system = FALSE AND "
                              "s.id = t.schema_id AND "
                              "s.name <> 'tmp' "
@@ -2134,10 +2145,14 @@ dump_database(Mapi mid, stream *toConsol
                              "t.id = tr.table_id AND t.system = FALSE"
                ") "
                "SELECT id, sname, name, query, remark, type FROM vft ORDER BY 
id";
-       const char *mergetables = "SELECT t1.type, s1.name, t1.name, s2.name, 
t2.name FROM sys.schemas s1, sys._tables t1, "
-                                                         "sys.dependencies d, 
sys.schemas s2, sys._tables t2 WHERE t1.type IN (3, 12, 13, 14, 15) "
-                                                         "AND t1.schema_id = 
s1.id AND s1.name <> 'tmp' AND t1.system = FALSE "
-                                                         "AND t1.id = 
d.depend_id AND d.id = t2.id AND t2.schema_id = s2.id ORDER BY t1.id, t2.id";
+       const char *mergetables = "SELECT subq.s1name, subq.t1name, 
subq.s2name, subq.t2name, "
+                                                         
"table_partitions.type FROM (SELECT t1.id, t1.type, s1.name AS s1name, "
+                                                         "t1.name AS t1name, 
s2.name AS s2name, t2.name AS t2name FROM sys.schemas s1, "
+                                                         "sys._tables t1, 
sys.dependencies d, sys.schemas s2, sys._tables t2 "
+                                                         "WHERE t1.type IN (3, 
6) AND t1.schema_id = s1.id AND s1.name <> 'tmp' "
+                                                         "AND t1.system = 
FALSE AND t1.id = d.depend_id AND d.id = t2.id AND t2.schema_id = s2.id "
+                                                         "ORDER BY t1.id, 
t2.id) subq "
+                                                         "LEFT OUTER JOIN 
sys.table_partitions ON subq.id = table_partitions.table_id;";
        char *sname = NULL;
        char *curschema = NULL;
        MapiHdl hdl = NULL;
@@ -2349,8 +2364,7 @@ dump_database(Mapi mid, stream *toConsol
                                     curschema);
                }
                if(type) { /* table */
-                       int ptype = atoi(type),
-                               dont_describe = (ptype == 3 || ptype == 5 || 
ptype == 12 || ptype == 13 || ptype == 14 || ptype == 15);
+                       int ptype = atoi(type), dont_describe = (ptype == 3 || 
ptype == 5);
                        schema = strdup(schema);
                        name = strdup(name);
                        rc = dump_table(mid, schema, name, toConsole, 
dont_describe ? 1 : describe, describe, useInserts, true);
@@ -2376,11 +2390,12 @@ dump_database(Mapi mid, stream *toConsol
        while (rc == 0 &&
               !mnstr_errnr(toConsole) &&
               mapi_fetch_row(hdl) != 0) {
-               int type1 = atoi(mapi_fetch_field(hdl, 0));
-               const char *schema1 = mapi_fetch_field(hdl, 1);
-               const char *tname1 = mapi_fetch_field(hdl, 2);
-               const char *schema2 = mapi_fetch_field(hdl, 3);
-               const char *tname2 = mapi_fetch_field(hdl, 4);
+               const char *schema1 = mapi_fetch_field(hdl, 0);
+               const char *tname1 = mapi_fetch_field(hdl, 1);
+               const char *schema2 = mapi_fetch_field(hdl, 2);
+               const char *tname2 = mapi_fetch_field(hdl, 3);
+               const char *prop = mapi_fetch_field(hdl, 4);
+               int properties = prop ? atoi(prop) : 0;
 
                if (mapi_error(mid))
                        goto bailout;
@@ -2398,11 +2413,11 @@ dump_database(Mapi mid, stream *toConsol
                                     curschema);
                }
                mnstr_printf(toConsole, "ALTER TABLE \"%s\".\"%s\" ADD TABLE 
\"%s\"", schema1, tname1, tname2);
-               if(type1 != 3) {
+               if(properties) {
                        MapiHdl shdl = NULL;
 
                        mnstr_printf(toConsole, " AS PARTITION");
-                       if(type1 == 12 || type1 == 14) { /* by values */
+                       if((properties & 2) == 2) { /* by values */
                                int i = 0, first = 1, found_nil = 0;
                                snprintf(query, query_size,
                                                 "SELECT vp.value FROM schemas 
s, tables t, value_partitions vp "
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3335,7 +3335,7 @@ concat_strings(void *res, int what, BAT*
                        } else {
                                BATloop(b,p,q) {
                                        s = BUNtail(bi, p);
-                                       if (strcmp(s, str_nil)) {
+                                       if (*s != '\200') {
                                                next_length = strlen(s);
                                                single_length += next_length + 
separator_length;
                                                single_oid = p;
@@ -3411,7 +3411,7 @@ concat_strings(void *res, int what, BAT*
                                        if (i >= end)
                                                break;
                                        s = BUNtail(bi, i);
-                                       if (strcmp(s, str_nil)) {
+                                       if (*s != '\200') {
                                                next_length = strlen(s);
                                                single_length += next_length + 
separator_length;
                                                single_oid = i;
@@ -3473,7 +3473,7 @@ concat_strings(void *res, int what, BAT*
                                        gid = gids ? gids[i] - min : (oid) i;
                                        if (lastoid[gid] != BUN_NONE) {
                                                s = BUNtail(bi, i);
-                                               if (strcmp(s, str_nil)) {
+                                               if (*s != '\200') {
                                                        next_length = strlen(s);
                                                        lengths[gid] += 
next_length + separator_length;
                                                        lastoid[gid] = i;
@@ -3533,7 +3533,7 @@ concat_strings(void *res, int what, BAT*
                                        gid = gids ? gids[i] - min : (oid) i;
                                        if (lastoid[gid] != BUN_NONE) {
                                                s = BUNtail(bi, i);
-                                               if (strcmp(s, str_nil)) {
+                                               if (*s != '\200') {
                                                        next_length = strlen(s);
                                                        lengths[gid] += 
next_length;
                                                        lastoid[gid] = i;
@@ -3637,7 +3637,7 @@ BATstr_group_concat(ValPtr res, BAT *b, 
        assert(separator);
        res->vtype = TYPE_str;
 
-       if (BATcount(b) == 0 || strcmp(separator, str_nil) == 0) {
+       if (BATcount(b) == 0 || *separator == '\200') {
                res->len = 0;
                res->val.sval = nil_if_empty ? GDKstrdup(str_nil) : 
GDKstrdup("");
                if(res->val.sval == NULL) {
@@ -3679,7 +3679,7 @@ BATgroupstr_group_concat(BAT *b, BAT *g,
                return NULL;
        }
 
-       if (BATcount(b) == 0 || ngrp == 0 || strcmp(separator, str_nil) == 0) {
+       if (BATcount(b) == 0 || ngrp == 0 || *separator == '\200') {
                /* trivial: no strings to concat, so return bat aligned with g 
with nil in the tail */
                return BATconstant(ngrp == 0 ? 0 : min, TYPE_str, str_nil, 
ngrp, TRANSIENT);
        }
@@ -3709,3 +3709,6 @@ BATgroupstr_group_concat(BAT *b, BAT *g,
 
        return bn;
 }
+
+#undef IS_A_POINTER
+#undef IS_A_BAT
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
@@ -300,7 +300,7 @@ create_table_or_view(mvc *sql, char *sna
        osa = sql->sa;
        sql->sa = NULL;
 
-       nt = sql_trans_create_table(sql->session->tr, s, t->base.name, 
t->query, t->type, t->system, temp, t->commit_action, t->sz);
+       nt = sql_trans_create_table(sql->session->tr, s, t->base.name, 
t->query, t->type, t->system, temp, t->commit_action, t->sz, t->properties);
 
        /* first check default values */
        for (n = t->columns.set->h; n; n = n->next) {
@@ -459,7 +459,7 @@ create_table_from_emit(Client cntxt, cha
                msg = sql_error(sql, 02, "3F000!CREATE TABLE: no such schema 
'%s'", sname);
                goto cleanup;
        }
-       if (!(t = mvc_create_table(sql, s, tname, tt_table, 0, 
SQL_DECLARED_TABLE, CA_COMMIT, -1))) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to