Changeset: b6d54ca6ce9d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b6d54ca6ce9d Modified Files: Branch: default Log Message:
Merge with Oct2010 branch. diffs (truncated from 1050 to 300 lines): diff -r 7ea23908ca99 -r b6d54ca6ce9d clients/src/mapiclient/dump.c --- a/clients/src/mapiclient/dump.c Thu Sep 09 14:14:47 2010 +0200 +++ b/clients/src/mapiclient/dump.c Thu Sep 09 15:04:13 2010 +0200 @@ -113,7 +113,8 @@ if ((hdl = mapi_query(mid, "SELECT \"t\".\"id\" " - "FROM \"_tables\" \"t\", \"schemas\" \"s\" " + "FROM \"sys\".\"_tables\" \"t\"," + "\"sys\".\"schemas\" \"s\" " "WHERE \"t\".\"name\" = 'systemfunctions' AND " "\"t\".\"schema_id\" = \"s\".\"id\" AND " "\"s\".\"name\" = 'sys'")) == NULL || diff -r 7ea23908ca99 -r b6d54ca6ce9d sql/src/sql/system.sql --- a/sql/src/sql/system.sql Thu Sep 09 14:14:47 2010 +0200 +++ b/sql/src/sql/system.sql Thu Sep 09 15:04:13 2010 +0200 @@ -1,5 +1,6 @@ create table systemfunctions (function_id) as (select id from functions) with data; +grant select on systemfunctions to public; update _tables set system = true where name = 'systemfunctions' diff -r 7ea23908ca99 -r b6d54ca6ce9d sql/src/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out --- a/sql/src/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out Thu Sep 09 14:14:47 2010 +0200 +++ b/sql/src/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out Thu Sep 09 15:04:13 2010 +0200 @@ -32,196 +32,6 @@ START TRANSACTION; SET SCHEMA "sys"; -create function degrees(r double) -returns double - return r*180/pi(); -create function radians(d double) -returns double - return d*pi()/180; -CREATE TABLE "sys"."url_test" ( - "theurl" URL, - "name" CHARACTER LARGE OBJECT -); -CREATE TABLE "sys"."queryhistory" ( - "id" BIGINT NOT NULL, - "defined" TIMESTAMP, - "name" CHARACTER LARGE OBJECT, - "query" CHARACTER LARGE OBJECT, - "parse" BIGINT, - "optimize" BIGINT, - CONSTRAINT "queryhistory_id_pkey" PRIMARY KEY ("id") -); -CREATE TABLE "sys"."callhistory" ( - "id" BIGINT, - "ctime" TIMESTAMP, - "arguments" CHARACTER LARGE OBJECT, - "execute" BIGINT, - "result" BIGINT, - "foot" BIGINT, - "memory" BIGINT, - "tuples" BIGINT, - "inblock" BIGINT, - "oublock" BIGINT -); -create view querylog as -select qd.*, ql.ctime, ql.arguments, ql.exec, ql.result, ql.foot, ql.memory, ql.tuples, ql.inblock, ql.oublock from queryhistory qd, callhistory ql -where qd.id = ql.id; --- the signature is used in the kernel, don't change it -create procedure keepquery( - i wrd, - query string, - parse bigint, - optimize bigint) -begin - insert into queryhistory - values(i, now(), user, query, parse, optimize); -end; --- the signature is used in the kernel, don't change it -create procedure keepcall( - id wrd, -- references query plan - ctime timestamp, -- time the first statement was executed - arguments string, - xtime bigint, -- time from the first statement until result export - rtime bigint, -- time to ship the result to the client - foot bigint, -- footprint for all bats in the plan - memory bigint, -- storage size of intermediates created - tuples wrd, -- number of tuples in the result set - inblock bigint, -- number of physical blocks read - oublock bigint -- number of physical blocks written -) -begin - insert into callhistory - values( id, ctime, arguments, xtime, rtime, - foot, memory, tuples, inblock, oublock ); -end; -create procedure resethistory() -begin - delete from callhistory; - delete from queryhistory; -end; --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html --- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Copyright August 2008-2010 MonetDB B.V. --- All Rights Reserved. - ---Schema s has a dependency on user u -create function dependencies_schemas_on_users() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select s.name, u.name, 'DEP_USER' from schemas as s, users u where u.default_schema = s.id); ---User (owner) has a dependency in schema s -create function dependencies_owners_on_schemas() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select a.name, s.name, 'DEP_SCHEMA' from schemas as s, auths a where s.owner = a.id); ---Table t has a dependency on view v -create function dependencies_tables_on_views() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, v.name, 'DEP_VIEW' from tables as t, tables as v, dependencies as dep where t.id = dep.id and v.id = dep.depend_id and dep.depend_type = 5 and v.type = 1); ---Table t has a dependency on index i -create function dependencies_tables_on_indexes() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, i.name, 'DEP_INDEX' from tables as t, idxs as i where i.table_id = t.id and i.name not in (select name from keys) and t.type = 0); ---Table t has a dependency on trigger tri - -create function dependencies_tables_on_triggers() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table ((select t.name, tri.name, 'DEP_TRIGGER' from tables as t, triggers as tri where tri.table_id = t.id) union (select t.name, tri.name, 'DEP_TRIGGER' from triggers tri, tables t, dependencies dep where dep.id = t.id and dep.depend_id =tri.id and dep.depend_type = 8)); ---Table t has a dependency on foreign key k -create function dependencies_tables_on_foreignkeys() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, fk.name, 'DEP_FKEY' from tables as t, keys as k, keys as fk where fk.rkey = k.id and k.table_id = t.id); ---Table t has a dependency on function f -create function dependencies_tables_on_functions() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, f.name, 'DEP_FUNC' from functions as f, tables as t, dependencies as dep where t.id = dep.id and f.id = dep.depend_id and dep.depend_type = 7 and t.type = 0); ---Column c has a dependency on view v -create function dependencies_columns_on_views() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select c.name, v.name, 'DEP_VIEW' from columns as c, tables as v, dependencies as dep where c.id = dep.id and v.id = dep.depend_id and dep.depend_type = 5 and v.type = 1); ---Column c has a dependency on key k -create function dependencies_columns_on_keys() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select c.name, k.name, 'DEP_KEY' from columns as c, keycolumns as kc, keys as k where kc."column" = c.name and kc.id = k.id and k.table_id = c.table_id and k.rkey = -1); ---Column c has a dependency on index i -create function dependencies_columns_on_indexes() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select c.name, i.name, 'DEP_INDEX' from columns as c, keycolumns as kc, idxs as i where kc."column" = c.name and kc.id = i.id and c.table_id = i.table_id and i.name not in (select name from keys)); ---Column c has a dependency on function f -create function dependencies_columns_on_functions() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select c.name, f.name, 'DEP_FUNC' from functions as f, columns as c, dependencies as dep where c.id = dep.id and f.id = dep.depend_id and dep.depend_type = 7); ---Column c has a dependency on trigger tri -create function dependencies_columns_on_triggers() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select c.name, tri.name, 'DEP_TRIGGER' from columns as c, triggers as tri, dependencies as dep where dep.id = c.id and dep.depend_id =tri.id and dep.depend_type = 8); ---View v has a dependency on function f -create function dependencies_views_on_functions() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select v.name, f.name, 'DEP_FUNC' from functions as f, tables as v, dependencies as dep where v.id = dep.id and f.id = dep.depend_id and dep.depend_type = 7 and v.type = 1); ---View v has a dependency on trigger tri -create function dependencies_views_on_triggers() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select v.name, tri.name, 'DEP_TRIGGER' from tables as v, triggers as tri, dependencies as dep where dep.id = v.id and dep.depend_id =tri.id and dep.depend_type = 8 and v.type = 1); ---Function f1 has a dependency on function f2 -create function dependencies_functions_on_functions() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select f1.name, f2.name, 'DEP_FUNC' from functions as f1, functions as f2, dependencies as dep where f1.id = dep.id and f2.id = dep.depend_id and dep.depend_type = 7); ---Function f1 has a dependency on trigger tri -create function dependencies_functions_os_triggers() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select f.name, tri.name, 'DEP_TRIGGER' from functions as f, triggers as tri, dependencies as dep where dep.id = f.id and dep.depend_id =tri.id and dep.depend_type = 8); ---Key k has a dependency on foreign key fk -create function dependencies_keys_on_foreignkeys() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select k.name, fk.name, 'DEP_FKEY' from keys as k, keys as fk where fk.rkey = k.id); --- Scientific database section --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html --- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Copyright August 2008-2010 MonetDB B.V. --- All Rights Reserved. - -create function ms_stuff( s1 varchar(32), st int, len int, s3 varchar(32)) -returns varchar(32) -begin - declare res varchar(32), aux varchar(32); - declare ofset int; - set ofset = 0; - set res = substring(s1,ofset,st-1); - set res = res || s3; - set ofset = length(s1)-len; - set aux = substring(s1,ofset, len); - set res = res || aux; - return res; -end; -create function ms_round(num float, precision int, truncat int) -returns float -begin - if (truncat = 0) - then return round(num, precision); - else return round(floor(num), precision); - end if; -end; CREATE TABLE "sys"."table_a" ( "table_a_id" INTEGER NOT NULL, "value_a" INTEGER NOT NULL, @@ -245,7 +55,6 @@ "value_c" INTEGER NOT NULL, CONSTRAINT "pk_table_c_id" PRIMARY KEY ("table_c_id") ); -ALTER TABLE "sys"."callhistory" ADD CONSTRAINT "callhistory_id_fkey" FOREIGN KEY ("id") REFERENCES "sys"."queryhistory" ("id"); ALTER TABLE "sys"."table_b" ADD CONSTRAINT "fk_table_a_id" FOREIGN KEY ("table_a_id") REFERENCES "sys"."table_a" ("table_a_id"); ALTER TABLE "sys"."table_c" ADD CONSTRAINT "fk_table_c_table_a_id" FOREIGN KEY ("table_a_id") REFERENCES "sys"."table_a" ("table_a_id"); ALTER TABLE "sys"."table_c" ADD CONSTRAINT "fk_table_c_table_d_id" FOREIGN KEY ("table_d_id") REFERENCES "sys"."table_b" ("table_b_id"); diff -r 7ea23908ca99 -r b6d54ca6ce9d sql/src/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out --- a/sql/src/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out Thu Sep 09 14:14:47 2010 +0200 +++ b/sql/src/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out Thu Sep 09 15:04:13 2010 +0200 @@ -27,139 +27,6 @@ START TRANSACTION; SET SCHEMA "sys"; -create function degrees(r double) -returns double - return r*180/pi(); -create function radians(d double) -returns double - return d*pi()/180; -CREATE TABLE "sys"."url_test" ( - "theurl" URL, - "name" CHARACTER LARGE OBJECT -); --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html --- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Copyright August 2008-2010 MonetDB B.V. --- All Rights Reserved. - ---Schema s has a dependency on user u -create function dependencies_schemas_on_users() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select s.name, u.name, 'DEP_USER' from schemas as s, users u where u.default_schema = s.id); ---User (owner) has a dependency in schema s -create function dependencies_owners_on_schemas() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select a.name, s.name, 'DEP_SCHEMA' from schemas as s, auths a where s.owner = a.id); ---Table t has a dependency on view v -create function dependencies_tables_on_views() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, v.name, 'DEP_VIEW' from tables as t, tables as v, dependencies as dep where t.id = dep.id and v.id = dep.depend_id and dep.depend_type = 5 and v.type = 1); ---Table t has a dependency on index i -create function dependencies_tables_on_indexes() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, i.name, 'DEP_INDEX' from tables as t, idxs as i where i.table_id = t.id and i.name not in (select name from keys) and t.type = 0); ---Table t has a dependency on trigger tri - -create function dependencies_tables_on_triggers() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table ((select t.name, tri.name, 'DEP_TRIGGER' from tables as t, triggers as tri where tri.table_id = t.id) union (select t.name, tri.name, 'DEP_TRIGGER' from triggers tri, tables t, dependencies dep where dep.id = t.id and dep.depend_id =tri.id and dep.depend_type = 8)); ---Table t has a dependency on foreign key k -create function dependencies_tables_on_foreignkeys() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, fk.name, 'DEP_FKEY' from tables as t, keys as k, keys as fk where fk.rkey = k.id and k.table_id = t.id); ---Table t has a dependency on function f -create function dependencies_tables_on_functions() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select t.name, f.name, 'DEP_FUNC' from functions as f, tables as t, dependencies as dep where t.id = dep.id and f.id = dep.depend_id and dep.depend_type = 7 and t.type = 0); ---Column c has a dependency on view v -create function dependencies_columns_on_views() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) -return table (select c.name, v.name, 'DEP_VIEW' from columns as c, tables as v, dependencies as dep where c.id = dep.id and v.id = dep.depend_id and dep.depend_type = 5 and v.type = 1); ---Column c has a dependency on key k -create function dependencies_columns_on_keys() -returns table (sch varchar(100), usr varchar(100), dep_type varchar(32)) _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list