Changeset: 7ad41480283e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ad41480283e Modified Files: clients/mapiclient/dump.c sql/include/sql_catalog.h sql/scripts/99_system.sql sql/storage/store.c sql/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out sql/test/BugDay_2005-11-09_2.8/Tests/ORDER_BY_evaluation_error.SF-1023658.stable.out sql/test/BugTracker-2009/Tests/join_topn.SF-2654133.stable.out sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out sql/test/BugTracker-2011/Tests/like_or.Bug-2924.stable.out sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err sql/test/BugTracker/Tests/multi-column-constraint.SF-1964587.stable.out sql/test/Dump/Tests/dump-empty.stable.out sql/test/Dump/Tests/dump.stable.out sql/test/UserDump/Tests/create.stable.out sql/test/bugs/Tests/select_orderby_alias-bug-sf-1024615.stable.out sql/test/leaks/Tests/check0.stable.out sql/test/leaks/Tests/check1.stable.out sql/test/leaks/Tests/check2.stable.out sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check5.stable.out sql/test/leaks/Tests/drop3.stable.out sql/test/leaks/Tests/select1.stable.out sql/test/leaks/Tests/select2.stable.out sql/test/leaks/Tests/temp1.stable.out sql/test/leaks/Tests/temp2.stable.out sql/test/leaks/Tests/temp3.stable.out sql/test/mapi/Tests/php_monetdb.stable.out Branch: default Log Message:
added extra column to the schemas table to store if a schema is a system schema. We non longer dump system schema's. Solves problems with the rdf and json schema. Re approved many tests according to this change. diffs (truncated from 855 to 300 lines): diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -1489,14 +1489,14 @@ dump_database(Mapi mid, stream *toConsol "FROM \"sys\".\"schemas\" \"s\", " "\"sys\".\"auths\" \"a\" " "WHERE \"s\".\"authorization\" = \"a\".\"id\" AND " - "\"s\".\"name\" NOT IN ('sys', 'tmp') " + "\"s\".\"system\" = FALSE " "ORDER BY \"s\".\"name\""; /* alternative, but then need to handle NULL in second column: SELECT "s"."name", "a"."name" FROM "sys"."schemas" "s" LEFT OUTER JOIN "sys"."auths" "a" ON "s"."authorization" = "a"."id" AND - "s"."name" NOT IN ('sys', 'tmp') + "s"."system" = FALSE ORDER BY "s"."name" This may be needed after a sequence: diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -219,7 +219,8 @@ typedef struct sql_schema { sql_base base; int auth_id; int owner; - // TODO? int type; /* persistent, session local, transaction local */ + bit system; /* system or user schema */ + // TODO? int type; /* persistent, session local, transaction local */ changeset tables; changeset types; diff --git a/sql/scripts/99_system.sql b/sql/scripts/99_system.sql --- a/sql/scripts/99_system.sql +++ b/sql/scripts/99_system.sql @@ -5,3 +5,6 @@ update _tables set system = true where name = 'systemfunctions' and schema_id = (select id from schemas where name = 'sys'); + +-- sofar only system schemas +update schemas set system = true; diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -29,8 +29,8 @@ #include <bat/bat_table.h> #include <bat/bat_logger.h> -/* version 05.20.01 of catalog */ -#define CATALOG_VERSION 52001 +/* version 05.20.02 of catalog */ +#define CATALOG_VERSION 52002 int catalog_version = 0; static MT_Lock bs_lock MT_LOCK_INITIALIZER("bs_lock"); @@ -852,6 +852,9 @@ load_schema(sql_trans *tr, sqlid id, oid v = table_funcs.column_find_value(tr, find_sql_column(ss, "authorization"), rid); s->auth_id = *(sqlid *)v; _DELETE(v); + v = table_funcs.column_find_value(tr, + find_sql_column(tables, "system"), rid); + s->system = *(bit *)v; _DELETE(v); v = table_funcs.column_find_value(tr, find_sql_column(ss, "owner"), rid); s->owner = *(sqlid *)v; _DELETE(v); s->keys = list_new(tr->sa, (fdestroy) NULL); @@ -972,7 +975,7 @@ insert_schemas(sql_trans *tr) if (isDeclaredSchema(s)) continue; - table_funcs.table_insert(tr, sysschema, &s->base.id, s->base.name, &s->auth_id, &s->owner); + table_funcs.table_insert(tr, sysschema, &s->base.id, s->base.name, &s->auth_id, &s->owner, &s->system); for (m = s->tables.set->h; m; m = m->next) { sql_table *t = m->data; sht ca = t->commit_action; @@ -1235,6 +1238,7 @@ bootstrap_create_schema(sql_trans *tr, c base_init(tr->sa, &s->base, next_oid(), TR_NEW, name); s->auth_id = auth_id; s->owner = owner; + s->system = TRUE; cs_new(&s->tables, tr->sa, (fdestroy) &table_destroy); cs_new(&s->types, tr->sa, (fdestroy) NULL); cs_new(&s->funcs, tr->sa, (fdestroy) NULL); @@ -1323,6 +1327,7 @@ store_init(int debug, store_type store, bootstrap_create_column(tr, t, "name", "varchar", 1024); bootstrap_create_column(tr, t, "authorization", "int", 32); bootstrap_create_column(tr, t, "owner", "int", 32); + bootstrap_create_column(tr, t, "system", "boolean", 1); types = t = bootstrap_create_table(tr, s, "types"); bootstrap_create_column(tr, t, "id", "int", 32); @@ -2148,6 +2153,7 @@ schema_dup(sql_trans *tr, int flag, sql_ s->auth_id = os->auth_id; s->owner = os->owner; + s->system = os->system; cs_new(&s->tables, sa, (fdestroy) &table_destroy); cs_new(&s->types, sa, (fdestroy) NULL); cs_new(&s->funcs, sa, (fdestroy) NULL); @@ -3800,6 +3806,7 @@ sql_trans_create_schema(sql_trans *tr, c base_init(tr->sa, &s->base, next_oid(), TR_NEW, name); s->auth_id = auth_id; s->owner = owner; + s->system = FALSE; cs_new(&s->tables, tr->sa, (fdestroy) &table_destroy); cs_new(&s->types, tr->sa, (fdestroy) NULL); cs_new(&s->funcs, tr->sa, (fdestroy) NULL); @@ -3810,7 +3817,7 @@ sql_trans_create_schema(sql_trans *tr, c s->tr = tr; cs_add(&tr->schemas, s, TR_NEW); - table_funcs.table_insert(tr, sysschema, &s->base.id, s->base.name, &s->auth_id, &s->owner); + table_funcs.table_insert(tr, sysschema, &s->base.id, s->base.name, &s->auth_id, &s->owner, &s->system); s->base.wtime = tr->wtime = tr->wstime; tr->schema_updates ++; return s; diff --git a/sql/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out b/sql/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out --- a/sql/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out +++ b/sql/test/BugDay_2005-10-06_2.8/Tests/MapiClient-dump.SF-905851.stable.out @@ -113,7 +113,6 @@ Ready. # 14:58:14 > START TRANSACTION; -CREATE SCHEMA "json" AUTHORIZATION "monetdb"; SET SCHEMA "sys"; CREATE TABLE "sys"."allnewtriples" ( "id" INTEGER NOT NULL, diff --git a/sql/test/BugDay_2005-11-09_2.8/Tests/ORDER_BY_evaluation_error.SF-1023658.stable.out b/sql/test/BugDay_2005-11-09_2.8/Tests/ORDER_BY_evaluation_error.SF-1023658.stable.out --- a/sql/test/BugDay_2005-11-09_2.8/Tests/ORDER_BY_evaluation_error.SF-1023658.stable.out +++ b/sql/test/BugDay_2005-11-09_2.8/Tests/ORDER_BY_evaluation_error.SF-1023658.stable.out @@ -31,10 +31,10 @@ Ready. # AND "tables"."schema_id" = "schemas"."id" # AND "tables"."system" = FALSE # AND "keys"."type" = 0; -% .keys, .keys, .keys, .keys, .keys, .keys, .objects, .objects, .objects, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .schemas, .schemas, .schemas, .schemas # table_name -% id, table_id, type, name, rkey, action, id, name, nr, id, name, schema_id, query, type, system, commit_action, readonly, temporary, id, name, authorization, owner # name -% int, int, int, varchar, int, int, int, varchar, int, int, varchar, int, varchar, smallint, boolean, smallint, boolean, tinyint, int, varchar, int, int # type -% 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 5, 1, 5, 1, 1, 0, 1, 1 # length +% .keys, .keys, .keys, .keys, .keys, .keys, .objects, .objects, .objects, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .schemas, .schemas, .schemas, .schemas, .schemas # table_name +% id, table_id, type, name, rkey, action, id, name, nr, id, name, schema_id, query, type, system, commit_action, readonly, temporary, id, name, authorization, owner, system # name +% int, int, int, varchar, int, int, int, varchar, int, int, varchar, int, varchar, smallint, boolean, smallint, boolean, tinyint, int, varchar, int, int, boolean # type +% 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 5, 1, 5, 1, 1, 0, 1, 1, 5 # length #SELECT * #FROM "keys", "objects", "tables", "schemas" #WHERE "keys"."id" = "objects"."id" @@ -43,12 +43,12 @@ Ready. # AND "tables"."system" = FALSE # AND "keys"."type" = 0 #ORDER BY "objects"."name"; -% .keys, .keys, .keys, .keys, .keys, .keys, .objects, .objects, .objects, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .schemas, .schemas, .schemas, .schemas # table_name -% id, table_id, type, name, rkey, action, id, name, nr, id, name, schema_id, query, type, system, commit_action, readonly, temporary, id, name, authorization, owner # name -% int, int, int, varchar, int, int, int, varchar, int, int, varchar, int, varchar, smallint, boolean, smallint, boolean, tinyint, int, varchar, int, int # type -% 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 5, 1, 5, 1, 1, 0, 1, 1 # length +% .keys, .keys, .keys, .keys, .keys, .keys, .objects, .objects, .objects, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .tables, .schemas, .schemas, .schemas, .schemas, .schemas # table_name +% id, table_id, type, name, rkey, action, id, name, nr, id, name, schema_id, query, type, system, commit_action, readonly, temporary, id, name, authorization, owner, system # name +% int, int, int, varchar, int, int, int, varchar, int, int, varchar, int, varchar, smallint, boolean, smallint, boolean, tinyint, int, varchar, int, int, boolean # type +% 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 5, 1, 5, 1, 1, 0, 1, 1, 5 # length -# 14:57:17 > -# 14:57:17 > Done. -# 14:57:17 > +# 17:12:14 > +# 17:12:14 > "Done." +# 17:12:14 > diff --git a/sql/test/BugTracker-2009/Tests/join_topn.SF-2654133.stable.out b/sql/test/BugTracker-2009/Tests/join_topn.SF-2654133.stable.out --- a/sql/test/BugTracker-2009/Tests/join_topn.SF-2654133.stable.out +++ b/sql/test/BugTracker-2009/Tests/join_topn.SF-2654133.stable.out @@ -35,13 +35,13 @@ Ready. [ 2001, "schemas", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] [ 2001, "schemas", 2000, NULL, 0, true, 0, false, 0, 2, "two" ] [ 2001, "schemas", 2000, NULL, 0, true, 0, false, 0, 3, "three" ] -[ 2006, "types", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] -[ 2006, "types", 2000, NULL, 0, true, 0, false, 0, 2, "two" ] -[ 2006, "types", 2000, NULL, 0, true, 0, false, 0, 3, "three" ] -[ 2015, "functions", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] -[ 2015, "functions", 2000, NULL, 0, true, 0, false, 0, 2, "two" ] -[ 2015, "functions", 2000, NULL, 0, true, 0, false, 0, 3, "three" ] -[ 2024, "args", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] +[ 2007, "types", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] +[ 2007, "types", 2000, NULL, 0, true, 0, false, 0, 2, "two" ] +[ 2007, "types", 2000, NULL, 0, true, 0, false, 0, 3, "three" ] +[ 2016, "functions", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] +[ 2016, "functions", 2000, NULL, 0, true, 0, false, 0, 2, "two" ] +[ 2016, "functions", 2000, NULL, 0, true, 0, false, 0, 3, "three" ] +[ 2025, "args", 2000, NULL, 0, true, 0, false, 0, 1, "one" ] #drop table x cascade; # 19:39:26 > diff --git a/sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out b/sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out --- a/sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out +++ b/sql/test/BugTracker-2009/Tests/mclient-lsql-D.stable.out @@ -30,7 +30,6 @@ Ready. # 21:51:00 > START TRANSACTION; -CREATE SCHEMA "json" AUTHORIZATION "monetdb"; SET SCHEMA "sys"; CREATE TABLE "sys"."table_a" ( "table_a_id" INTEGER NOT NULL, diff --git a/sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out b/sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out --- a/sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out +++ b/sql/test/BugTracker-2009/Tests/name_clash_with_dump.SF-2780395.stable.out @@ -25,7 +25,6 @@ Ready. # 18:43:34 > START TRANSACTION; -CREATE SCHEMA "json" AUTHORIZATION "monetdb"; SET SCHEMA "sys"; CREATE TABLE "sys"."tf" ( "a" INTEGER diff --git a/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out b/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out --- a/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out +++ b/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out @@ -70,12 +70,12 @@ Ready. [ "idxs", 2000, NULL, 0, true, 0, false, 0 ] [ "triggers", 2000, NULL, 0, true, 0, false, 0 ] [ "objects", 2000, NULL, 0, true, 0, false, 0 ] -[ "_tables", 2102, NULL, 0, true, 2, false, 0 ] -[ "_columns", 2102, NULL, 0, true, 2, false, 0 ] -[ "keys", 2102, NULL, 0, true, 2, false, 0 ] -[ "idxs", 2102, NULL, 0, true, 2, false, 0 ] -[ "triggers", 2102, NULL, 0, true, 2, false, 0 ] -[ "objects", 2102, NULL, 0, true, 2, false, 0 ] +[ "_tables", 2103, NULL, 0, true, 2, false, 0 ] +[ "_columns", 2103, NULL, 0, true, 2, false, 0 ] +[ "keys", 2103, NULL, 0, true, 2, false, 0 ] +[ "idxs", 2103, NULL, 0, true, 2, false, 0 ] +[ "triggers", 2103, NULL, 0, true, 2, false, 0 ] +[ "objects", 2103, NULL, 0, true, 2, false, 0 ] [ "tables", 2000, "SELECT * FROM (SELECT p.*, 0 AS \"temporary\" FROM \"sys\".\"_tables\" AS p UNION ALL SELECT t.*, 1 AS \"temporary\" FROM \"tmp\".\"_tables\" AS t) AS tables where tables.type <> 2;", 1, true, 0, false, 0 ] [ "columns", 2000, "SELECT * FROM (SELECT p.* FROM \"sys\".\"_columns\" AS p UNION ALL SELECT t.* FROM \"tmp\".\"_columns\" AS t) AS columns;", 1, true, 0, false, 0 ] [ "db_user_info", 2000, NULL, 0, true, 0, false, 0 ] diff --git a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out --- a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out +++ b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.stable.out @@ -17,7 +17,6 @@ stdout of test 'interrupted-initializati # MonetDB/GIS module loaded # MonetDB/SQL module loaded START TRANSACTION; -CREATE SCHEMA "json" AUTHORIZATION "monetdb"; COMMIT; # MonetDB 5 server v11.5.8 # This is an unreleased version diff --git a/sql/test/BugTracker-2011/Tests/like_or.Bug-2924.stable.out b/sql/test/BugTracker-2011/Tests/like_or.Bug-2924.stable.out --- a/sql/test/BugTracker-2011/Tests/like_or.Bug-2924.stable.out +++ b/sql/test/BugTracker-2011/Tests/like_or.Bug-2924.stable.out @@ -25,11 +25,11 @@ Ready. #select * from schemas where name like '%ys' escape '=' or name like '%y' escape #'='; -% sys.schemas, sys.schemas, sys.schemas, sys.schemas # table_name -% id, name, authorization, owner # name -% int, varchar, int, int # type -% 4, 3, 1, 1 # length -[ 2000, "sys", 2, 3 ] +% sys.schemas, sys.schemas, sys.schemas, sys.schemas, sys.schemas # table_name +% id, name, authorization, owner, system # name +% int, varchar, int, int, boolean # type +% 4, 3, 1, 1, 5 # length +[ 2000, "sys", 2, 3, true ] # 08:16:49 > # 08:16:49 > "Done." diff --git a/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out b/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out --- a/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out +++ b/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out @@ -41,12 +41,12 @@ Ready. [ "idxs", 2000, NULL, 0, true, 0, false, 0 ] [ "triggers", 2000, NULL, 0, true, 0, false, 0 ] [ "objects", 2000, NULL, 0, true, 0, false, 0 ] -[ "_tables", 2102, NULL, 0, true, 2, false, 0 ] -[ "_columns", 2102, NULL, 0, true, 2, false, 0 ] -[ "keys", 2102, NULL, 0, true, 2, false, 0 ] -[ "idxs", 2102, NULL, 0, true, 2, false, 0 ] -[ "triggers", 2102, NULL, 0, true, 2, false, 0 ] -[ "objects", 2102, NULL, 0, true, 2, false, 0 ] +[ "_tables", 2103, NULL, 0, true, 2, false, 0 ] +[ "_columns", 2103, NULL, 0, true, 2, false, 0 ] +[ "keys", 2103, NULL, 0, true, 2, false, 0 ] +[ "idxs", 2103, NULL, 0, true, 2, false, 0 ] +[ "triggers", 2103, NULL, 0, true, 2, false, 0 ] +[ "objects", 2103, NULL, 0, true, 2, false, 0 ] [ "tables", 2000, "SELECT * FROM (SELECT p.*, 0 AS \"temporary\" FROM \"sys\".\"_tables\" AS p UNION ALL SELECT t.*, 1 AS \"temporary\" FROM \"tmp\".\"_tables\" AS t) AS tables where tables.type <> 2;", 1, true, 0, false, 0 ] [ "columns", 2000, "SELECT * FROM (SELECT p.* FROM \"sys\".\"_columns\" AS p UNION ALL SELECT t.* FROM \"tmp\".\"_columns\" AS t) AS columns;", 1, true, 0, false, 0 ] [ "db_user_info", 2000, NULL, 0, true, 0, false, 0 ] diff --git a/sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out b/sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out --- a/sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out +++ b/sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out @@ -30,7 +30,7 @@ Ready. % L1 # name % double # type % 24 # length -[ 5087 ] +[ 5088 ] # 17:14:33 > # 17:14:33 > "Done." diff --git a/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out b/sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list