Changeset: 50bf9acb82b1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=50bf9acb82b1
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: default
Log Message:

Merge with Aug2018 branch.


diffs (truncated from 354 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
@@ -1826,6 +1826,50 @@ sql_drop_functions_dependencies_Xs_on_Ys
 }
 
 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 */
+}
+
+static str
 sql_upgrade_2019_storagemodel(Client c, mvc *sql)
 {
        size_t bufsize = 20000, pos = 0;
@@ -2355,6 +2399,11 @@ SQLupgrades(Client c, mvc *m)
                }
        }
 
+       if ((err = sql_update_aug2018_sp2(c, m)) != NULL) {
+               fprintf(stderr, "!%s\n", err);
+               freeException(err);
+       }
+
        /* when function storagemodel() exists and views tablestorage and 
schemastorage not yet exist then upgrade storagemodel to match 
75_storagemodel.sql */
        if (sql_bind_func(m->sa, s, "storagemodel", NULL, NULL, F_UNION)
         && (t = mvc_bind_table(m, s, "tablestorage")) == NULL
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -5903,6 +5903,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -5903,6 +5903,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -5903,6 +5903,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -34,6 +34,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -34,6 +34,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -5902,6 +5902,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
+
+Running database upgrade commands:
+set schema sys;
 drop view if exists sys.tablestoragemodel;
 drop view if exists sys.storagemodel cascade;
 drop function if exists sys.storagemodel() cascade;
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
@@ -35,6 +35,12 @@ 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;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to