Changeset: 243d3bc294dd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/243d3bc294dd
Modified Files:
        sql/backends/monet5/sql_upgrades.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-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/upgrade.stable.out.int128
        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/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: cleanup_types
Log Message:

sys.time_to_str and sys.timestamp_to_str upgrade code.


diffs (truncated from 926 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
@@ -6630,18 +6630,31 @@ sql_update_default(Client c, mvc *sql, s
                if (BATcount(b) == 0) {
                        /* do update */
                        sql_table *t;
-                       const char *query = "drop function 
sys.dump_database(boolean);\n"
+                       const char *query =
+                               "drop function if exists sys.time_to_str(time 
with time zone, string) cascade;\n"
+                               "drop function if exists 
sys.timestamp_to_str(timestamp with time zone, string) cascade;\n"
+                               "create function time_to_str(d time, format 
string) returns string\n"
+                               " external name mtime.\"time_to_str\";\n"
+                               "create function time_to_str(d time with time 
zone, format string) returns string\n"
+                               " external name mtime.\"timetz_to_str\";\n"
+                               "create function timestamp_to_str(d timestamp 
with time zone, format string) returns string\n"
+                               " external name mtime.\"timestamptz_to_str\";\n"
+                               "grant execute on function time_to_str(time, 
string) to public;\n"
+                               "grant execute on function time_to_str(time 
with time zone, string) to public;\n"
+                               "grant execute on function 
timestamp_to_str(timestamp with time zone, string) to public;\n"
+                               "update sys.functions set system = true where 
not system and schema_id = 2000 and name in ('time_to_str', 
'timestamp_to_str');\n"
+                               "drop function if exists 
sys.dump_database(boolean) cascade;\n"
                                "drop view sys.dump_comments;\n"
                                "drop view sys.dump_tables;\n"
                                "drop view sys.dump_functions;\n"
                                "drop view sys.dump_function_grants;\n"
-                               "drop function sys.describe_columns(string, 
string);\n"
+                               "drop function if exists 
sys.describe_columns(string, string) cascade;\n"
                                "drop view sys.describe_functions;\n"
                                "drop view sys.describe_privileges;\n"
                                "drop view sys.describe_comments;\n"
                                "drop view sys.fully_qualified_functions;\n"
                                "drop view sys.describe_tables;\n"
-                               "drop function sys.describe_type(string, 
integer, integer);\n"
+                               "drop function if exists 
sys.describe_type(string, integer, integer) cascade;\n"
                                "CREATE FUNCTION sys.describe_type(ctype 
string, digits integer, tscale integer)\n"
                                " RETURNS string\n"
                                "BEGIN\n"
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
@@ -611,18 +611,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
@@ -611,18 +611,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
@@ -680,18 +680,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
@@ -611,18 +611,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
@@ -611,18 +611,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
@@ -680,18 +680,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
@@ -8,18 +8,30 @@ GRANT EXECUTE ON FUNCTION json.isvalid(j
 update sys.functions set system = true where system <> true and name = 
'isvalid' and schema_id = (select id from sys.schemas where name = 'json');
 
 Running database upgrade commands:
-drop function sys.dump_database(boolean);
+drop function if exists sys.time_to_str(time with time zone, string) cascade;
+drop function if exists sys.timestamp_to_str(timestamp with time zone, string) 
cascade;
+create function time_to_str(d time, format string) returns string
+ external name mtime."time_to_str";
+create function time_to_str(d time with time zone, format string) returns 
string
+ external name mtime."timetz_to_str";
+create function timestamp_to_str(d timestamp with time zone, format string) 
returns string
+ external name mtime."timestamptz_to_str";
+grant execute on function time_to_str(time, string) to public;
+grant execute on function time_to_str(time with time zone, string) to public;
+grant execute on function timestamp_to_str(timestamp with time zone, string) 
to public;
+update sys.functions set system = true where not system and schema_id = 2000 
and name in ('time_to_str', 'timestamp_to_str');
+drop function if exists sys.dump_database(boolean) cascade;
 drop view sys.dump_comments;
 drop view sys.dump_tables;
 drop view sys.dump_functions;
 drop view sys.dump_function_grants;
-drop function sys.describe_columns(string, string);
+drop function if exists sys.describe_columns(string, string) cascade;
 drop view sys.describe_functions;
 drop view sys.describe_privileges;
 drop view sys.describe_comments;
 drop view sys.fully_qualified_functions;
 drop view sys.describe_tables;
-drop function sys.describe_type(string, integer, integer);
+drop function if exists sys.describe_type(string, integer, integer) cascade;
 CREATE FUNCTION sys.describe_type(ctype string, digits integer, tscale integer)
  RETURNS string
 BEGIN
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
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to