Changeset: 28d78afed765 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/28d78afed765
Modified Files:
        
sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
        sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64
        
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
Branch: default
Log Message:

Power8 upgrades.


diffs (truncated from 2135 to 300 lines):

diff --git 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
--- 
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
+++ 
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
@@ -3333,7 +3333,7 @@ insert into sys.functions values (888, '
 insert into sys.args values (43829, 888, 'res_0', 'int', 32, 0, 0, 0);
 insert into sys.args values (43830, 888, 'arg_1', 'date', 0, 0, 1, 1);
 insert into sys.functions values (889, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43831, 889, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43831, 889, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43832, 889, 'arg_1', 'date', 0, 0, 1, 1);
 insert into sys.functions values (890, 'hour', 'hours', 'mtime', 0, 1, false, 
false, false, 2000, true, false);
 insert into sys.args values (43833, 890, 'res_0', 'int', 32, 0, 0, 0);
@@ -3345,7 +3345,7 @@ insert into sys.functions values (892, '
 insert into sys.args values (43837, 892, 'res_0', 'decimal', 9, 6, 0, 0);
 insert into sys.args values (43838, 892, 'arg_1', 'time', 7, 0, 1, 1);
 insert into sys.functions values (893, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43839, 893, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43839, 893, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43840, 893, 'arg_1', 'time', 7, 0, 1, 1);
 insert into sys.functions values (894, 'hour', 'hours', 'mtime', 0, 1, false, 
false, false, 2000, true, false);
 insert into sys.args values (43841, 894, 'res_0', 'int', 32, 0, 0, 0);
@@ -3357,7 +3357,7 @@ insert into sys.functions values (896, '
 insert into sys.args values (43845, 896, 'res_0', 'decimal', 9, 6, 0, 0);
 insert into sys.args values (43846, 896, 'arg_1', 'timetz', 7, 0, 1, 1);
 insert into sys.functions values (897, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43847, 897, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43847, 897, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43848, 897, 'arg_1', 'timetz', 7, 0, 1, 1);
 insert into sys.functions values (898, 'century', 'century', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
 insert into sys.args values (43849, 898, 'res_0', 'int', 32, 0, 0, 0);
@@ -3387,7 +3387,7 @@ insert into sys.functions values (906, '
 insert into sys.args values (43865, 906, 'res_0', 'decimal', 9, 6, 0, 0);
 insert into sys.args values (43866, 906, 'arg_1', 'timestamp', 7, 0, 1, 1);
 insert into sys.functions values (907, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43867, 907, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43867, 907, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43868, 907, 'arg_1', 'timestamp', 7, 0, 1, 1);
 insert into sys.functions values (908, 'century', 'century', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
 insert into sys.args values (43869, 908, 'res_0', 'int', 32, 0, 0, 0);
@@ -3417,7 +3417,7 @@ insert into sys.functions values (916, '
 insert into sys.args values (43885, 916, 'res_0', 'decimal', 9, 6, 0, 0);
 insert into sys.args values (43886, 916, 'arg_1', 'timestamptz', 7, 0, 1, 1);
 insert into sys.functions values (917, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43887, 917, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43887, 917, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43888, 917, 'arg_1', 'timestamptz', 7, 0, 1, 1);
 insert into sys.functions values (918, 'year', 'year', 'mtime', 0, 1, false, 
false, false, 2000, true, false);
 insert into sys.args values (43889, 918, 'res_0', 'int', 32, 0, 0, 0);
@@ -3438,7 +3438,7 @@ insert into sys.functions values (923, '
 insert into sys.args values (43899, 923, 'res_0', 'int', 32, 0, 0, 0);
 insert into sys.args values (43900, 923, 'arg_1', 'day_interval', 4, 0, 1, 1);
 insert into sys.functions values (924, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43901, 924, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43901, 924, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43902, 924, 'arg_1', 'day_interval', 4, 0, 1, 1);
 insert into sys.functions values (925, 'day', 'day', 'mtime', 0, 1, false, 
false, false, 2000, true, false);
 insert into sys.args values (43903, 925, 'res_0', 'bigint', 64, 0, 0, 0);
@@ -3453,7 +3453,7 @@ insert into sys.functions values (928, '
 insert into sys.args values (43909, 928, 'res_0', 'int', 32, 0, 0, 0);
 insert into sys.args values (43910, 928, 'arg_1', 'sec_interval', 13, 0, 1, 1);
 insert into sys.functions values (929, 'epoch_ms', 'epoch_ms', 'mtime', 0, 1, 
false, false, false, 2000, true, false);
-insert into sys.args values (43911, 929, 'res_0', 'bigint', 64, 0, 0, 0);
+insert into sys.args values (43911, 929, 'res_0', 'decimal', 18, 3, 0, 0);
 insert into sys.args values (43912, 929, 'arg_1', 'sec_interval', 13, 0, 1, 1);
 insert into sys.functions values (930, 'next_value_for', 'next_value', 'sql', 
0, 1, true, false, false, 2000, true, true);
 insert into sys.args values (43913, 930, 'res_0', 'bigint', 64, 0, 0, 0);
@@ -5114,3 +5114,639 @@ GRANT SELECT ON sys.dependencies_vw TO P
 UPDATE sys._tables SET system = true WHERE name in ('ids', 'dependencies_vw') 
AND schema_id = 2000;
 set schema "sys";
 
+Running database upgrade commands:
+set schema "sys";
+update sys.args set type = 'decimal', type_digits = 18, type_scale = 3 where 
func_id in (select id from sys.functions where name = 'epoch_ms' and schema_id 
= 2000) and number = 0 and type = 'bigint';
+drop view sys.tracelog;
+drop function sys.tracelog();
+create function sys.tracelog()
+ returns table (
+  ticks bigint, -- time in microseconds
+  stmt string,  -- actual statement executed
+  event string  -- profiler event executed
+ )
+ external name sql.dump_trace;
+create view sys.tracelog as select * from sys.tracelog();
+update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'tracelog';
+update sys.functions set system = true where system <> true and schema_id = 
2000 and name = 'tracelog' and type = 5;
+drop function sys.epoch(bigint);
+create function sys.epoch(sec DECIMAL(18,3)) returns TIMESTAMP WITH TIME ZONE
+external name mtime.epoch;
+grant execute on function sys.epoch (DECIMAL(18,3)) to public;
+update sys.functions set system = true where system <> true and name in 
('epoch') and schema_id = 2000 and type = 1;
+set schema "sys";
+create view sys.malfunctions as select * from sys.malfunctions();
+update sys._tables set system = true where system <> true and schema_id = 2000 
and name = 'malfunctions';
+drop view sys.dependencies_vw;
+drop view sys.ids;
+CREATE VIEW sys.ids (id, name, schema_id, table_id, table_name, obj_type, 
sys_table, system) AS
+SELECT id, name, cast(null as int) as schema_id, cast(null as int) as 
table_id, cast(null as varchar(124)) as table_name, 'author' AS obj_type, 
'sys.auths' AS sys_table, (name in ('public','sysadmin','monetdb','.snapshot')) 
AS system FROM sys.auths UNION ALL
+SELECT id, name, cast(null as int) as schema_id, cast(null as int) as 
table_id, cast(null as varchar(124)) as table_name, ifthenelse(system, 'system 
schema', 'schema'), 'sys.schemas', system FROM sys.schemas UNION ALL
+SELECT t.id, name, t.schema_id, t.id as table_id, t.name as table_name, 
cast(lower(tt.table_type_name) as varchar(40)), 'sys.tables', t.system FROM 
sys.tables t left outer join sys.table_types tt on t.type = tt.table_type_id 
UNION ALL
+SELECT c.id, c.name, t.schema_id, c.table_id, t.name as table_name, 
ifthenelse(t.system, 'system column', 'column'), 'sys._columns', t.system FROM 
sys._columns c JOIN sys._tables t ON c.table_id = t.id UNION ALL
+SELECT c.id, c.name, t.schema_id, c.table_id, t.name as table_name, 'column', 
'tmp._columns', t.system FROM tmp._columns c JOIN tmp._tables t ON c.table_id = 
t.id UNION ALL
+SELECT k.id, k.name, t.schema_id, k.table_id, t.name as table_name, 
ifthenelse(t.system, 'system key', 'key'), 'sys.keys', t.system FROM sys.keys k 
JOIN sys._tables t ON k.table_id = t.id UNION ALL
+SELECT k.id, k.name, t.schema_id, k.table_id, t.name as table_name, 'key', 
'tmp.keys', t.system FROM tmp.keys k JOIN tmp._tables t ON k.table_id = t.id 
UNION ALL
+SELECT i.id, i.name, t.schema_id, i.table_id, t.name as table_name, 
ifthenelse(t.system, 'system index', 'index'), 'sys.idxs', t.system FROM 
sys.idxs i JOIN sys._tables t ON i.table_id = t.id UNION ALL
+SELECT i.id, i.name, t.schema_id, i.table_id, t.name as table_name, 'index' , 
'tmp.idxs', t.system FROM tmp.idxs i JOIN tmp._tables t ON i.table_id = t.id 
UNION ALL
+SELECT g.id, g.name, t.schema_id, g.table_id, t.name as table_name, 
ifthenelse(t.system, 'system trigger', 'trigger'), 'sys.triggers', t.system 
FROM sys.triggers g JOIN sys._tables t ON g.table_id = t.id UNION ALL
+SELECT g.id, g.name, t.schema_id, g.table_id, t.name as table_name, 'trigger', 
'tmp.triggers', t.system FROM tmp.triggers g JOIN tmp._tables t ON g.table_id = 
t.id UNION ALL
+SELECT f.id, f.name, f.schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, cast(ifthenelse(f.system, 'system ', '') || 
lower(ft.function_type_keyword) as varchar(40)), 'sys.functions', f.system FROM 
sys.functions f left outer join sys.function_types ft on f.type = 
ft.function_type_id UNION ALL
+SELECT a.id, a.name, f.schema_id, a.func_id as table_id, f.name as table_name, 
cast(ifthenelse(f.system, 'system ', '') || lower(ft.function_type_keyword) || 
' arg' as varchar(44)), 'sys.args', f.system FROM sys.args a JOIN sys.functions 
f ON a.func_id = f.id left outer join sys.function_types ft on f.type = 
ft.function_type_id UNION ALL
+SELECT id, name, schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, 'sequence', 'sys.sequences', false FROM 
sys.sequences UNION ALL
+SELECT o.id, o.name, pt.schema_id, pt.id, pt.name, 'partition of merge table', 
'sys.objects', false FROM sys.objects o JOIN sys._tables pt ON o.sub = pt.id 
JOIN sys._tables mt ON o.nr = mt.id WHERE mt.type = 3 UNION ALL
+SELECT id, sqlname, schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, 'type', 'sys.types', (sqlname in 
('inet','json','url','uuid')) FROM sys.types WHERE id > 2000
+ ORDER BY id;
+GRANT SELECT ON sys.ids TO PUBLIC;
+CREATE VIEW sys.dependencies_vw AS
+SELECT d.id, i1.obj_type, i1.name,
+       d.depend_id as used_by_id, i2.obj_type as used_by_obj_type, i2.name as 
used_by_name,
+       d.depend_type, dt.dependency_type_name
+  FROM sys.dependencies d
+  JOIN sys.ids i1 ON d.id = i1.id
+  JOIN sys.ids i2 ON d.depend_id = i2.id
+  JOIN sys.dependency_types dt ON d.depend_type = dt.dependency_type_id
+ ORDER BY id, depend_id;
+GRANT SELECT ON sys.dependencies_vw TO PUBLIC;
+UPDATE sys._tables SET system = true WHERE name in ('ids', 'dependencies_vw') 
AND schema_id = 2000;
+drop function sys.dump_database(boolean);
+drop procedure sys.dump_table_data();
+drop procedure sys._dump_table_data(string, string);
+drop function sys.prepare_esc(string, string);
+drop function sys.esc(string);
+drop view sys.dump_privileges;
+drop view sys.dump_user_defined_types;
+drop view sys.dump_comments;
+drop view sys.dump_triggers;
+drop view sys.dump_tables;
+drop view sys.dump_functions;
+drop view sys.dump_start_sequences;
+drop view sys.dump_sequences;
+drop view sys.dump_partition_tables;
+drop view sys.dump_foreign_keys;
+drop view sys.dump_column_defaults;
+drop view sys.dump_indices;
+drop view sys.dump_table_constraint_type;
+drop view sys.dump_grant_user_privileges;
+drop view sys.dump_add_schemas_to_users;
+drop view sys.dump_create_schemas;
+drop view sys.dump_create_users;
+drop view sys.dump_create_roles;
+drop view sys.describe_functions;
+drop view sys.describe_partition_tables;
+drop view sys.describe_privileges;
+drop view sys.describe_comments;
+drop view sys.describe_tables;
+drop function sys.get_remote_table_expressions(string, string);
+drop function sys.get_merge_table_partition_expressions(int);
+drop view sys.describe_constraints;
+drop function sys.alter_table(string, string);
+drop function sys.sq(string);
+CREATE FUNCTION sys.SQ (s STRING) RETURNS STRING BEGIN RETURN '''' || 
sys.replace(s,'''','''''') || ''''; END;
+CREATE FUNCTION sys.ALTER_TABLE(s STRING, t STRING) RETURNS STRING BEGIN 
RETURN 'ALTER TABLE ' || sys.FQN(s, t); END;
+CREATE VIEW sys.describe_constraints AS
+       SELECT
+               s.name sch,
+               t.name tbl,
+               kc.name col,
+               k.name con,
+               CASE k.type WHEN 0 THEN 'PRIMARY KEY' WHEN 1 THEN 'UNIQUE' END 
tpe
+       FROM sys.schemas s, sys._tables t, sys.objects kc, sys.keys k
+       WHERE kc.id = k.id
+               AND k.table_id = t.id
+               AND s.id = t.schema_id
+               AND t.system = FALSE
+               AND k.type in (0, 1);
+CREATE FUNCTION sys.get_merge_table_partition_expressions(tid INT) RETURNS 
STRING
+BEGIN
+       RETURN
+               SELECT
+                       CASE WHEN tp.table_id IS NOT NULL THEN
+                               ' PARTITION BY ' ||
+                               ifthenelse(bit_and(tp.type, 2) = 2, 'VALUES ', 
'RANGE ') ||
+                               CASE
+                                       WHEN bit_and(tp.type, 4) = 4
+                                       THEN 'ON ' || '(' || (SELECT 
sys.DQ(c.name) || ')' FROM sys.columns c WHERE c.id = tp.column_id)
+                                       ELSE 'USING ' || '(' || tp.expression 
|| ')'
+                               END
+                       ELSE
+                               ''
+                       END
+               FROM (VALUES (tid)) t(id) LEFT JOIN sys.table_partitions tp ON 
t.id = tp.table_id;
+END;
+CREATE FUNCTION sys.get_remote_table_expressions(s STRING, t STRING) RETURNS 
STRING BEGIN
+       RETURN SELECT ' ON ' || sys.SQ(uri) || ' WITH USER ' || 
sys.SQ(username) || ' ENCRYPTED PASSWORD ' || sys.SQ("hash") FROM 
sys.remote_table_credentials(s ||'.' || t);
+END;
+CREATE VIEW sys.describe_tables AS
+       SELECT
+               t.id o,
+               s.name sch,
+               t.name tab,
+               ts.table_type_name typ,
+               (SELECT
+                       ' (' ||
+                       GROUP_CONCAT(
+                               sys.DQ(c.name) || ' ' ||
+                               sys.describe_type(c.type, c.type_digits, 
c.type_scale) ||
+                               ifthenelse(c."null" = 'false', ' NOT NULL', '')
+                       , ', ') || ')'
+               FROM sys._columns c
+               WHERE c.table_id = t.id) col,
+               CASE ts.table_type_name
+                       WHEN 'REMOTE TABLE' THEN
+                               sys.get_remote_table_expressions(s.name, t.name)
+                       WHEN 'MERGE TABLE' THEN
+                               sys.get_merge_table_partition_expressions(t.id)
+                       WHEN 'VIEW' THEN
+                               sys.schema_guard(s.name, t.name, t.query)
+                       ELSE
+                               ''
+               END opt
+       FROM sys.schemas s, sys.table_types ts, sys.tables t
+       WHERE ts.table_type_name IN ('TABLE', 'VIEW', 'MERGE TABLE', 'REMOTE 
TABLE', 'REPLICA TABLE')
+               AND t.system = FALSE
+               AND s.id = t.schema_id
+               AND ts.table_type_id = t.type
+               AND s.name <> 'tmp';
+CREATE VIEW sys.describe_comments AS
+               SELECT
+                       o.id id,
+                       o.tpe tpe,
+                       o.nme fqn,
+                       c.remark rem
+               FROM (
+                       SELECT id, 'SCHEMA', sys.DQ(name) FROM sys.schemas
+                       UNION ALL
+                       SELECT t.id, ifthenelse(ts.table_type_name = 'VIEW', 
'VIEW', 'TABLE'), sys.FQN(s.name, t.name)
+                       FROM sys.schemas s JOIN sys.tables t ON s.id = 
t.schema_id JOIN sys.table_types ts ON t.type = ts.table_type_id
+                       WHERE s.name <> 'tmp'
+                       UNION ALL
+                       SELECT c.id, 'COLUMN', sys.FQN(s.name, t.name) || '.' 
|| sys.DQ(c.name) FROM sys.columns c, sys.tables t, sys.schemas s WHERE 
c.table_id = t.id AND t.schema_id = s.id
+                       UNION ALL
+                       SELECT idx.id, 'INDEX', sys.FQN(s.name, idx.name) FROM 
sys.idxs idx, sys._tables t, sys.schemas s WHERE idx.table_id = t.id AND 
t.schema_id = s.id
+                       UNION ALL
+                       SELECT seq.id, 'SEQUENCE', sys.FQN(s.name, seq.name) 
FROM sys.sequences seq, sys.schemas s WHERE seq.schema_id = s.id
+                       UNION ALL
+                       SELECT f.id, ft.function_type_keyword, sys.FQN(s.name, 
f.name) FROM sys.functions f, sys.function_types ft, sys.schemas s WHERE f.type 
= ft.function_type_id AND f.schema_id = s.id
+                       ) AS o(id, tpe, nme)
+                       JOIN sys.comments c ON c.id = o.id;
+CREATE VIEW sys.describe_privileges AS
+       SELECT
+               CASE
+                       WHEN o.tpe IS NULL AND pc.privilege_code_name = 
'SELECT' THEN --GLOBAL privileges: SELECT maps to COPY FROM
+                               'COPY FROM'
+                       WHEN o.tpe IS NULL AND pc.privilege_code_name = 
'UPDATE' THEN --GLOBAL privileges: UPDATE maps to COPY INTO
+                               'COPY INTO'
+                       ELSE
+                               o.nme
+               END o_nme,
+               coalesce(o.tpe, 'GLOBAL') o_tpe,
+               pc.privilege_code_name p_nme,
+               a.name a_nme,
+               g.name g_nme,
+               p.grantable grantable
+       FROM
+               sys.privileges p LEFT JOIN
+               (
+               SELECT t.id, s.name || '.' || t.name , 'TABLE'
+                       from sys.schemas s, sys.tables t where s.id = 
t.schema_id
+               UNION ALL
+                       SELECT c.id, s.name || '.' || t.name || '.' || c.name, 
'COLUMN'
+                       FROM sys.schemas s, sys.tables t, sys.columns c where 
s.id = t.schema_id AND t.id = c.table_id
+               UNION ALL
+                       SELECT f.id, f.nme, f.tpe
+                       FROM sys.fully_qualified_functions f
+               ) o(id, nme, tpe) ON o.id = p.obj_id,
+               sys.privilege_codes pc,
+               auths a, auths g
+       WHERE
+               p.privileges = pc.privilege_code_id AND
+               p.auth_id = a.id AND
+               p.grantor = g.id;
+CREATE VIEW sys.describe_partition_tables AS
+       SELECT 
+               m_sch,
+               m_tbl,
+               p_sch,
+               p_tbl,
+               CASE
+                       WHEN p_raw_type IS NULL THEN 'READ ONLY'
+                       WHEN (p_raw_type = 'VALUES' AND pvalues IS NULL) OR 
(p_raw_type = 'RANGE' AND minimum IS NULL AND maximum IS NULL AND with_nulls) 
THEN 'FOR NULLS'
+                       ELSE p_raw_type
+               END AS tpe,
+               pvalues,
+               minimum,
+               maximum,
+               with_nulls
+       FROM 
+    (WITH
+               tp("type", table_id) AS
+               (SELECT ifthenelse((table_partitions."type" & 2) = 2, 'VALUES', 
'RANGE'), table_partitions.table_id FROM sys.table_partitions),
+               subq(m_tid, p_mid, "type", m_sch, m_tbl, p_sch, p_tbl) AS
+               (SELECT m_t.id, p_m.id, m_t."type", m_s.name, m_t.name, 
p_s.name, p_m.name
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to