Changeset: 39e54f84a16e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=39e54f84a16e
Modified Files:
        sql/backends/monet5/sql_upgrades.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/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
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128
Branch: Aug2018
Log Message:

Upgrade code for changeset 23e1231ada99.


diffs (truncated from 352 to 300 lines):

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
@@ -1792,6 +1792,50 @@ sql_drop_functions_dependencies_Xs_on_Ys
        return err;             /* usually MAL_SUCCEED */
 }
 
+static str
+sql_update_aug2018_sp2(Client c, mvc *sql)
+{
+       size_t bufsize = 1000, pos = 0;
+       char *buf, *err;
+       char *schema;
+       res_table *output;
+       BAT *b;
+
+       schema = stack_get_string(sql, "current_schema");
+       if ((buf = GDKmalloc(bufsize)) == NULL)
+               throw(SQL, "sql_update_aug2018_sp2", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+
+       /* required update for changeset 23e1231ada99 */
+       pos += snprintf(buf + pos, bufsize - pos,
+                       "select id from sys.functions where language <> 0 and 
not side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in 
(select func_id from sys.args where inout = 1)));\n");
+       err = SQLstatementIntern(c, &buf, "update", 1, 0, &output);
+       if (err) {
+               GDKfree(buf);
+               return err;
+       }
+       b = BATdescriptor(output->cols[0].b);
+       if (b) {
+               if (BATcount(b) > 0) {
+                       pos = 0;
+                       pos += snprintf(buf + pos, bufsize - pos, "set schema 
sys;\n");
+                       pos += snprintf(buf + pos, bufsize - pos,
+                                       "update sys.functions set side_effect = 
true where language <> 0 and not side_effect and type <> 4 and (type = 2 or 
(language <> 2 and id not in (select func_id from sys.args where inout = 
1)));\n");
+
+                       if (schema)
+                               pos += snprintf(buf + pos, bufsize - pos, "set 
schema \"%s\";\n", 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", 1, 0, 
&output);
+               }
+               BBPunfix(b->batCacheid);
+       }
+       res_table_destroy(output);
+       GDKfree(buf);
+       return err;             /* usually MAL_SUCCEED */
+}
+
 void
 SQLupgrades(Client c, mvc *m)
 {
@@ -1992,4 +2036,9 @@ SQLupgrades(Client c, mvc *m)
                        freeException(err);
                }
        }
+
+       if ((err = sql_update_aug2018_sp2(c, m)) != NULL) {
+               fprintf(stderr, "!%s\n", err);
+               freeException(err);
+       }
 }
diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:39660/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:39660/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:39660/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -5344,6 +5344,12 @@ grant execute on function json.filter(js
 set schema "sys";
 commit;
 
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git 
a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128
@@ -5344,6 +5344,12 @@ grant execute on function json.filter(js
 set schema "sys";
 commit;
 
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:39660/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out 
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:39660/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit 
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:39660/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30908/.s.monetdb.39660
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
@@ -5344,6 +5344,12 @@ grant execute on function json.filter(js
 set schema "sys";
 commit;
 
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.ins.cwi.nl:37689/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-31771/.s.monetdb.37689
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
@@ -15,6 +15,12 @@ stdout of test 'upgrade` in directory 's
 # Visit http://www.monetdb.org/ for further information
 # Listening for connection requests on mapi:monetdb://madrid.ins.cwi.nl:36250/
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
@@ -15,6 +15,12 @@ stdout of test 'upgrade` in directory 's
 # Visit http://www.monetdb.org/ for further information
 # Listening for connection requests on mapi:monetdb://madrid.ins.cwi.nl:36250/
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -5343,6 +5343,12 @@ grant execute on function json.filter(js
 set schema "sys";
 commit;
 
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.ins.cwi.nl:34683/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-30503/.s.monetdb.34683
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
+
 # MonetDB/SQL module loaded
 
 Ready.
diff --git a/sql/test/testdb-upgrade/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade/Tests/upgrade.stable.out
@@ -16,6 +16,12 @@ stdout of test 'upgrade` in directory 's
 # Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:34708/
 # Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-11915/.s.monetdb.34708
 # MonetDB/GIS module loaded
+Running database upgrade commands:
+set schema sys;
+update sys.functions set side_effect = true where language <> 0 and not 
side_effect and type <> 4 and (type = 2 or (language <> 2 and id not in (select 
func_id from sys.args where inout = 1)));
+set schema "sys";
+commit;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to