Changeset: 556e91db1e7d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=556e91db1e7d
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
sql/backends/monet5/sql.mal
sql/backends/monet5/sql_upgrades.c
sql/scripts/17_temporal.sql
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/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: Apr2019
Log Message:
Fixes to date_trunc upgrade and removed date_trunc(daytime).
date_trunc(daytime) was defined but not implemented or used.
diffs (truncated from 413 to 300 lines):
diff --git a/clients/Tests/MAL-signatures.stable.out
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -11674,10 +11674,8 @@ Ready.
[ "sql", "cume_dist", "pattern sql.cume_dist(b:any_1, p:bit,
o:bit):dbl ", "SQLcume_dist;", "return the accumulated distribution
of the number of rows per group to the total number of partition rows" ]
[ "sql", "current_time", "pattern sql.current_time():daytime ",
"SQLcurrent_daytime;", "Get the clients current daytime" ]
[ "sql", "current_timestamp", "pattern
sql.current_timestamp():timestamp ", "SQLcurrent_timestamp;", "Get the
clients current timestamp" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:bat[:daytime]):bat[:daytime] ", "bat_date_trunc;", "Truncate a
timestamp to (millenium,
century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:bat[:timestamp]):bat[:timestamp] ", "bat_date_trunc;", "" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:daytime):daytime ", "date_trunc;", "Truncate a timestamp to
(millenium, century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:timestamp):timestamp ", "date_trunc;", "" ]
+[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:bat[:timestamp]):bat[:timestamp] ", "bat_date_trunc;", "Truncate
a timestamp to (millenium,
century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
+[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:timestamp):timestamp ", "date_trunc;", "Truncate a timestamp to
(millenium, century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
[ "sql", "db_users", "pattern sql.db_users():bat[:str] ",
"db_users_wrap;", "return table of users with sql scenario" ]
[ "sql", "dec_round", "command sql.dec_round(v:bte, r:bte):bte ",
"bte_dec_round_wrap;", "round off the value v to nearests multiple of r"
]
[ "sql", "dec_round", "command sql.dec_round(v:dbl, r:dbl):dbl ",
"dbl_dec_round_wrap;", "round off the value v to nearests multiple of r"
]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -16087,10 +16087,8 @@ Ready.
[ "sql", "cume_dist", "pattern sql.cume_dist(b:any_1, p:bit,
o:bit):dbl ", "SQLcume_dist;", "return the accumulated distribution
of the number of rows per group to the total number of partition rows" ]
[ "sql", "current_time", "pattern sql.current_time():daytime ",
"SQLcurrent_daytime;", "Get the clients current daytime" ]
[ "sql", "current_timestamp", "pattern
sql.current_timestamp():timestamp ", "SQLcurrent_timestamp;", "Get the
clients current timestamp" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:bat[:daytime]):bat[:daytime] ", "bat_date_trunc;", "Truncate a
timestamp to (millenium,
century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:bat[:timestamp]):bat[:timestamp] ", "bat_date_trunc;", "" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:daytime):daytime ", "date_trunc;", "Truncate a timestamp to
(millenium, century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
-[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:timestamp):timestamp ", "date_trunc;", "" ]
+[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:bat[:timestamp]):bat[:timestamp] ", "bat_date_trunc;", "Truncate
a timestamp to (millenium,
century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
+[ "sql", "date_trunc", "command sql.date_trunc(scale:str,
v:timestamp):timestamp ", "date_trunc;", "Truncate a timestamp to
(millenium, century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)" ]
[ "sql", "db_users", "pattern sql.db_users():bat[:str] ",
"db_users_wrap;", "return table of users with sql scenario" ]
[ "sql", "dec_round", "command sql.dec_round(v:bte, r:bte):bte ",
"bte_dec_round_wrap;", "round off the value v to nearests multiple of r"
]
[ "sql", "dec_round", "command sql.dec_round(v:dbl, r:dbl):dbl ",
"dbl_dec_round_wrap;", "round off the value v to nearests multiple of r"
]
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -912,17 +912,13 @@ command batcalc.daytime( v:bat[:daytime]
address batdaytime_2time_daytime
comment "cast daytime to daytime and check for overflow";
-command sql.date_trunc( scale:str, v:bat[:daytime]):bat[:daytime]
+command sql.date_trunc( scale:str, v:bat[:timestamp]):bat[:timestamp]
address bat_date_trunc
comment "Truncate a timestamp to (millenium,
century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)";
-command sql.date_trunc( scale:str, v:bat[:timestamp]):bat[:timestamp]
-address bat_date_trunc;
-command sql.date_trunc( scale:str, v:daytime):daytime
+command sql.date_trunc( scale:str, v:timestamp):timestamp
address date_trunc
comment "Truncate a timestamp to (millenium,
century,decade,year,quarter,month,week,day,hour,minute,second,
milliseconds,microseconds)";
-command sql.date_trunc( scale:str, v:timestamp):timestamp
-address date_trunc;
pattern current_time() :daytime
address SQLcurrent_daytime
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
@@ -1542,10 +1542,11 @@ sql_update_apr2019(Client c, mvc *sql)
/* 17_temporal.sql */
pos += snprintf(buf + pos, bufsize - pos,
- "drop function sys.date_trunc;\n"
"create function sys.date_trunc(txt string, t
timestamp)\n"
"returns timestamp\n"
- "external name sql.date_trunc;\n");
+ "external name sql.date_trunc;\n"
+ "grant execute on function sys.date_trunc(string,
timestamp) to public;\n"
+ "update sys.functions set system = true where schema_id
= (select id from sys.schemas where name = 'sys') and name = 'date_trunc' and
type = %d;\n", F_FUNC);
/* 26_sysmon.sql */
pos += snprintf(buf + pos, bufsize - pos,
diff --git a/sql/scripts/17_temporal.sql b/sql/scripts/17_temporal.sql
--- a/sql/scripts/17_temporal.sql
+++ b/sql/scripts/17_temporal.sql
@@ -25,3 +25,4 @@ grant execute on function sys."epoch" (T
create function sys.date_trunc(txt string, t timestamp)
returns timestamp
external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
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
@@ -5854,6 +5854,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
diff --git
a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
---
a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
+++
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128
@@ -5854,6 +5854,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5064,6 +5064,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5064,6 +5064,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5905,6 +5905,11 @@ commit;
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64
@@ -5064,6 +5064,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5905,6 +5905,11 @@ commit;
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5854,6 +5854,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5064,6 +5064,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5064,6 +5064,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5905,6 +5905,11 @@ commit;
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
diff --git a/sql/test/emptydb/Tests/check.stable.out
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -4576,6 +4576,7 @@ drop function pcre_replace(string, strin
[ "corr", "public", "EXECUTE", "monetdb", 0 ]
[ "corr", "public", "EXECUTE", "monetdb", 0 ]
[ "date_to_str", "public", "EXECUTE", "monetdb", 0
]
+[ "date_trunc", "public", "EXECUTE", "monetdb", 0
]
[ "degrees", "public", "EXECUTE", "monetdb", 0 ]
[ "env", "public", "EXECUTE", NULL, 0 ]
[ "epoch", "public", "EXECUTE", "monetdb", 0 ]
diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit
b/sql/test/emptydb/Tests/check.stable.out.32bit
--- a/sql/test/emptydb/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb/Tests/check.stable.out.32bit
@@ -4576,6 +4576,7 @@ drop function pcre_replace(string, strin
[ "corr", "public", "EXECUTE", "monetdb", 0 ]
[ "corr", "public", "EXECUTE", "monetdb", 0 ]
[ "date_to_str", "public", "EXECUTE", "monetdb", 0
]
+[ "date_trunc", "public", "EXECUTE", "monetdb", 0
]
[ "degrees", "public", "EXECUTE", "monetdb", 0 ]
[ "env", "public", "EXECUTE", NULL, 0 ]
[ "epoch", "public", "EXECUTE", "monetdb", 0 ]
diff --git a/sql/test/emptydb/Tests/check.stable.out.int128
b/sql/test/emptydb/Tests/check.stable.out.int128
--- a/sql/test/emptydb/Tests/check.stable.out.int128
+++ b/sql/test/emptydb/Tests/check.stable.out.int128
@@ -4794,6 +4794,7 @@ drop function pcre_replace(string, strin
[ "corr", "public", "EXECUTE", "monetdb", 0 ]
[ "corr", "public", "EXECUTE", "monetdb", 0 ]
[ "date_to_str", "public", "EXECUTE", "monetdb", 0
]
+[ "date_trunc", "public", "EXECUTE", "monetdb", 0
]
[ "degrees", "public", "EXECUTE", "monetdb", 0 ]
[ "env", "public", "EXECUTE", NULL, 0 ]
[ "epoch", "public", "EXECUTE", "monetdb", 0 ]
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
@@ -5854,6 +5854,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
+create function sys.date_trunc(txt string, t timestamp)
+returns timestamp
+external name sql.date_trunc;
+grant execute on function sys.date_trunc(string, timestamp) to public;
+update sys.functions set system = true where schema_id = (select id from
sys.schemas where name = 'sys') and name = 'date_trunc' and type = 1;
grant execute on function sys.queue to public;
grant select on sys.queue to public;
ALTER TABLE sys.keywords SET READ WRITE;
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
@@ -5063,6 +5063,11 @@ set schema "sys";
Running database upgrade commands:
set schema sys;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list