Changeset: 3a4e73660dd1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3a4e73660dd1 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_upgrades.c sql/common/sql_backend.c sql/common/sql_backend.h sql/common/sql_types.c sql/include/sql_catalog.h sql/server/rel_optimizer.c sql/server/rel_updates.c sql/server/sql_mvc.c sql/server/sql_mvc.h sql/server/sql_parser.y sql/server/sql_scan.c sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.err sql/test/BugTracker-2012/Tests/incorrect_cast_from_double_to_int.Bug-2579.stable.out sql/test/BugTracker-2012/Tests/name_resolution_in_proc.Bug-3074.stable.err sql/test/BugTracker-2012/Tests/table_returning_func_returns_too_many_columns.Bug-3077.stable.err sql/test/BugTracker-2012/Tests/url_script_test.Bug-2972.stable.err sql/test/analytics/Tests/analytics14.stable.err 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/pg_regress/Tests/alter_table.stable.err sql/test/pg_regress/Tests/inet.stable.err sql/test/subquery/Tests/correlated.stable.err sql/test/subquery/Tests/correlated.stable.out tools/monetdbe/monetdbe.c Branch: unlock Log Message:
merging fun... diffs (truncated from 14601 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 @@ -9562,7 +9562,7 @@ stdout of test 'MAL-signatures` in direc [ "sqlcatalog", "alter_seq", "pattern sqlcatalog.alter_seq(X_1:str, X_2:str, X_3:ptr, X_4:lng):void ", "SQLalter_seq;", "" ] [ "sqlcatalog", "alter_set_table", "pattern sqlcatalog.alter_set_table(X_1:str, X_2:str, X_3:int):void ", "SQLalter_set_table;", "" ] [ "sqlcatalog", "alter_table", "pattern sqlcatalog.alter_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", "SQLalter_table;", "" ] -[ "sqlcatalog", "alter_user", "pattern sqlcatalog.alter_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str):void ", "SQLalter_user;", "" ] +[ "sqlcatalog", "alter_user", "pattern sqlcatalog.alter_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str, X_6:str):void ", "SQLalter_user;", "" ] [ "sqlcatalog", "comment_on", "pattern sqlcatalog.comment_on(X_1:int, X_2:str):void ", "SQLcomment_on;", "" ] [ "sqlcatalog", "create_function", "pattern sqlcatalog.create_function(X_1:str, X_2:str, X_3:ptr):void ", "SQLcreate_function;", "" ] [ "sqlcatalog", "create_role", "pattern sqlcatalog.create_role(X_1:str, X_2:str, X_3:int):void ", "SQLcreate_role;", "" ] @@ -9571,7 +9571,7 @@ stdout of test 'MAL-signatures` in direc [ "sqlcatalog", "create_table", "pattern sqlcatalog.create_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", "SQLcreate_table;", "" ] [ "sqlcatalog", "create_trigger", "pattern sqlcatalog.create_trigger(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int, X_7:str, X_8:str, X_9:str, X_10:str):void ", "SQLcreate_trigger;", "" ] [ "sqlcatalog", "create_type", "pattern sqlcatalog.create_type(X_1:str, X_2:str, X_3:str):void ", "SQLcreate_type;", "" ] -[ "sqlcatalog", "create_user", "pattern sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str):void ", "SQLcreate_user;", "" ] +[ "sqlcatalog", "create_user", "pattern sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str, X_6:str):void ", "SQLcreate_user;", "" ] [ "sqlcatalog", "create_view", "pattern sqlcatalog.create_view(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", "SQLcreate_view;", "" ] [ "sqlcatalog", "drop_constraint", "pattern sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:int, X_4:int):void ", "SQLdrop_constraint;", "" ] [ "sqlcatalog", "drop_function", "pattern sqlcatalog.drop_function(X_1:str, X_2:str, X_3:int, X_4:int, X_5:int):void ", "SQLdrop_function;", "" ] 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 @@ -12889,7 +12889,7 @@ stdout of test 'MAL-signatures` in direc [ "sqlcatalog", "alter_seq", "pattern sqlcatalog.alter_seq(X_1:str, X_2:str, X_3:ptr, X_4:lng):void ", "SQLalter_seq;", "" ] [ "sqlcatalog", "alter_set_table", "pattern sqlcatalog.alter_set_table(X_1:str, X_2:str, X_3:int):void ", "SQLalter_set_table;", "" ] [ "sqlcatalog", "alter_table", "pattern sqlcatalog.alter_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", "SQLalter_table;", "" ] -[ "sqlcatalog", "alter_user", "pattern sqlcatalog.alter_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str):void ", "SQLalter_user;", "" ] +[ "sqlcatalog", "alter_user", "pattern sqlcatalog.alter_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str, X_6:str):void ", "SQLalter_user;", "" ] [ "sqlcatalog", "comment_on", "pattern sqlcatalog.comment_on(X_1:int, X_2:str):void ", "SQLcomment_on;", "" ] [ "sqlcatalog", "create_function", "pattern sqlcatalog.create_function(X_1:str, X_2:str, X_3:ptr):void ", "SQLcreate_function;", "" ] [ "sqlcatalog", "create_role", "pattern sqlcatalog.create_role(X_1:str, X_2:str, X_3:int):void ", "SQLcreate_role;", "" ] @@ -12898,7 +12898,7 @@ stdout of test 'MAL-signatures` in direc [ "sqlcatalog", "create_table", "pattern sqlcatalog.create_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", "SQLcreate_table;", "" ] [ "sqlcatalog", "create_trigger", "pattern sqlcatalog.create_trigger(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int, X_7:str, X_8:str, X_9:str, X_10:str):void ", "SQLcreate_trigger;", "" ] [ "sqlcatalog", "create_type", "pattern sqlcatalog.create_type(X_1:str, X_2:str, X_3:str):void ", "SQLcreate_type;", "" ] -[ "sqlcatalog", "create_user", "pattern sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str):void ", "SQLcreate_user;", "" ] +[ "sqlcatalog", "create_user", "pattern sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str, X_6:str):void ", "SQLcreate_user;", "" ] [ "sqlcatalog", "create_view", "pattern sqlcatalog.create_view(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", "SQLcreate_view;", "" ] [ "sqlcatalog", "drop_constraint", "pattern sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:int, X_4:int):void ", "SQLdrop_constraint;", "" ] [ "sqlcatalog", "drop_function", "pattern sqlcatalog.drop_function(X_1:str, X_2:str, X_3:int, X_4:int, X_5:int):void ", "SQLdrop_function;", "" ] diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -2196,7 +2196,8 @@ dump_database(Mapi mid, stream *toConsol "SELECT ui.name, " "ui.fullname, " "password_hash(ui.name), " - "s.name " + "s.name, " + "ui.schema_path " "FROM sys.db_user_info ui, " "sys.schemas s " "WHERE ui.default_schema = s.id " @@ -2439,6 +2440,7 @@ dump_database(Mapi mid, stream *toConsol const char *fullname = mapi_fetch_field(hdl, 1); const char *pwhash = mapi_fetch_field(hdl, 2); const char *sname = mapi_fetch_field(hdl, 3); + const char *spath = mapi_fetch_field(hdl, 4); mnstr_printf(toConsole, "CREATE USER "); dquoted_print(toConsole, uname, " "); @@ -2447,7 +2449,8 @@ dump_database(Mapi mid, stream *toConsol mnstr_printf(toConsole, " NAME "); squoted_print(toConsole, fullname, '\'', false); mnstr_printf(toConsole, " SCHEMA "); - dquoted_print(toConsole, describe ? sname : "sys", ";\n"); + dquoted_print(toConsole, describe ? sname : "sys", " "); + mnstr_printf(toConsole, "SCHEMA PATH '%s';\n", spath); } if (mapi_error(mid)) goto bailout; diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c --- a/clients/mapiclient/mhelp.c +++ b/clients/mapiclient/mhelp.c @@ -82,7 +82,8 @@ SQLhelp sqlhelp1[] = { "ALTER USER ident RENAME TO ident\n" "ALTER USER SET [ENCRYPTED | UNENCRYPTED] PASSWORD string USING OLD PASSWORD string\n" "ALTER USER ident WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string\n" - "ALTER USER ident [ WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string ] SET SCHEMA ident", + "ALTER USER ident [WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string] SET SCHEMA ident\n" + "ALTER USER ident [WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string] SCHEMA PATH string", "ident", "See also https://www.monetdb.org/Documentation/SQLreference/Users"}, {"ANALYZE", @@ -229,7 +230,7 @@ SQLhelp sqlhelp1[] = { NULL}, {"CREATE USER", "Create a new database user", - "CREATE USER ident WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string NAME string SCHEMA ident", + "CREATE USER ident WITH [ENCRYPTED | UNENCRYPTED] PASSWORD string NAME string SCHEMA ident [SCHEMA PATH string]", "ident", "See also https://www.monetdb.org/Documentation/SQLreference/Users"}, {"CREATE VIEW", diff --git a/documentation/source/developers_handbook.rst b/documentation/source/developers_handbook.rst --- a/documentation/source/developers_handbook.rst +++ b/documentation/source/developers_handbook.rst @@ -69,20 +69,35 @@ directory where they reside:: [$src_root/sql/test/json/Tests]$ Mtest.py . -Adding a new test ------------------ +Adding sqllogic test +-------------------- + +See `<https://www.sqlite.org/sqllogictest/doc/trunk/about.wiki/>`_ for detail information +on how to structure sqllogic test if you desire to make one by hand. We have extended the +sqllogic protocol a bit further:: + + skipif <system> + onlyif <system> -Summarizing the above discussion, to add a new test, you need to write the test -itself, create the stable output and error files, and finally add the test to the -``All`` index. This will make ensure that the test will be picked up by -``Mtest.py`` as part of its group. + statement (ok|ok rowcount|error) [arg] + query (I|T|R)+ (nosort|rowsort|valuesort|python)? [arg] + I: integer; T: text (string); R: real (decimal) + nosort: do not sort + rowsort: sort rows + valuesort: sort individual values + python some.python.function: run data through function (MonetDB extension) + hash-threshold number + halt -To create the correct stable output you can use the ``Mapprove.py`` utility. -First create empty ``.stable.{out,err}`` files and run the test using -``Mtest.py``. Check the output and if it is correct, run ``Mapprove.py`` with -the same arguments. This will add the correct contents to the -``.stable.{out,err}`` files. Commit the changes to the VCS and the test can now -be used by other developers and the nightly testing infrastructure. +Alternatively ``.sql`` scripts can be converted to sqllogic tests (.test) with ``Mconvert.py``. +For example:: + + $Mconvert.py --auto <module>/Tests <convert_me>.sql + +All new tests need to be placed in the appropriate test folder and their name respectively in the +index ``All`` file. Python tests API ---------------- + +See many of the examples in ``sql/test/Users/Tests``. diff --git a/documentation/source/windowsbuild.rst b/documentation/source/windowsbuild.rst deleted file mode 100644 --- a/documentation/source/windowsbuild.rst +++ /dev/null @@ -1,121 +0,0 @@ -.. This Source Code Form is subject to the terms of the Mozilla Public -.. License, v. 2.0. If a copy of the MPL was not distributed with this -.. file, You can obtain one at http://mozilla.org/MPL/2.0/. -.. -.. Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - -.. This document is written in reStructuredText (see - http://docutils.sourceforge.net/ for more information). - Use ``rst2html.py`` to convert this file to HTML. - -Building MonetDB On Windows -+++++++++++++++++++++++++++ - -In this document we describe how to build the MonetDB suite of -programs on Windows using the sources from `our source repository`__. -This document is mainly targeted at building on Windows on a 32-bit -architecture, but there are notes throughout about building on Windows -on a 64-bit architecture which is indicated with Windows64. We have -successfully built on Windows XP, Windows Server, and Windows 7. - -.. _MonetDB: https://dev.monetdb.org/hg/MonetDB/ - -__ MonetDB_ - -Introduction -============ - -The MonetDB suite of programs consists of a number of components which -we will describe briefly here. The section names are the names of the -top-level folders in the Mercurial clone. - -Note that in branches up to and including Oct2010 the build process -was different. This document describes the build process for the -branch this document is part of. Use the command ``hg branch`` to -find out the name of the branch. - -buildtools ----------- - -The buildtools component contains tools that are used to build the -other components. This component is required, but not all parts of -this component are required for all configurations. - -common ------- - -Also known as the MonetDB Common component contains some generally -useful libraries. This component is required. - -gdk ---- - -Also known as the Goblin Database Kernel contains the database kernel, -i.e. the heart of MonetDB. This component is required. - -clients -------- - -Also known as the MonetDB Client component contains a library which -forms the basis for communicating with the MonetDB server components, -and some interface programs that use this library to communicate with -the server. This component is required. - -monetdb5 --------- - -The MonetDB5 Server component is the database server. It uses MAL -(the MonetDB Algebra Language) as programming interface. This -component is required. - -sql ---- - -Also known as MonetDB SQL, this component provides an SQL frontend to -MonetDB5. This component is required if you need SQL support. - -tools ------ - -The tools component contains two parts. The mserver part is the -actual database server binary and is required. The merovingian part -is not used on Windows. - -geom ----- - -The geom component provides a module for the MonetDB SQL frontend. -This component is optional. - -testing -------- - -The testing component contains some files and programs we use for -testing the MonetDB suite. This component is optional. - -Prerequisites -============= - -In order to compile the MonetDB suite of programs, several other -programs and libraries need to be installed. Some further programs -and libraries can be optionally installed to enable optional features. -The required programs and libraries are listed in this section, the -following section lists the optional programs and libraries. - -Chocolatey ----------- - -Although Chocolatey_ is not a prerequisite per se, it makes -installing and maintaining some of the other prerequisites a lot -easier. Therefore we recommend installing chocolatey. Instructions -are on their website__. - -We have installed the following programs using Chocolatey_:: - - choco install ActivePerl ant cmake ruby - choco install python3 python3-x86_32 - -.. _Chocolatey: https://chocolatey.org/ - -__ Chocolatey_ - diff --git a/sql/ChangeLog.scoping2 b/sql/ChangeLog.scoping2 new file mode 100644 --- /dev/null +++ b/sql/ChangeLog.scoping2 @@ -0,0 +1,27 @@ +# ChangeLog file for sql +# This file is updated with Maddlog + +* Mon Nov 30 2020 Pedro Ferreira <pedro.ferre...@monetdbsolutions.com> +- Added 'schema path' property to user, specifying a list of schemas + to be searched on to find SQL objects such as tables and + functions. The scoping rules have been updated to support this feature + and it now finds SQL objects in the following order: + 1. On occasions with multiple tables (e.g. add foreign key constraint, + add table to a merge table), the child will be searched on the + parent's schema. + 2. For tables only, declared tables on the stack. + 3. 'tmp' schema if not listed on the 'schema path'. + 4. Session's current schema. + 5. Each schema from the 'schema path' in order. + 6. 'sys' schema if not listed on the 'schema path'. + Whenever the full path is specified, ie "schema"."object", no search will + be made besides on the explicit schema. +- To update the schema path ALTER USER x SCHEMA PATH y; statement was added. + [SCHEMA PATH string] syntax was added to the CREATE USER statement. + The schema path must be a single string where each schema must be between + double quotes and separated with a single comma, e.g. '"sch1","sch2"' + For every created user, if the schema path is not given, '"sys"' will be _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list