Changeset: cb91c634a7d4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cb91c634a7d4
Modified Files:
        MonetDB.spec
        NT/mkodbcwxs.py
        NT/mksqlwxs.py
        sql/backends/monet5/sql_upgrades.c
        sql/common/sql_types.c
        sql/server/sql_scan.c
        sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.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
        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/interval.stable.err
        sql/test/pg_regress/Tests/interval.stable.err.int128
        sql/test/pg_regress/Tests/interval.stable.out
        sql/test/pg_regress/Tests/interval.stable.out.int128
        sql/test/pg_regress/Tests/timestamp.sql
        sql/test/pg_regress/Tests/timestamptz.sql
        sql/test/sys-schema/Tests/systemfunctions.stable.out
        sql/test/sys-schema/Tests/systemfunctions.stable.out.int128
        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: default
Log Message:

Merge with Nov2019 branch.


diffs (truncated from 184021 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -19,15 +19,16 @@
 %global _hardened_build 1
 
 # On RedHat Enterprise Linux and derivatives, if the Extra Packages
-# for Enterprise Linux (EPEL) repository is available, you can enable
-# its use by providing rpmbuild or mock with the "--with epel" option.
+# for Enterprise Linux (EPEL) repository is not available, you can
+# disable its use by providing rpmbuild or mock with the "--without
+# epel" option.
 # If the EPEL repository is availabe, or if building for Fedora, most
 # optional sub packages can be built.  We indicate that here by
 # setting the macro fedpkgs to 1.  If the EPEL repository is not
 # available and we are not building for Fedora, we set fedpkgs to 0.
 %if %{?rhel:1}%{!?rhel:0}
 # RedHat Enterprise Linux (or CentOS or Scientific Linux)
-%bcond_with epel
+%bcond_without epel
 %if %{with epel}
 # EPEL is enabled through the command line
 %global fedpkgs 1
diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py
--- a/NT/mkodbcwxs.py
+++ b/NT/mkodbcwxs.py
@@ -55,8 +55,8 @@ def main():
     print(r'    <CustomAction Id="driverinstall" FileKey="odbcinstall" 
ExeCommand="/Install" Execute="deferred" Impersonate="no"/>')
     print(r'    <CustomAction Id="driveruninstall" FileKey="odbcinstall" 
ExeCommand="/Uninstall" Execute="deferred" Impersonate="no"/>')
     print(r'    <Directory Id="TARGETDIR" Name="SourceDir">')
-    if vs == '17':
-        msvc = r'C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC\Redist\MSVC'
+    if vs in ('17', '19'):
+        msvc = r'C:\Program Files (x86)\Microsoft Visual 
Studio\20%s\Community\VC\Redist\MSVC' % vs
         d = sorted(os.listdir(msvc))[-1]
         msm = '_CRT_%s.msm' % arch
         for f in sorted(os.listdir(os.path.join(msvc, d, 'MergeModules'))):
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -114,8 +114,8 @@ def main():
     print(r'    <Property Id="ARPPRODUCTICON" Value="monetdb.ico"/>')
     print(r'    <Media Id="1" Cabinet="monetdb.cab" EmbedCab="yes"/>')
     print(r'    <Directory Id="TARGETDIR" Name="SourceDir">')
-    if vs == '17':
-        msvc = r'C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\VC\Redist\MSVC'
+    if vs in ('17', '19'):
+        msvc = r'C:\Program Files (x86)\Microsoft Visual 
Studio\20%s\Community\VC\Redist\MSVC' % vs
         d = sorted(os.listdir(msvc))[-1]
         msm = '_CRT_%s.msm' % arch
         for f in sorted(os.listdir(os.path.join(msvc, d, 'MergeModules'))):
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
@@ -21,19 +21,14 @@
 #include "rel_remote.h"
 #include "mal_authorize.h"
 
-#ifdef HAVE_EMBEDDED
-#define printf(fmt,...) ((void) 0)
-#endif
-
 /* this function can be used to recreate the system tables (types,
  * functions, args) when internal types and/or functions have changed
  * (i.e. the ones in sql_types.c) */
 static str
-sql_fix_system_tables(Client c, mvc *sql)
+sql_fix_system_tables(Client c, mvc *sql, const char *prev_schema)
 {
        size_t bufsize = 1000000, pos = 0;
        char *buf = GDKmalloc(bufsize), *err = NULL;
-       char *schema = stack_get_string(sql, "current_schema");
        node *n;
        sql_schema *s;
 
@@ -174,8 +169,7 @@ sql_fix_system_tables(Client c, mvc *sql
                }
        }
 
-       if (schema)
-               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
 
        assert(pos < bufsize);
        printf("Running database upgrade commands:\n%s\n", buf);
@@ -186,20 +180,17 @@ sql_fix_system_tables(Client c, mvc *sql
 
 #ifdef HAVE_HGE
 static str
-sql_update_hugeint(Client c, mvc *sql)
+sql_update_hugeint(Client c, mvc *sql, const char *prev_schema)
 {
        size_t bufsize = 8192, pos = 0;
        char *buf, *err;
-       char *schema;
 
-       if ((err = sql_fix_system_tables(c, sql)) != NULL)
+       if ((err = sql_fix_system_tables(c, sql, prev_schema)) != NULL)
                return err;
 
        if ((buf = GDKmalloc(bufsize)) == NULL)
                throw(SQL, "sql_update_hugeint", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
 
-       schema = stack_get_string(sql, "current_schema");
-
        pos += snprintf(buf + pos, bufsize - pos, "set schema \"sys\";\n");
 
        /* 80_udf_hge.sql */
@@ -250,8 +241,7 @@ sql_update_hugeint(Client c, mvc *sql)
                        "update sys.functions set system = true where name in 
('fuse', 'generate_series', 'stddev_samp', 'stddev_pop', 'var_samp', 'var_pop', 
'median', 'quantile', 'corr') and schema_id = (select id from sys.schemas where 
name = 'sys');\n"
                        "update sys.functions set system = true where name = 
'filter' and schema_id = (select id from sys.schemas where name = 'json');\n");
 
-       if (schema)
-               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
        assert(pos < bufsize);
 
@@ -263,12 +253,10 @@ sql_update_hugeint(Client c, mvc *sql)
 #endif
 
 static str
-sql_update_geom(Client c, mvc *sql, int olddb)
+sql_update_geom(Client c, mvc *sql, int olddb, const char *prev_schema)
 {
        size_t bufsize, pos = 0;
-       char *buf, *err = NULL;
-       char *geomupgrade;
-       char *schema = stack_get_string(sql, "current_schema");
+       char *buf, *err = NULL, *geomupgrade;
        geomsqlfix_fptr fixfunc;
        node *n;
        sql_schema *s = mvc_bind_schema(sql, "sys");
@@ -302,8 +290,7 @@ sql_update_geom(Client c, mvc *sql, int 
                                                        t->s ? t->s->base.id : 
s->base.id);
        }
 
-       if (schema)
-               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
@@ -314,11 +301,10 @@ sql_update_geom(Client c, mvc *sql, int 
 }
 
 static str
-sql_update_jul2017(Client c, mvc *sql)
+sql_update_jul2017(Client c, const char *prev_schema)
 {
        size_t bufsize = 10000, pos = 0;
        char *buf = GDKmalloc(bufsize), *err = NULL;
-       char *schema = stack_get_string(sql, "current_schema");
        char *q1 = "select id from sys.functions where name = 'shpload' and 
schema_id = (select id from sys.schemas where name = 'sys');\n";
        res_table *output;
        BAT *b;
@@ -418,8 +404,7 @@ sql_update_jul2017(Client c, mvc *sql)
        }
        res_tables_destroy(output);
 
-       if (schema)
-               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
@@ -479,7 +464,7 @@ sql_update_jul2017_sp2(Client c)
 }
 
 static str
-sql_update_jul2017_sp3(Client c, mvc *sql)
+sql_update_jul2017_sp3(Client c, mvc *sql, const char *prev_schema)
 {
        char *err = NULL;
        sql_schema *sys;
@@ -495,7 +480,7 @@ sql_update_jul2017_sp3(Client c, mvc *sq
        col = find_sql_column(tab, "name");
        rid = table_funcs.column_find_row(sql->session->tr, col, 
"sys_update_schemas", NULL);
        if (is_oid_nil(rid)) {
-               err = sql_fix_system_tables(c, sql);
+               err = sql_fix_system_tables(c, sql, prev_schema);
                if (err != NULL)
                        return err;
        }
@@ -505,7 +490,6 @@ sql_update_jul2017_sp3(Client c, mvc *sq
        col = find_sql_column(tab, "name");
        rid = table_funcs.column_find_row(sql->session->tr, col, 
"system_update_schemas", NULL);
        if (is_oid_nil(rid)) {
-               char *schema = stack_get_string(sql, "current_schema");
                size_t bufsize = 1024, pos = 0;
                char *buf = GDKmalloc(bufsize);
                if (buf == NULL)
@@ -516,8 +500,7 @@ sql_update_jul2017_sp3(Client c, mvc *sq
                        "set schema \"sys\";\n"
                        "create trigger system_update_schemas after update on 
sys.schemas for each statement call sys_update_schemas();\n"
                        "create trigger system_update_tables after update on 
sys._tables for each statement call sys_update_tables();\n");
-               if (schema)
-                       pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", prev_schema);
                pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
                assert(pos < bufsize);
                printf("Running database upgrade commands:\n%s\n", buf);
@@ -528,11 +511,10 @@ sql_update_jul2017_sp3(Client c, mvc *sq
 }
 
 static str
-sql_update_mar2018_geom(Client c, mvc *sql, sql_table *t)
+sql_update_mar2018_geom(Client c, sql_table *t, const char *prev_schema)
 {
        size_t bufsize = 10000, pos = 0;
        char *buf = GDKmalloc(bufsize), *err = NULL;
-       char *schema = stack_get_string(sql, "current_schema");
 
        if (buf == NULL)
                throw(SQL, "sql_update_mar2018_geom", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
@@ -555,8 +537,7 @@ sql_update_mar2018_geom(Client c, mvc *s
                        "GRANT SELECT ON sys.geometry_columns TO PUBLIC;\n"
                        "update sys._tables set system = true where name = 
'geometry_columns' and schema_id in (select id from schemas where name = 
'sys');\n");
 
-       if (schema)
-               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
@@ -567,11 +548,10 @@ sql_update_mar2018_geom(Client c, mvc *s
 }
 
 static str
-sql_update_mar2018(Client c, mvc *sql)
+sql_update_mar2018(Client c, mvc *sql, const char *prev_schema)
 {
        size_t bufsize = 30000, pos = 0;
        char *buf, *err;
-       char *schema;
        sql_schema *s;
        sql_table *t;
        res_table *output;
@@ -587,7 +567,7 @@ sql_update_mar2018(Client c, mvc *sql)
                        /* if there is no value "quarter" in
                         * sys.functions.name, we need to update the
                         * sys.functions table */
-                       err = sql_fix_system_tables(c, sql);
+                       err = sql_fix_system_tables(c, sql, prev_schema);
                        if (err != NULL)
                                return err;
                }
@@ -595,7 +575,6 @@ sql_update_mar2018(Client c, mvc *sql)
        }
        res_tables_destroy(output);
 
-       schema = stack_get_string(sql, "current_schema");
        buf = GDKmalloc(bufsize);
        if (buf == NULL)
                throw(SQL, "sql_update_mar2018", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
@@ -1026,21 +1005,18 @@ sql_update_mar2018(Client c, mvc *sql)
                        "AND schema_id = (SELECT id FROM sys.schemas WHERE name 
= 'sys');\n"
                );
 
-       if (schema)
-               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+       pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", 
prev_schema);
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
        printf("Running database upgrade commands:\n%s\n", buf);
        err = SQLstatementIntern(c, &buf, "update", true, false, NULL);
        if (err == MAL_SUCCEED) {
-               schema = stack_get_string(sql, "current_schema");
                pos = snprintf(buf, bufsize, "set schema \"sys\";\n"
                               "ALTER TABLE sys.keywords SET READ ONLY;\n"
                               "ALTER TABLE sys.function_types SET READ ONLY;\n"
                               "ALTER TABLE sys.function_languages SET READ 
ONLY;\n");
-               if (schema)
-                       pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", schema);
+               pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", prev_schema);
                pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
                assert(pos < bufsize);
                printf("Running database upgrade commands:\n%s\n", buf);
@@ -1052,14 +1028,11 @@ sql_update_mar2018(Client c, mvc *sql)
 
 #ifdef HAVE_NETCDF
 static str
-sql_update_mar2018_netcdf(Client c, mvc *sql)
+sql_update_mar2018_netcdf(Client c, const char *prev_schema)
 {
        size_t bufsize = 1000, pos = 0;
-       char *buf, *err;
-       char *schema;
+       char *buf = GDKmalloc(bufsize), *err;
 
-       schema = stack_get_string(sql, "current_schema");
-       buf = GDKmalloc(bufsize);
        if (buf == NULL)
                throw(SQL, "sql_update_mar2018_netcdf", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
 
@@ -1075,8 +1048,7 @@ sql_update_mar2018_netcdf(Client c, mvc 
                        "grant execute on procedure 
sys.netcdf_attach(varchar(256)) to public;\n"
                        "grant execute on procedure 
sys.netcdf_importvar(integer, varchar(256)) to public;\n");
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to