Changeset: ffcb6157ecb1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ffcb6157ecb1
Modified Files:
        sql/backends/monet5/sql_upgrades.c
        sql/storage/store.c
        
sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
        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.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.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.int128
        
sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-previous-upgrade-hge/Tests/dump.stable.out
        sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-previous-upgrade/Tests/dump.stable.out
        sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-previous-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.int128
        sql/test/testdb-upgrade-hge/Tests/dump.stable.out
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/dump.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:

Add and approve upgrade code for removal of PYTHON3_MAP.


diffs (truncated from 495 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
@@ -5887,9 +5887,23 @@ sql_update_default(Client c, mvc *sql, s
                " on privileges.privileges = 
privilege_codes.privilege_code_id\n"
                " where roles.name = current_role;\n"
                "GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;\n"
-               "update sys._tables set system = true where system <> true and 
schema_id = 2000 and name = 'describe_accessible_tables';\n";
+               "update sys._tables set system = true where system <> true and 
schema_id = 2000 and name = 'describe_accessible_tables';\n"
+
+                       "alter table sys.function_languages set read write;\n"
+                       "delete from sys.function_languages where 
language_keyword like 'PYTHON%_MAP';\n"
+                       /* for these two, also see load_func() */
+                       "update sys.functions set language = language - 1 where 
language in (7, 11);\n"
+                       "update sys.functions set mod = 'pyapi3' where mod in 
('pyapi', 'pyapi3map');\n"
+                       "commit;\n";
                printf("Running database upgrade commands:\n%s\n", query);
+               fflush(stdout);
                err = SQLstatementIntern(c, query, "update", true, false, NULL);
+               if (err == MAL_SUCCEED) {
+                       query = "alter table sys.function_languages set read 
only;\n";
+                       printf("Running database upgrade commands:\n%s\n", 
query);
+                       fflush(stdout);
+                       err = SQLstatementIntern(c, query, "update", true, 
false, NULL);
+               }
        }
 
        return err;
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -943,11 +943,13 @@ load_func(sql_trans *tr, sql_schema *s, 
        } else {
                v = store->table_api.column_find_string_start(tr, 
find_sql_column(funcs, "mod"), rid, &cbat);
        }
-       if (strcmp(v, "pyapi") == 0) /* pyapi module no longer used */
+       if (strcmp(v, "pyapi") == 0 ||   /* pyapi module no longer used */
+               strcmp(v, "pyapi3map") == 0) /* pyapi3map module no longer used 
*/
                t->mod =_STRDUP("pypapi3");
        else
                t->mod =_STRDUP(v);
-       if (!update_env) store->table_api.column_find_string_end(cbat);
+       if (!update_env)
+               store->table_api.column_find_string_end(cbat);
        t->lang = (sql_flang) store->table_api.column_find_int(tr, 
find_sql_column(funcs, "language"), rid);
        t->instantiated = t->lang != FUNC_LANG_SQL && t->lang != FUNC_LANG_MAL;
        t->type = (sql_ftype) store->table_api.column_find_int(tr, 
find_sql_column(funcs, "type"), rid);
diff --git 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -438,4 +438,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
@@ -438,4 +438,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git 
a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -507,4 +507,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git 
a/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -438,4 +438,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out 
b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
@@ -438,4 +438,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
@@ -507,4 +507,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
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
@@ -78,4 +78,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
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
@@ -78,4 +78,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
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
@@ -147,4 +147,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git 
a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
@@ -147,4 +147,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
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
@@ -78,4 +78,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
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
@@ -78,4 +78,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
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
@@ -147,4 +147,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git 
a/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -438,4 +438,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
@@ -438,4 +438,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
+Running database upgrade commands:
+alter table sys.function_languages set read only;
+
diff --git 
a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -507,4 +507,12 @@ create view sys.describe_accessible_tabl
  where roles.name = current_role;
 GRANT SELECT ON sys.describe_accessible_tables TO PUBLIC;
 update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'describe_accessible_tables';
+alter table sys.function_languages set read write;
+delete from sys.function_languages where language_keyword like 'PYTHON%_MAP';
+update sys.functions set language = language - 1 where language in (7, 11);
+update sys.functions set mod = 'pyapi3' where mod in ('pyapi', 'pyapi3map');
+commit;
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to