MonetDB: default - update test docs

2020-12-21 Thread svetlin
Changeset: 793313048524 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=793313048524
Modified Files:
documentation/source/developers_handbook.rst
Branch: default
Log Message:

update test docs


diffs (50 lines):

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
 -
 
-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.
+See ``_ 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 
+onlyif 
 
-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.
+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
+
+Alternatively ``.sql`` scripts can be converted to sqllogic tests (.test) with 
``Mconvert.py``.
+For example::
+
+$Mconvert.py  --auto /Tests .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``.
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - added one more test query

2020-12-21 Thread Ying Zhang
Changeset: 9272c878a0ad for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9272c878a0ad
Modified Files:
sql/test/Users/Tests/userCallFunction.SQL.py
Branch: default
Log Message:

added one more test query


diffs (12 lines):

diff --git a/sql/test/Users/Tests/userCallFunction.SQL.py 
b/sql/test/Users/Tests/userCallFunction.SQL.py
--- a/sql/test/Users/Tests/userCallFunction.SQL.py
+++ b/sql/test/Users/Tests/userCallFunction.SQL.py
@@ -24,6 +24,8 @@ with SQLTestCase() as mdb:
 tc.execute('SELECT s1.f1(cast(1 as 
int));').assertFailed(err_code="42000", err_message="SELECT: no such unary 
operator 'f1(int)'")
 tc.execute('CALL sys.flush_log();').assertFailed(err_code="42000", 
err_message="SELECT: no such operator 'flush_log'")
 
+mdb.execute('GRANT EXECUTE ON FUNCTION s1.f1 TO 
u1;').assertFailed(err_code="42000", err_message="GRANT FUNCTION: there are 
more than one function called 'f1', please use the full signature")
+
 mdb.execute('GRANT EXECUTE ON FUNCTION s1.f1() TO 
u1;').assertSucceeded()
 tc.execute('SELECT s1.f1();').assertDataResultMatch([(10,)])
 tc.execute('SELECT s1.f1(1);').assertFailed(err_code="42000", 
err_message="SELECT: no such unary operator 'f1(tinyint)'")
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - remove files no longer needed

2020-12-21 Thread Ying Zhang
Changeset: 35a0d666e1cb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=35a0d666e1cb
Removed Files:
sql/test/Users/Tests/userCallFunction.stable.err
sql/test/Users/Tests/userCallFunction.stable.out
Branch: default
Log Message:

remove files no longer needed


diffs (34 lines):

diff --git a/sql/test/Users/Tests/userCallFunction.stable.err 
b/sql/test/Users/Tests/userCallFunction.stable.err
deleted file mode 100644
--- a/sql/test/Users/Tests/userCallFunction.stable.err
+++ /dev/null
@@ -1,12 +0,0 @@
-stderr of test 'userCallFunction` in directory 'sql/test/Users` itself:
-
-
-# 12:59:01 >  
-# 12:59:01 >  "/usr/bin/python3.9" "userCallFunction.SQL.py" "userCallFunction"
-# 12:59:01 >  
-
-
-# 12:59:02 >  
-# 12:59:02 >  "Done."
-# 12:59:02 >  
-
diff --git a/sql/test/Users/Tests/userCallFunction.stable.out 
b/sql/test/Users/Tests/userCallFunction.stable.out
deleted file mode 100644
--- a/sql/test/Users/Tests/userCallFunction.stable.out
+++ /dev/null
@@ -1,12 +0,0 @@
-stdout of test 'userCallFunction` in directory 'sql/test/Users` itself:
-
-
-# 12:59:01 >  
-# 12:59:01 >  "/usr/bin/python3.9" "userCallFunction.SQL.py" "userCallFunction"
-# 12:59:01 >  
-
-
-# 12:59:02 >  
-# 12:59:02 >  "Done."
-# 12:59:02 >  
-
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - merged

2020-12-21 Thread Niels Nes
Changeset: 2cb3d7b98aeb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2cb3d7b98aeb
Branch: unlock
Log Message:

merged


diffs (truncated from 447 to 300 lines):

diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -35,7 +35,10 @@ monet5_drop_user(ptr _mvc, str user)
str err;
Client c = MCgetClient(m->clientid);
 
+   int grant_user = c->user;
+   c->user = MAL_ADMIN;
err = AUTHremoveUser(c, user);
+   c->user = grant_user;
if (err !=MAL_SUCCEED) {
(void) sql_error(m, 02, "DROP USER: %s", 
getExceptionMessage(err));
_DELETE(err);
@@ -76,7 +79,10 @@ monet5_create_user(ptr _mvc, str user, s
pwd = passwd;
}
/* add the user to the M5 authorisation administration */
+   int grant_user = c->user;
+   c->user = MAL_ADMIN;
ret = AUTHaddUser(, c, user, pwd);
+   c->user = grant_user;
if (!enc)
free(pwd);
if (ret != MAL_SUCCEED)
diff --git 
a/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py 
b/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
--- a/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
+++ b/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
@@ -1,67 +1,35 @@
-import sys, os, pymonetdb
-
-db = os.getenv("TSTDB")
-port = int(os.getenv("MAPIPORT"))
-
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('create user "mydummyuser" with password \'mydummyuser\' name 
\'mydummyuser\' schema "sys";')
-cur1.close()
-client1.close()
+###
+# Check that GRANT a ROLE to a USER once works, but GRANT it a second time is
+#   properly rejected with "GRANT: User '' already has ROLE ''",
+#   which also prevents the related problems described in this bug, i.e.
+#   duplicate entries are created in sys.user_role and subsequent REVOKE
+#   doesn't work.
+###
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='mydummyuser', password='mydummyuser')
-cur1 = client1.cursor()
-try:
-cur1.execute('set role "sysadmin"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "Role (sysadmin) missing" not in str(e):
-sys.stderr.write("Error: Role (sysadmin) missing")
-cur1.close()
-client1.close()
+from MonetDBtesting.sqltest import SQLTestCase
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(0,)]:
-sys.stderr.write('Expected result: [(0,)]')
-cur1.execute('grant "sysadmin" to "mydummyuser";')
-cur1.close()
-client1.close()
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
+mdb.execute("create user mydummyuser with password 'mydummyuser' name 
'mydummyuser' schema sys;").assertSucceeded()
+
+with SQLTestCase() as tc:
+tc.connect(username="mydummyuser", password="mydummyuser")
+tc.execute("set role sysadmin;").assertFailed(err_code="42000", 
err_message="Role (sysadmin) missing")
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='mydummyuser', password='mydummyuser')
-cur1 = client1.cursor()
-cur1.execute('set role "sysadmin";')
-cur1.close()
-client1.close()
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(0,)])
+mdb.execute("grant sysadmin to mydummyuser;").assertSucceeded()
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(1,)])
+
+tc.execute("set role sysadmin;").assertSucceeded()
+
+mdb.execute("grant sysadmin to 
mydummyuser;").assertFailed(err_code="M1M05", err_message="GRANT: User 
'mydummyuser' already has ROLE 'sysadmin'")
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(1,)])
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(1,)]:
-sys.stderr.write('Expected result: [(1,)]')
-try:
-cur1.execute('grant "sysadmin" to "mydummyuser"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "User 'mydummyuser' 

MonetDB: default - merged

2020-12-21 Thread Niels Nes
Changeset: d239f7094624 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d239f7094624
Branch: default
Log Message:

merged


diffs (truncated from 422 to 300 lines):

diff --git 
a/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py 
b/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
--- a/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
+++ b/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
@@ -1,67 +1,35 @@
-import sys, os, pymonetdb
-
-db = os.getenv("TSTDB")
-port = int(os.getenv("MAPIPORT"))
-
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('create user "mydummyuser" with password \'mydummyuser\' name 
\'mydummyuser\' schema "sys";')
-cur1.close()
-client1.close()
+###
+# Check that GRANT a ROLE to a USER once works, but GRANT it a second time is
+#   properly rejected with "GRANT: User '' already has ROLE ''",
+#   which also prevents the related problems described in this bug, i.e.
+#   duplicate entries are created in sys.user_role and subsequent REVOKE
+#   doesn't work.
+###
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='mydummyuser', password='mydummyuser')
-cur1 = client1.cursor()
-try:
-cur1.execute('set role "sysadmin"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "Role (sysadmin) missing" not in str(e):
-sys.stderr.write("Error: Role (sysadmin) missing")
-cur1.close()
-client1.close()
+from MonetDBtesting.sqltest import SQLTestCase
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(0,)]:
-sys.stderr.write('Expected result: [(0,)]')
-cur1.execute('grant "sysadmin" to "mydummyuser";')
-cur1.close()
-client1.close()
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
+mdb.execute("create user mydummyuser with password 'mydummyuser' name 
'mydummyuser' schema sys;").assertSucceeded()
+
+with SQLTestCase() as tc:
+tc.connect(username="mydummyuser", password="mydummyuser")
+tc.execute("set role sysadmin;").assertFailed(err_code="42000", 
err_message="Role (sysadmin) missing")
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='mydummyuser', password='mydummyuser')
-cur1 = client1.cursor()
-cur1.execute('set role "sysadmin";')
-cur1.close()
-client1.close()
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(0,)])
+mdb.execute("grant sysadmin to mydummyuser;").assertSucceeded()
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(1,)])
+
+tc.execute("set role sysadmin;").assertSucceeded()
+
+mdb.execute("grant sysadmin to 
mydummyuser;").assertFailed(err_code="M1M05", err_message="GRANT: User 
'mydummyuser' already has ROLE 'sysadmin'")
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(1,)])
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(1,)]:
-sys.stderr.write('Expected result: [(1,)]')
-try:
-cur1.execute('grant "sysadmin" to "mydummyuser"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "User 'mydummyuser' already has ROLE 'sysadmin'" not in str(e):
-sys.stderr.write("Error: User 'mydummyuser' already has ROLE 
'sysadmin'")
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(1,)]:
-sys.stderr.write('Expected result: [(1,)]')
-cur1.execute('revoke "sysadmin" from "mydummyuser";')
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(0,)]:
-sys.stderr.write('Expected result: [(0,)]')
-try:
-cur1.execute('revoke "sysadmin" from "mydummyuser"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "User 'mydummyuser' does not have ROLE 'sysadmin'" not in str(e):
-sys.stderr.write("Error: User 'mydummyuser' does not have ROLE 
'sysadmin'")

MonetDB: default - allow elevated access for users from the SYS_...

2020-12-21 Thread Niels Nes
Changeset: 9f79c42fb097 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9f79c42fb097
Modified Files:
sql/backends/monet5/sql_user.c
Branch: default
Log Message:

allow elevated access for users from the SYS_ADMIN role


diffs (25 lines):

diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -35,7 +35,10 @@ monet5_drop_user(ptr _mvc, str user)
str err;
Client c = MCgetClient(m->clientid);
 
+   int grant_user = c->user;
+   c->user = MAL_ADMIN;
err = AUTHremoveUser(c, user);
+   c->user = grant_user;
if (err !=MAL_SUCCEED) {
(void) sql_error(m, 02, "DROP USER: %s", 
getExceptionMessage(err));
_DELETE(err);
@@ -76,7 +79,10 @@ monet5_create_user(ptr _mvc, str user, s
pwd = passwd;
}
/* add the user to the M5 authorisation administration */
+   int grant_user = c->user;
+   c->user = MAL_ADMIN;
ret = AUTHaddUser(, c, user, pwd);
+   c->user = grant_user;
if (!enc)
free(pwd);
if (ret != MAL_SUCCEED)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - converted and minor extension

2020-12-21 Thread Ying Zhang
Changeset: bf642a3063f1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf642a3063f1
Modified Files:
sql/test/Users/Tests/userCallFunction.SQL.py
Branch: default
Log Message:

converted and minor extension


diffs (114 lines):

diff --git a/sql/test/Users/Tests/userCallFunction.SQL.py 
b/sql/test/Users/Tests/userCallFunction.SQL.py
--- a/sql/test/Users/Tests/userCallFunction.SQL.py
+++ b/sql/test/Users/Tests/userCallFunction.SQL.py
@@ -1,72 +1,43 @@
-import os, sys, pymonetdb
-
+###
+# Check that a user can only execute a function after the user has been granted
+#   the EXECUTE rights.
+# Also check that function signature matters.
+###
 
-port = int(os.environ['MAPIPORT'])
-db = os.environ['TSTDB']
+from MonetDBtesting.sqltest import SQLTestCase
 
-conn1 = 
pymonetdb.connect(port=port,database=db,autocommit=True,username='monetdb',password='monetdb')
-cur1 = conn1.cursor()
-cur1.execute("""
-start transaction;
-create schema s1;
-CREATE USER u1 WITH PASSWORD '1' NAME 'u1' SCHEMA s1;
-CREATE FUNCTION s1.f1() RETURNS INT BEGIN RETURN 10; END;
-CREATE FUNCTION s1.f1(a int) RETURNS INT BEGIN RETURN 10 + a; END;
-commit;
-""")
-cur1.close()
-conn1.close()
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
+mdb.execute("""
+start transaction;
+create schema s1;
+CREATE USER u1 WITH PASSWORD '1' NAME 'u1' SCHEMA s1;
+CREATE FUNCTION s1.f1(a int) RETURNS INT BEGIN RETURN 10 + a; END;
+CREATE FUNCTION s1.f1() RETURNS INT BEGIN RETURN 10; END;
+commit;
+""").assertSucceeded()
 
-conn1 = 
pymonetdb.connect(port=port,database=db,autocommit=True,username='u1',password='1')
-cur1 = conn1.cursor()
-try:
-cur1.execute('SELECT s1.f1();') # error, not allowed
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "SELECT: no such operator 'f1'" not in str(e):
-sys.stderr.write('Wrong error %s, expected SELECT: no such operator 
\'f1\'' % (str(e)))
-try:
-cur1.execute('SELECT s1.f1(1);') # error, not allowed
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "SELECT: no such unary operator 'f1(tinyint)'" not in str(e):
-sys.stderr.write('Wrong error %s, expected SELECT: no such unary 
operator \'f1(tinyint)\'' % (str(e)))
-try:
-cur1.execute('CALL sys.flush_log();') # error, not allowed
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "SELECT: no such operator 'flush_log'" not in str(e):
-sys.stderr.write('Wrong error %s, expected SELECT: no such operator 
\'flush_log\'' % (str(e)))
-cur1.close()
-conn1.close()
+with SQLTestCase() as tc:
+tc.connect(username="u1", password="1")
+tc.execute('SELECT s1.f1();').assertFailed(err_code="42000", 
err_message="SELECT: no such operator 'f1'")
+tc.execute('SELECT s1.f1(1);').assertFailed(err_code="42000", 
err_message="SELECT: no such unary operator 'f1(tinyint)'")
+tc.execute('SELECT s1.f1(cast(1 as 
int));').assertFailed(err_code="42000", err_message="SELECT: no such unary 
operator 'f1(int)'")
+tc.execute('CALL sys.flush_log();').assertFailed(err_code="42000", 
err_message="SELECT: no such operator 'flush_log'")
+
+mdb.execute('GRANT EXECUTE ON FUNCTION s1.f1() TO 
u1;').assertSucceeded()
+tc.execute('SELECT s1.f1();').assertDataResultMatch([(10,)])
+tc.execute('SELECT s1.f1(1);').assertFailed(err_code="42000", 
err_message="SELECT: no such unary operator 'f1(tinyint)'")
+tc.execute('SELECT s1.f1(cast(1 as 
int));').assertFailed(err_code="42000", err_message="SELECT: no such unary 
operator 'f1(int)'")
 
-conn1 = 
pymonetdb.connect(port=port,database=db,autocommit=True,username='monetdb',password='monetdb')
-cur1 = conn1.cursor()
-cur1.execute('GRANT EXECUTE ON FUNCTION s1.f1() TO u1;')
-cur1.close()
-conn1.close()
+mdb.execute('REVOKE EXECUTE ON FUNCTION s1.f1() FROM 
u1;').assertSucceeded()
+tc.execute('SELECT s1.f1();').assertFailed(err_code="42000", 
err_message="SELECT: no such operator 'f1'")
+mdb.execute('GRANT EXECUTE ON FUNCTION s1.f1(int) TO 
u1;').assertSucceeded()
+tc.execute('SELECT s1.f1(1);').assertDataResultMatch([(11,)])
+tc.execute('SELECT s1.f1(cast(1 as 
int));').assertDataResultMatch([(11,)])
 
-conn1 = 
pymonetdb.connect(port=port,database=db,autocommit=True,username='u1',password='1')
-cur1 = conn1.cursor()
-cur1.execute('SELECT s1.f1();')
-if cur1.fetchall() != [(10,)]:
-sys.stderr.write("[(10,)] expected")
-try:
-cur1.execute('SELECT s1.f1(1);') # error, not allowed
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "SELECT: no such unary operator 'f1(tinyint)'" not in str(e):
-sys.stderr.write('Wrong error %s, expected SELECT: no such unary 
operator \'f1(tinyint)\'' % (str(e)))
-cur1.close()
-conn1.close()
-
-conn1 = 

MonetDB: Oct2020 - make sure we allocate on the right allocator ...

2020-12-21 Thread Niels Nes
Changeset: 0bce26df86a7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0bce26df86a7
Modified Files:
sql/storage/store.c
Branch: Oct2020
Log Message:

make sure we allocate on the right allocator during rollforward use the parent 
sa


diffs (26 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -4578,17 +4578,17 @@ rollforward_update_part(sql_trans *tr, i
 
pt->with_nills = opt->with_nills;
if (isRangePartitionTable(opt->t)) {
-   pt->part.range.minvalue = sa_alloc(tr->sa, 
opt->part.range.minlength);
-   pt->part.range.maxvalue = sa_alloc(tr->sa, 
opt->part.range.maxlength);
+   pt->part.range.minvalue = sa_alloc(tr->parent->sa, 
opt->part.range.minlength);
+   pt->part.range.maxvalue = sa_alloc(tr->parent->sa, 
opt->part.range.maxlength);
memcpy(pt->part.range.minvalue, 
opt->part.range.minvalue, opt->part.range.minlength);
memcpy(pt->part.range.maxvalue, 
opt->part.range.maxvalue, opt->part.range.maxlength);
pt->part.range.minlength = opt->part.range.minlength;
pt->part.range.maxlength = opt->part.range.maxlength;
} else if (isListPartitionTable(opt->t)) {
-   pt->part.values = list_new(tr->sa, (fdestroy) NULL);
+   pt->part.values = list_new(tr->parent->sa, (fdestroy) 
NULL);
for (node *n = opt->part.values->h ; n ; n = n->next) {
-   sql_part_value *prev = (sql_part_value*) 
n->data, *nextv = SA_ZNEW(tr->sa, sql_part_value);
-   nextv->value = sa_alloc(tr->sa, prev->length);
+   sql_part_value *prev = (sql_part_value*) 
n->data, *nextv = SA_ZNEW(tr->parent->sa, sql_part_value);
+   nextv->value = sa_alloc(tr->parent->sa, 
prev->length);
memcpy(nextv->value, prev->value, prev->length);
nextv->length = prev->length;
list_append(pt->part.values, nextv);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - add some more safety.

2020-12-21 Thread Niels Nes
Changeset: 29c2d7ae7606 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=29c2d7ae7606
Modified Files:
sql/storage/bat/bat_storage.c
Branch: Oct2020
Log Message:

add some more safety.


diffs (11 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2847,6 +2847,7 @@ update_table(sql_trans *tr, sql_table *f
if (ok == LOG_OK && tt->idxs.set) {
if (ot)
o = ot->idxs.set->h;
+   if (ft->idxs.set && tt->idxs.set)
for (n = ft->idxs.set->h, m = tt->idxs.set->h; ok == LOG_OK && 
n && m; n = n->next, m = m->next, o=(o?o->next:NULL)) {
sql_idx *ci = n->data;
sql_idx *oi = m->data;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - print formating

2020-12-21 Thread svetlin
Changeset: a05d4cd30402 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a05d4cd30402
Modified Files:
testing/sqltest.py
Branch: default
Log Message:

print formating


diffs (27 lines):

diff --git a/testing/sqltest.py b/testing/sqltest.py
--- a/testing/sqltest.py
+++ b/testing/sqltest.py
@@ -198,11 +198,11 @@ class TestCaseResult(object):
 err_file = self.test_case.err_file
 if len(self.assertion_errors) == 0:
 lineno = self.lineno or 'N/A'
-print(f'line {lineno}', file=err_file)
+print('', file=err_file)
 if self.query:
-print(self.query, file=err_file)
+print(f'ln{lineno}:', self.query, file=err_file)
 elif self.id:
-print(self.id, file=err_file)
+print(f'ln{lineno}:', self.id, file=err_file)
 print('', file=err_file)
 self.assertion_errors.append(AssertionError(msg))
 print(msg, file=err_file)
@@ -385,7 +385,7 @@ class MclientTestResult(TestCaseResult, 
 self.fail(msg)
 return self
 
-def assertMatchStableError(self, ferr):
+def assertMatchStableError(self, ferr, ignore_err_messages=False):
 stable = []
 err = []
 filter_fn = filter_lines_starting_with(['--', '#', 'stderr of test', 
'MAPI'])
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-java: default - Update ignore file.

2020-12-21 Thread Sjoerd Mullender
Changeset: 3cc985970fd3 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=3cc985970fd3
Modified Files:
.hgignore
Branch: default
Log Message:

Update ignore file.


diffs (12 lines):

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -4,7 +4,7 @@ syntax: glob
 *.class
 *.jar
 build/META-INF/services/java.sql.Driver
-src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java
+src/main/java/org/monetdb/jdbc/MonetDriver.java
 
 # files generated by various editors
 *.swp
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - converted, cleaned up, extended

2020-12-21 Thread Ying Zhang
Changeset: e3f15abf9470 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e3f15abf9470
Removed Files:
sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.stable.err
sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.stable.out
Modified Files:
sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py
Branch: default
Log Message:

converted, cleaned up, extended


diffs (145 lines):

diff --git a/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py 
b/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py
--- a/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py
+++ b/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py
@@ -1,61 +1,52 @@
-import sys, os, pymonetdb
+###
+# Check that when a user is granted (select) access to some columns in a table,
+#   the user can indeed access those columns.
+# In addition, check that after the access to some of the granted columns has
+#   been revoked, the user can access the remaining columns.
+###
 
-db = os.getenv("TSTDB")
-port = int(os.getenv("MAPIPORT"))
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('''
-START TRANSACTION;
-CREATE schema "myschema";
-CREATE TABLE "myschema"."test" ("id" integer, "name" varchar(20));
-INSERT INTO "myschema"."test" ("id", "name") VALUES (1,'Tom'),(2,'Karen');
-CREATE USER myuser WITH UNENCRYPTED PASSWORD 'Test123' NAME 'Hulk' SCHEMA 
"myschema";
-GRANT SELECT ON "myschema"."test" TO myuser;
-COMMIT;
-''')
-cur1.execute('SELECT "name" FROM "myschema"."test";')
-if cur1.fetchall() != [('Tom',), ('Karen',)]:
-sys.stderr.write('Expected result: [(\'Tom\',), (\'Karen\',)]')
-cur1.close()
-client1.close()
+from MonetDBtesting.sqltest import SQLTestCase
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='myuser', password='Test123')
-cur1 = client1.cursor()
-cur1.execute('SELECT "id", "name" FROM "myschema"."test";')
-if cur1.fetchall() != [(1,'Tom'),(2,'Karen')]:
-sys.stderr.write('Expected result: [(1,\'Tom\'),(2,\'Karen\')]')
-cur1.close()
-client1.close()
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
+mdb.execute("CREATE schema myschema;").assertSucceeded()
+mdb.execute("CREATE USER myuser WITH UNENCRYPTED PASSWORD 'Test123' NAME 
'Hulk' SCHEMA myschema;").assertSucceeded()
+mdb.execute("SET SCHEMA myschema;").assertSucceeded()
+mdb.execute("CREATE TABLE test (id integer, name varchar(20), address 
varchar(20));").assertSucceeded()
+mdb.execute("INSERT INTO test (id, name,address) VALUES (1,'Tom', 
'planet'),(2,'Karen', 'earth');").assertSucceeded()
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('''
-REVOKE SELECT ON "myschema"."test" FROM myuser;
-GRANT SELECT ("name") ON "myschema"."test" TO myuser;
-''')
-cur1.close()
-client1.close()
+with SQLTestCase() as tc:
+tc.connect(username="myuser", password="Test123")
+# 'myuser' cannot SELECT before GRANT and after REVOKE, can SELECT 
after GRANT
+tc.execute("select * from test").assertFailed(err_code='42000', 
err_message="SELECT: access denied for myuser to table 'myschema.test'")
+mdb.execute("GRANT SELECT ON test TO myuser;").assertSucceeded()
+tc.execute("select * from test").assertRowCount(2)
+mdb.execute("REVOKE SELECT ON test FROM myuser;").assertSucceeded()
+tc.execute("select * from test").assertFailed(err_code='42000', 
err_message="SELECT: access denied for myuser to table 'myschema.test'")
+
+# 'myuser' can SELECT test(id)
+mdb.execute("GRANT SELECT (id) ON test TO myuser;").assertSucceeded()
+tc.execute("select id from test").assertDataResultMatch([(1,),(2,)])
+tc.execute("select name from test").assertFailed(err_code='42000', 
err_message="SELECT: identifier 'name' unknown")
+tc.execute("select address from test").assertFailed(err_code='42000', 
err_message="SELECT: identifier 'address' unknown")
+tc.execute("select * from test").assertDataResultMatch([(1,),(2,)])
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='myuser', password='Test123')
-cur1 = client1.cursor()
-try:
-cur1.execute('SELECT "id", "name" FROM "myschema"."test";')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "identifier 'id' unknown" not in str(e):
-sys.stderr.write("Error: identifier 'id' unknown expected")
-cur1.execute('SELECT "name" FROM "myschema"."test";')
-if cur1.fetchall() != [('Tom',), ('Karen',)]:
-sys.stderr.write('Expected result: [(\'Tom\',), (\'Karen\',)]')
-cur1.close()
-client1.close()
+# 'myuser' can SELECT test(id, address)
+mdb.execute("GRANT SELECT (address) ON 

MonetDB: unlock - fix windows compilation

2020-12-21 Thread Niels Nes
Changeset: 8faa98666ff4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8faa98666ff4
Modified Files:
gdk/gdk_logger.c
Branch: unlock
Log Message:

fix windows compilation


diffs (12 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1972,7 +1972,7 @@ logger_flush(logger *lg, lng saved_id)
 {
if (LOG_DISABLED(lg)) {
lg->saved_id = saved_id;
-   lg->saved_tid = saved_id;
+   lg->saved_tid = lg->tid;
return GDK_SUCCEED;
}
if (lg->saved_id >= saved_id)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - converted & cleaned up

2020-12-21 Thread Ying Zhang
Changeset: d2d362b286c5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2d362b286c5
Removed Files:

sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.stable.err

sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.stable.out
Modified Files:
sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
Branch: default
Log Message:

converted & cleaned up


diffs (136 lines):

diff --git 
a/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py 
b/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
--- a/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
+++ b/sql/test/BugTracker-2018/Tests/grant-role-not-idempotent.Bug-6660.SQL.py
@@ -1,67 +1,35 @@
-import sys, os, pymonetdb
-
-db = os.getenv("TSTDB")
-port = int(os.getenv("MAPIPORT"))
-
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('create user "mydummyuser" with password \'mydummyuser\' name 
\'mydummyuser\' schema "sys";')
-cur1.close()
-client1.close()
+###
+# Check that GRANT a ROLE to a USER once works, but GRANT it a second time is
+#   properly rejected with "GRANT: User '' already has ROLE ''",
+#   which also prevents the related problems described in this bug, i.e.
+#   duplicate entries are created in sys.user_role and subsequent REVOKE
+#   doesn't work.
+###
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='mydummyuser', password='mydummyuser')
-cur1 = client1.cursor()
-try:
-cur1.execute('set role "sysadmin"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "Role (sysadmin) missing" not in str(e):
-sys.stderr.write("Error: Role (sysadmin) missing")
-cur1.close()
-client1.close()
+from MonetDBtesting.sqltest import SQLTestCase
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(0,)]:
-sys.stderr.write('Expected result: [(0,)]')
-cur1.execute('grant "sysadmin" to "mydummyuser";')
-cur1.close()
-client1.close()
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
+mdb.execute("create user mydummyuser with password 'mydummyuser' name 
'mydummyuser' schema sys;").assertSucceeded()
+
+with SQLTestCase() as tc:
+tc.connect(username="mydummyuser", password="mydummyuser")
+tc.execute("set role sysadmin;").assertFailed(err_code="42000", 
err_message="Role (sysadmin) missing")
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='mydummyuser', password='mydummyuser')
-cur1 = client1.cursor()
-cur1.execute('set role "sysadmin";')
-cur1.close()
-client1.close()
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(0,)])
+mdb.execute("grant sysadmin to mydummyuser;").assertSucceeded()
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(1,)])
+
+tc.execute("set role sysadmin;").assertSucceeded()
+
+mdb.execute("grant sysadmin to 
mydummyuser;").assertFailed(err_code="M1M05", err_message="GRANT: User 
'mydummyuser' already has ROLE 'sysadmin'")
+mdb.execute("select count(*) from user_role where login_id in (select 
id from sys.auths where name = 'mydummyuser');").assertDataResultMatch([(1,)])
 
-client1 = pymonetdb.connect(database=db, port=port, autocommit=True, 
username='monetdb', password='monetdb')
-cur1 = client1.cursor()
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(1,)]:
-sys.stderr.write('Expected result: [(1,)]')
-try:
-cur1.execute('grant "sysadmin" to "mydummyuser"; --error')
-sys.stderr.write("Exception expected")
-except pymonetdb.DatabaseError as e:
-if "User 'mydummyuser' already has ROLE 'sysadmin'" not in str(e):
-sys.stderr.write("Error: User 'mydummyuser' already has ROLE 
'sysadmin'")
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(1,)]:
-sys.stderr.write('Expected result: [(1,)]')
-cur1.execute('revoke "sysadmin" from "mydummyuser";')
-cur1.execute('select count(*) from "user_role" where "login_id" in (select 
"id" from "sys"."auths" where "name" = \'mydummyuser\');')
-if cur1.fetchall() != [(0,)]:
-sys.stderr.write('Expected result: [(0,)]')
-try:
-cur1.execute('revoke 

MonetDB: unlock - merged

2020-12-21 Thread Niels Nes
Changeset: d2af9010dc2b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2af9010dc2b
Branch: unlock
Log Message:

merged


diffs (43 lines):

diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -1,39 +1,10 @@
 HAVE_JDBCTESTS?JDBC_API_Tester
 HAVE_JDBCTESTS?SQLcopyinto
-HAVE_JDBCTESTS?Test_Cautocommit
-HAVE_JDBCTESTS?Test_CisValid
-HAVE_JDBCTESTS?Test_Clargequery
-HAVE_JDBCTESTS?Test_Cmanycon
-HAVE_JDBCTESTS?Test_Creplysize
-HAVE_JDBCTESTS?Test_Csavepoints
 #HAVE_JDBCTESTS?Test_Csendthread  # unfortunately has runtime-dependant output
-HAVE_JDBCTESTS?Test_Ctransaction
-HAVE_JDBCTESTS?Test_Dobjects
-HAVE_JDBCTESTS?Test_FetchSize
 HAVE_JDBCTESTS_HGE?Test_Int128
 HAVE_JDBCCLIENT_JAR?Test_JdbcClient
 HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys
-HAVE_JDBCTESTS?Test_PSgeneratedkeys
-HAVE_JDBCTESTS?Test_PSgetObject
-HAVE_JDBCTESTS?Test_PSlargebatchval
-HAVE_JDBCTESTS?Test_PSlargeresponse
 #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by 
default (it takes a long time to run and does not need to be run everytime, 
only before a new release)
-HAVE_JDBCTESTS?Test_PSmanycon
-HAVE_JDBCTESTS?Test_PSmetadata
-HAVE_JDBCTESTS?Test_PSsomeamount
-HAVE_JDBCTESTS?Test_PSsqldata
-HAVE_JDBCTESTS?Test_PStimedate
-HAVE_JDBCTESTS?Test_PStimezone
-HAVE_JDBCTESTS?Test_PStypes
-HAVE_JDBCTESTS?Test_CallableStmt
-HAVE_JDBCTESTS?Test_Rbooleans
-HAVE_JDBCTESTS?Test_Rmetadata
-HAVE_JDBCTESTS?Test_Rpositioning
-HAVE_JDBCTESTS?Test_Rsqldata
-HAVE_JDBCTESTS?Test_Rtimedate
-HAVE_JDBCTESTS?Test_Sbatching
-HAVE_JDBCTESTS?Test_Smoreresults
-HAVE_JDBCTESTS?Test_Wrapper
 HAVE_JDBCTESTS?BugConcurrent_clients_SF_1504657
 HAVE_JDBCTESTS?BugConcurrent_sequences
 HAVE_JDBCTESTS?BugExecuteUpdate_Bug_3350
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - Merge with default branch.

2020-12-21 Thread Sjoerd Mullender
Changeset: 0ffbc159626f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0ffbc159626f
Modified Files:
gdk/gdk_join.c
gdk/gdk_private.h
sql/common/sql_types.c
sql/server/rel_updates.c
sql/test/mapi/Tests/sql_int128.stable.out.int128
sql/test/mapi/Tests/sql_int128.test
Branch: unlock
Log Message:

Merge with default branch.


diffs (truncated from 1684 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -2698,7 +2698,7 @@ sed -i 's|/var/run|/run|' \
   are equal to 1.1.  (The old code returned 33554432 instead of 1.1e8.)
 
 * Sun Nov  5 2017 Sjoerd Mullender  - 11.27.9-20171105
-- BZ#6460 - selinux doen't allow mmap
+- BZ#6460: selinux doen't allow mmap
 
 * Mon Oct 23 2017 Sjoerd Mullender  - 11.27.9-20171023
 - Rebuilt.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -2469,6 +2469,12 @@ monetdb (11.27.11) unstable; urgency=low
 
 monetdb (11.27.9) unstable; urgency=low
 
+  * BZ#6460: selinux doen't allow mmap
+
+ -- Sjoerd Mullender   Sun, 5 Nov 2017 09:56:39 +0100
+
+monetdb (11.27.9) unstable; urgency=low
+
   * Rebuilt.
   * BZ#6207: identifier ambiguous when grouping and selecting the same
 column twice
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2502,7 +2502,8 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 struct canditer *restrict lci, struct canditer *restrict rci,
 bool nil_matches, bool nil_on_miss, bool semi, bool only_misses,
 bool not_in, bool max_one, bool min_one,
-BUN estimate, lng t0, bool swapped, bool hash, bool phash,
+BUN estimate, lng t0, bool swapped,
+bool hash, bool phash, bool hash_cand,
 const char *reason)
 {
oid lo, ro;
@@ -2521,7 +2522,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
const char *v = (const char *) 
bool lskipped = false;  /* whether we skipped values in l */
Hash *restrict hsh = NULL;
-   bool hash_cand = false;
 
assert(!BATtvoid(r));
assert(ATOMtype(l->ttype) == ATOMtype(r->ttype));
@@ -2558,7 +2558,24 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 
rl = rci->seq - r->hseqbase;
rh = canditer_last(rci) + 1 - r->hseqbase;
-   if (phash) {
+   if (hash_cand) {
+   /* we need to create a hash on r specific for the
+* candidate list */
+   char ext[32];
+   assert(rci->s);
+   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
+   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
+ "hash for candidate list " ALGOBATFMT "%s%s\n",
+ ALGOBATPAR(r), ALGOBATPAR(rci->s),
+ r->thash ? " ignoring existing hash" : "",
+ swapped ? " (swapped)" : "");
+   if (snprintf(ext, sizeof(ext), "thshjn%x",
+(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
+   goto bailout;
+   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
+   goto bailout;
+   }
+   } else if (phash) {
/* there is a hash on the parent which we should use */
MT_thread_setalgorithm(swapped ? "hashjoin using parent hash 
(swapped)" : "hashjoin using parent hash");
BAT *b = BBPdescriptor(VIEWtparent(r));
@@ -2580,24 +2597,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
  "existing hash%s\n",
  ALGOBATPAR(r),
  swapped ? " (swapped)" : "");
-   } else if (rci->tpe != cand_dense || rci->ncand != BATcount(r)) {
-   /* we need to create a hash on r specific for the
-* candidate list */
-   char ext[32];
-   assert(rci->s);
-   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
-   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
- "hash for candidate list " ALGOBATFMT "%s%s\n",
- ALGOBATPAR(r), ALGOBATPAR(rci->s),
- r->thash ? " ignoring existing hash" : "",
- swapped ? " (swapped)" : "");
-   if (snprintf(ext, sizeof(ext), "thshjn%x",
-(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
-   goto bailout;
-   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
-   goto bailout;
-   }
-   hash_cand = true;
} else {
/* we need to create a hash on r */
MT_thread_setalgorithm(swapped ? "hashjoin using new hash 
(swapped)" : "hashjoin using new hash");
@@ -3078,6 

MonetDB: default - merged

2020-12-21 Thread Niels Nes
Changeset: 4517decce365 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4517decce365
Branch: default
Log Message:

merged


diffs (43 lines):

diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -1,39 +1,10 @@
 HAVE_JDBCTESTS?JDBC_API_Tester
 HAVE_JDBCTESTS?SQLcopyinto
-HAVE_JDBCTESTS?Test_Cautocommit
-HAVE_JDBCTESTS?Test_CisValid
-HAVE_JDBCTESTS?Test_Clargequery
-HAVE_JDBCTESTS?Test_Cmanycon
-HAVE_JDBCTESTS?Test_Creplysize
-HAVE_JDBCTESTS?Test_Csavepoints
 #HAVE_JDBCTESTS?Test_Csendthread  # unfortunately has runtime-dependant output
-HAVE_JDBCTESTS?Test_Ctransaction
-HAVE_JDBCTESTS?Test_Dobjects
-HAVE_JDBCTESTS?Test_FetchSize
 HAVE_JDBCTESTS_HGE?Test_Int128
 HAVE_JDBCCLIENT_JAR?Test_JdbcClient
 HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys
-HAVE_JDBCTESTS?Test_PSgeneratedkeys
-HAVE_JDBCTESTS?Test_PSgetObject
-HAVE_JDBCTESTS?Test_PSlargebatchval
-HAVE_JDBCTESTS?Test_PSlargeresponse
 #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by 
default (it takes a long time to run and does not need to be run everytime, 
only before a new release)
-HAVE_JDBCTESTS?Test_PSmanycon
-HAVE_JDBCTESTS?Test_PSmetadata
-HAVE_JDBCTESTS?Test_PSsomeamount
-HAVE_JDBCTESTS?Test_PSsqldata
-HAVE_JDBCTESTS?Test_PStimedate
-HAVE_JDBCTESTS?Test_PStimezone
-HAVE_JDBCTESTS?Test_PStypes
-HAVE_JDBCTESTS?Test_CallableStmt
-HAVE_JDBCTESTS?Test_Rbooleans
-HAVE_JDBCTESTS?Test_Rmetadata
-HAVE_JDBCTESTS?Test_Rpositioning
-HAVE_JDBCTESTS?Test_Rsqldata
-HAVE_JDBCTESTS?Test_Rtimedate
-HAVE_JDBCTESTS?Test_Sbatching
-HAVE_JDBCTESTS?Test_Smoreresults
-HAVE_JDBCTESTS?Test_Wrapper
 HAVE_JDBCTESTS?BugConcurrent_clients_SF_1504657
 HAVE_JDBCTESTS?BugConcurrent_sequences
 HAVE_JDBCTESTS?BugExecuteUpdate_Bug_3350
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Don't run the individual tests which are test...

2020-12-21 Thread Niels Nes
Changeset: fc8c978cbf69 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fc8c978cbf69
Modified Files:
sql/jdbc/tests/Tests/All
Branch: Oct2020
Log Message:

Don't run the individual tests which are tested by the new jdbc Api tester


diffs (43 lines):

diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -1,39 +1,10 @@
 HAVE_JDBCTESTS?JDBC_API_Tester
 HAVE_JDBCTESTS?SQLcopyinto
-HAVE_JDBCTESTS?Test_Cautocommit
-HAVE_JDBCTESTS?Test_CisValid
-HAVE_JDBCTESTS?Test_Clargequery
-HAVE_JDBCTESTS?Test_Cmanycon
-HAVE_JDBCTESTS?Test_Creplysize
-HAVE_JDBCTESTS?Test_Csavepoints
 #HAVE_JDBCTESTS?Test_Csendthread  # unfortunately has runtime-dependant output
-HAVE_JDBCTESTS?Test_Ctransaction
-HAVE_JDBCTESTS?Test_Dobjects
-HAVE_JDBCTESTS?Test_FetchSize
 HAVE_JDBCTESTS_HGE?Test_Int128
 HAVE_JDBCCLIENT_JAR?Test_JdbcClient
 HAVE_JDBCCLIENT_JAR?bogus-auto-generated-keys
-HAVE_JDBCTESTS?Test_PSgeneratedkeys
-HAVE_JDBCTESTS?Test_PSgetObject
-HAVE_JDBCTESTS?Test_PSlargebatchval
-HAVE_JDBCTESTS?Test_PSlargeresponse
 #HAVE_JDBCTESTS?Test_PSlargeamount # scalabity test which is disabled by 
default (it takes a long time to run and does not need to be run everytime, 
only before a new release)
-HAVE_JDBCTESTS?Test_PSmanycon
-HAVE_JDBCTESTS?Test_PSmetadata
-HAVE_JDBCTESTS?Test_PSsomeamount
-HAVE_JDBCTESTS?Test_PSsqldata
-HAVE_JDBCTESTS?Test_PStimedate
-HAVE_JDBCTESTS?Test_PStimezone
-HAVE_JDBCTESTS?Test_PStypes
-HAVE_JDBCTESTS?Test_CallableStmt
-HAVE_JDBCTESTS?Test_Rbooleans
-HAVE_JDBCTESTS?Test_Rmetadata
-HAVE_JDBCTESTS?Test_Rpositioning
-HAVE_JDBCTESTS?Test_Rsqldata
-HAVE_JDBCTESTS?Test_Rtimedate
-HAVE_JDBCTESTS?Test_Sbatching
-HAVE_JDBCTESTS?Test_Smoreresults
-HAVE_JDBCTESTS?Test_Wrapper
 HAVE_JDBCTESTS?BugConcurrent_clients_SF_1504657
 HAVE_JDBCTESTS?BugConcurrent_sequences
 HAVE_JDBCTESTS?BugExecuteUpdate_Bug_3350
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - add some more locks to make sure logrotation a...

2020-12-21 Thread Niels Nes
Changeset: 0010fd8975fd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0010fd8975fd
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
Branch: unlock
Log Message:

add some more locks to make sure logrotation and appending are exclusive


diffs (249 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -806,10 +806,12 @@ append_col(sql_trans *tr, sql_column *c,
bat = c->data;
/* appends only write */
bat->cs.wtime = c->base.atime = c->t->base.atime = c->t->s->base.atime 
= tr->atime = tr->wstime;
+   lock_table(c->t->base.id);
if (tpe == TYPE_bat)
ok = delta_append_bat(bat, offset, i, c->t);
else
ok = delta_append_val(bat, offset, i, c->t);
+   unlock_table(c->t->base.id);
return ok;
 }
 
@@ -829,10 +831,12 @@ append_idx(sql_trans *tr, sql_idx * i, s
bat = i->data;
/* appends only write */
bat->cs.wtime = i->base.atime = i->t->base.atime = i->t->s->base.atime 
= tr->atime = tr->wstime;
+   lock_table(i->t->base.id);
if (tpe == TYPE_bat)
ok = delta_append_bat(bat, offset, ib, i->t);
else
ok = delta_append_val(bat, offset, ib, i->t);
+   unlock_table(i->t->base.id);
return ok;
 }
 
@@ -1826,7 +1830,7 @@ minmax( sql_trans *tr )
 }
 
 static int
-tr_update_cs( sql_trans *tr, column_storage *ocs, column_storage *ccs)
+tr_update_cs( sql_trans *tr, column_storage *ocs, column_storage *ccs, BUN end)
 {
int ok = LOG_OK;
BAT *cur = NULL;
@@ -1854,6 +1858,7 @@ tr_update_cs( sql_trans *tr, column_stor
cur = temp_descriptor(ocs->bid);
if(!cur)
return LOG_ERR;
+   assert(end <= BATcount(cur));
if (ccs->ucnt && ccs->uibid) {
assert(!cleared);
BAT *ui = temp_descriptor(ccs->uibid);
@@ -1902,9 +1907,9 @@ tr_update_cs( sql_trans *tr, column_stor
 }
 
 static int
-tr_update_delta( sql_trans *tr, sql_delta *obat, sql_delta *cbat)
+tr_update_delta( sql_trans *tr, sql_delta *obat, sql_delta *cbat, BUN end)
 {
-   int ok = tr_update_cs( tr, >cs, >cs);
+   int ok = tr_update_cs( tr, >cs, >cs, end);
 
if (ok == LOG_OK && obat->next) {
ok = destroy_bat(obat->next);
@@ -1914,7 +1919,7 @@ tr_update_delta( sql_trans *tr, sql_delt
 }
 
 static int
-tr_merge_cs( sql_trans *tr, column_storage *cs)
+tr_merge_cs( sql_trans *tr, column_storage *cs, BUN end)
 {
int ok = LOG_OK;
BAT *cur = NULL;
@@ -1929,6 +1934,7 @@ tr_merge_cs( sql_trans *tr, column_stora
return LOG_ERR;
}
 
+   assert(end <= BATcount(cur));
if (cs->ucnt) {
BAT *ui = temp_descriptor(cs->uibid);
BAT *uv = temp_descriptor(cs->uvbid);
@@ -1966,9 +1972,9 @@ tr_merge_cs( sql_trans *tr, column_stora
 }
 
 static int
-tr_merge_delta( sql_trans *tr, sql_delta *obat)
+tr_merge_delta( sql_trans *tr, sql_delta *obat, BUN end)
 {
-   int ok = tr_merge_cs(tr, >cs);
+   int ok = tr_merge_cs(tr, >cs, end);
if (obat->next) {
ok = destroy_bat(obat->next);
obat->next = NULL;
@@ -2014,7 +2020,7 @@ tr_update_dbat( sql_trans *tr, storage *
}
ts->cnt += fs->ucnt;
ts->cnt -= fs->icnt;
-   int ok = tr_update_cs( tr, >cs, >cs);
+   int ok = tr_update_cs( tr, >cs, >cs, ts->end);
if (ok == LOG_OK && ts->next) {
ok = destroy_dbat(tr, ts->next);
ts->next = NULL;
@@ -2025,7 +2031,7 @@ tr_update_dbat( sql_trans *tr, storage *
 static int
 tr_merge_dbat(sql_trans *tr, storage *tdb)
 {
-   int ok = tr_merge_cs(tr, >cs);
+   int ok = tr_merge_cs(tr, >cs, tdb->end);
if (tdb->next) {
ok = destroy_dbat(tr, tdb->next);
tdb->next = NULL;
@@ -2040,6 +2046,7 @@ update_table(sql_trans *tr, sql_table *f
sql_table *ot = NULL;
int ok = LOG_OK;
node *n, *m, *o = NULL;
+   segments *sg = NULL;
 
if (ATOMIC_GET(_nr_active) == 1 || ft->base.allocated) {
if (ATOMIC_GET(_nr_active) > 1 && ft->data) { /* move 
delta */
@@ -2064,6 +2071,7 @@ update_table(sql_trans *tr, sql_table *f
}
}
} else if (tt->data && ft->base.allocated) {
+   sg = ((storage*)ft->data)->segs;
if (tr_update_dbat(tr, tt->data, ft->data) != LOG_OK)
ok = LOG_ERR;
} else if (ATOMIC_GET(_nr_active) == 1 && 
!ft->base.allocated) {
@@ -2073,6 +2081,7 @@ update_table(sql_trans *tr, sql_table *f
tt->data = timestamp_dbat(ot->data, 
tt->base.stime);
}
 

MonetDB: unlock - protect rotating open log file

2020-12-21 Thread Niels Nes
Changeset: b3dffc2c155e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3dffc2c155e
Modified Files:
gdk/gdk_logger.c
Branch: unlock
Log Message:

protect rotating open log file


diffs (12 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1981,6 +1981,8 @@ logger_flush(logger *lg, lng saved_id)
return GDK_SUCCEED;
log_return res = LOG_OK;
while(lg->saved_id < saved_id && res == LOG_OK) {
+   if (lg->saved_id >= lg->id)
+   break;
if (!lg->input_log) {
char *filename;
char id[BUFSIZ];
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - cleaned up

2020-12-21 Thread Ying Zhang
Changeset: e914f4efd580 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e914f4efd580
Removed Files:
sql/test/Users/Tests/changeSchemaUser.reqtests
sql/test/Users/Tests/createSetUp.sql
sql/test/Users/Tests/createSetUp.test
Modified Files:
sql/test/Users/Tests/All
sql/test/Users/Tests/changeSchemaUser.SQL.py
Branch: default
Log Message:

cleaned up

- removed all dependencies on createSetUp
- all tests in this dir are now stand-alone


diffs (197 lines):

diff --git a/sql/test/Users/Tests/All b/sql/test/Users/Tests/All
--- a/sql/test/Users/Tests/All
+++ b/sql/test/Users/Tests/All
@@ -1,17 +1,16 @@
-function_privs
-role
-table
-table_privs
-unknown_user
-withGrantOption
-grantMonetdb
+changePasswordUser
+changeSchemaUser
 columnRights
-changePasswordUser
 copyinto
-schemaRights
-metadataConsistency
 createUserRollback
-userCallFunction
+function_privs
+grantMonetdb
+metadataConsistency
 renameUser
-createSetUp
-changeSchemaUser
+role
+schemaRights
+table_privs
+table
+unknown_user
+userCallFunction
+withGrantOption
diff --git a/sql/test/Users/Tests/changeSchemaUser.SQL.py 
b/sql/test/Users/Tests/changeSchemaUser.SQL.py
--- a/sql/test/Users/Tests/changeSchemaUser.SQL.py
+++ b/sql/test/Users/Tests/changeSchemaUser.SQL.py
@@ -1,57 +1,56 @@
 ###
-# Change the default schema of a user (possible).
-# Change the default schema of a user to an unexisting schema (not possible).
-# Change the default schema for an unexisting user (not possible).
-# Drop a user that owns a schema (not possible).
+# Tests for schema assignments and changes for users
 ###
 
 from MonetDBtesting.sqltest import SQLTestCase
 
-with SQLTestCase() as tc:
-tc.connect(username="monetdb", password="monetdb")
-tc.execute('ALTER USER "april" SET SCHEMA library').assertSucceeded()
-tc.execute('ALTER USER "april2" SET SCHEMA library; --no such 
user').assertFailed()
-tc.execute('ALTER USER "april" SET SCHEMA library2; --no such 
schema').assertFailed()
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
+mdb.execute("CREATE SCHEMA library;").assertSucceeded()
+mdb.execute("CREATE TABLE library.orders(price int, name 
VARCHAR(100));").assertSucceeded()
 
-tc.connect(username="april", password="april")
-tc.execute('SELECT * from bank.accounts; --no such 
table.').assertSucceeded()
-tc.execute('SELECT * from library.orders; --not enough 
privileges.').assertFailed()
+mdb.execute("CREATE ROLE bankAdmin;").assertSucceeded()
+mdb.execute("CREATE SCHEMA bank AUTHORIZATION 
bankAdmin;").assertSucceeded()
+mdb.execute("CREATE TABLE bank.accounts(nr int, name 
VARCHAR(100));").assertSucceeded()
 
-tc.connect(username="monetdb", password="monetdb")
-tc.execute('ALTER USER "april" SET SCHEMA bank;').assertSucceeded()
-tc.execute('CREATE SCHEMA forAlice AUTHORIZATION april;').assertSucceeded()
-tc.execute('DROP user april;').assertFailed()
+mdb.execute("CREATE USER april WITH PASSWORD 'april' name 'april' schema 
bank;").assertSucceeded()
+mdb.execute("GRANT ALL ON bank.accounts to april;").assertSucceeded()
+mdb.execute("GRANT bankAdmin to april;").assertSucceeded()
 
-# import os, sys
-# try:
-# from MonetDBtesting import process
-# except ImportError:
-# import process
+# Check that change the default schema for an unexisting user is not 
possible.
+mdb.execute('ALTER USER "april2" SET SCHEMA 
library;').assertFailed(err_code="42M32", err_message="ALTER USER: no such user 
'april2'")
+# Check that change the default schema of a user to an unexisting schema 
is not possible.
+mdb.execute('ALTER USER "april" SET SCHEMA 
library2;').assertFailed(err_code="3F000", err_message="ALTER USER: no such 
schema 'library2'")
 
-# def sql_test_client(user, passwd, input):
-# with process.client(lang="sql", user=user, passwd=passwd, 
communicate=True,
-# stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE,
-# input=input, port=int(os.getenv("MAPIPORT"))) as c:
-# c.communicate()
+with SQLTestCase() as tc:
+# Check that the admin can change the default schema of a user, and
+#   this will take effect the next time this user logs-in.
+tc.connect(username="april", password="april")
+tc.execute("SELECT current_schema;").assertDataResultMatch([('bank',)])
+tc.execute('SELECT * from accounts;').assertSucceeded()
+mdb.execute('ALTER USER "april" SET SCHEMA library').assertSucceeded()
+tc.connect(username="april", password="april")
+tc.execute("SELECT 
current_schema;").assertDataResultMatch([('library',)])
 
-# sql_test_client('monetdb', 'monetdb', input="""\
-# ALTER USER "april" SET SCHEMA library;
-# ALTER USER "april2" SET SCHEMA library; --no such user
-# ALTER USER "april" SET SCHEMA library2; --no such schema
-# """)
+# Check that after 

MonetDB: default - clean up and minor extensions

2020-12-21 Thread Ying Zhang
Changeset: fe2a746081a7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe2a746081a7
Removed Files:
sql/test/Users/Tests/renameUser.stable.err
sql/test/Users/Tests/renameUser.stable.out
Modified Files:
sql/test/Users/Tests/All
sql/test/Users/Tests/renameUser.SQL.py
Branch: default
Log Message:

clean up and minor extensions


diffs (289 lines):

diff --git a/sql/test/Users/Tests/All b/sql/test/Users/Tests/All
--- a/sql/test/Users/Tests/All
+++ b/sql/test/Users/Tests/All
@@ -12,6 +12,6 @@ schemaRights
 metadataConsistency
 createUserRollback
 userCallFunction
+renameUser
 createSetUp
-renameUser
 changeSchemaUser
diff --git a/sql/test/Users/Tests/renameUser.SQL.py 
b/sql/test/Users/Tests/renameUser.SQL.py
--- a/sql/test/Users/Tests/renameUser.SQL.py
+++ b/sql/test/Users/Tests/renameUser.SQL.py
@@ -1,81 +1,81 @@
 ###
-# Let admin rename a user (from A to B) (possible).
-# Create another user with the old name (A)(possible).
-# Verify that the new user (A) cannot make use of the role assign to the 
inital user (now B).
-# Verify that a user with no special permissions cannot rename users.
-# Verify that the renamed user (B) still has his rights.
-# Rename a user with an already existing name (not possible).
-# Rename an unexisting user (not possible).
-# Create an user on a non-existing schema (not possible).
-# Create an user with a name of an existing user (not possible).
+# Check various aspects of renaming users
 ###
 
 from MonetDBtesting.sqltest import SQLTestCase
+import logging
 
-with SQLTestCase() as tc:
-tc.connect(username="monetdb", password="monetdb")
-tc.execute('ALTER USER "april" RENAME TO "april2"; 
--succeed').assertSucceeded()
+logging.basicConfig(level=logging.FATAL)
 
-tc.execute("CREATE USER april with password 'april' name 'second' schema 
bank;")
-
-tc.connect(username="april", password="april")
-tc.execute("DELETE from bank.accounts; -- not enough 
privelges").assertFailed()
-tc.execute("SET role bankAdmin; -- no such role").assertFailed()
-tc.execute('ALTER USER "april2" RENAME TO "april3"; --not enough 
privileges').assertFailed()
+with SQLTestCase() as mdb:
+with SQLTestCase() as tc2:
+mdb.connect(username="monetdb", password="monetdb")
+# prepare a user 'april' as the owner of schema 'bank'
+mdb.execute("CREATE ROLE bankAdmin;").assertSucceeded()
+mdb.execute("CREATE SCHEMA bank AUTHORIZATION 
bankAdmin;").assertSucceeded()
+mdb.execute("CREATE USER april WITH PASSWORD 'april' NAME 'april' 
SCHEMA bank;").assertSucceeded()
+mdb.execute("GRANT bankAdmin to april;").assertSucceeded()
+mdb.execute("CREATE TABLE bank.accounts(nr int, name 
VARCHAR(100));").assertSucceeded()
+# just a sanity check
+tc2.connect(username="april", password="april")
+tc2.execute("SET ROLE bankAdmin;").assertSucceeded()
 
-tc.connect(username='april2', password='april')
-tc.execute("""
-SELECT * from bank.accounts;
-SET role bankAdmin;
-""").assertSucceeded()
-
-tc.connect(username='monetdb', password='monetdb')
-tc.execute('ALTER USER "april2" RENAME TO "april";').assertFailed()
-tc.execute("drop user april;").assertSucceeded()
-tc.execute('ALTER USER "april2" RENAME TO "april";').assertSucceeded()
-tc.execute('ALTER USER "april5" RENAME TO "april2"; -- no such 
user').assertFailed()
-tc.execute("drop user april2; --nu such user").assertFailed()
-tc.execute("CREATE USER april2 with password 'april' name 'second april, 
no rights' schema library2; --no such schema").assertFailed()
-tc.execute("CREATE USER april with password 'april' name 'second april, no 
rights' schema library; --user exsists").assertFailed()
-
-
+# Check that:
+#   the admin can rename a user (from A to B);
+#   after the rename, user B can log in but not user A
+mdb.execute("ALTER USER april RENAME TO april2;").assertSucceeded()
+tc2.connect(username="april", password="april")
+tc2.execute("SET ROLE bankAdmin;").assertFailed(err_code=None, 
err_message="InvalidCredentialsException:checkCredentials:invalid credentials 
for user 'april'")
+tc2.connect(username="april2", password="april")
+tc2.execute("SET ROLE bankAdmin;").assertSucceeded()
+# Check that the renamed user (B) still has its rights.
+tc2.execute("SET role bankAdmin;").assertSucceeded()
+tc2.execute("DROP TABLE accounts;").assertSucceeded()
+tc2.execute("CREATE TABLE accounts(nr int, name 
VARCHAR(100));").assertSucceeded()
+tc2.execute("INSERT INTO accounts VALUES (24, 'abc'), (42, 
'xyz');").assertRowCount(2)
+tc2.execute("UPDATE accounts SET nr = 666;").assertRowCount(2)
+tc2.execute("DELETE FROM accounts WHERE name = 
'abc';").assertRowCount(1)
+tc2.execute("SELECT * from bank.accounts;").assertRowCount(1)
 
-# import os, 

MonetDB: indirect-privs - Merged with default

2020-12-21 Thread Pedro Ferreira
Changeset: 296a5f438e9a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=296a5f438e9a
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/common/sql_types.c
sql/server/rel_updates.c
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
sql/test/Users/Tests/All
Branch: indirect-privs
Log Message:

Merged with default


diffs (truncated from 27259 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -2698,7 +2698,7 @@ sed -i 's|/var/run|/run|' \
   are equal to 1.1.  (The old code returned 33554432 instead of 1.1e8.)
 
 * Sun Nov  5 2017 Sjoerd Mullender  - 11.27.9-20171105
-- BZ#6460 - selinux doen't allow mmap
+- BZ#6460: selinux doen't allow mmap
 
 * Mon Oct 23 2017 Sjoerd Mullender  - 11.27.9-20171023
 - Rebuilt.
diff --git a/clients/odbc/samples/testgetinfo.c 
b/clients/odbc/samples/testgetinfo.c
--- a/clients/odbc/samples/testgetinfo.c
+++ b/clients/odbc/samples/testgetinfo.c
@@ -1133,13 +1133,13 @@ main(int argc, char **argv)
ret = SQLGetInfo(dbc, sqlinfo[n].info, , sizeof(i), 
);
if (check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo") &&
sqlinfo[n].i != i)
-   fprintf(stderr, "%s: expected: %u, received: 
%u\n", sqlinfo[n].name, sqlinfo[n].i, i);
+   fprintf(stderr, "%s: expected: %u, received: 
%u\n", sqlinfo[n].name, (unsigned int) sqlinfo[n].i, (unsigned int) i);
break;
default:/* case SHORTINT */
ret = SQLGetInfo(dbc, sqlinfo[n].info, , sizeof(s), 
);
if (check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo") &&
sqlinfo[n].s != s)
-   fprintf(stderr, "%s: expected: %u, received: 
%u\n", sqlinfo[n].name, sqlinfo[n].s, s);
+   fprintf(stderr, "%s: expected: %u, received: 
%u\n", sqlinfo[n].name, (unsigned int) sqlinfo[n].s, (unsigned int) s);
break;
}
}
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -2469,6 +2469,12 @@ monetdb (11.27.11) unstable; urgency=low
 
 monetdb (11.27.9) unstable; urgency=low
 
+  * BZ#6460: selinux doen't allow mmap
+
+ -- Sjoerd Mullender   Sun, 5 Nov 2017 09:56:39 +0100
+
+monetdb (11.27.9) unstable; urgency=low
+
   * Rebuilt.
   * BZ#6207: identifier ambiguous when grouping and selecting the same
 column twice
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2500,7 +2500,8 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 struct canditer *restrict lci, struct canditer *restrict rci,
 bool nil_matches, bool nil_on_miss, bool semi, bool only_misses,
 bool not_in, bool max_one,
-BUN estimate, lng t0, bool swapped, bool hash, bool phash,
+BUN estimate, lng t0, bool swapped,
+bool hash, bool phash, bool hash_cand,
 const char *reason)
 {
oid lo, ro;
@@ -2519,7 +2520,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
const char *v = (const char *) 
bool lskipped = false;  /* whether we skipped values in l */
Hash *restrict hsh = NULL;
-   bool hash_cand = false;
 
assert(!BATtvoid(r));
assert(ATOMtype(l->ttype) == ATOMtype(r->ttype));
@@ -2555,7 +2555,24 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 
rl = rci->seq - r->hseqbase;
rh = canditer_last(rci) + 1 - r->hseqbase;
-   if (phash) {
+   if (hash_cand) {
+   /* we need to create a hash on r specific for the
+* candidate list */
+   char ext[32];
+   assert(rci->s);
+   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
+   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
+ "hash for candidate list " ALGOBATFMT "%s%s\n",
+ ALGOBATPAR(r), ALGOBATPAR(rci->s),
+ r->thash ? " ignoring existing hash" : "",
+ swapped ? " (swapped)" : "");
+   if (snprintf(ext, sizeof(ext), "thshjn%x",
+(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
+   goto bailout;
+   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
+   goto bailout;
+   }
+   } else if (phash) {
/* there is a hash on the parent which we should use */
MT_thread_setalgorithm(swapped ? "hashjoin using parent hash 
(swapped)" : "hashjoin using parent hash");
BAT *b = BBPdescriptor(VIEWtparent(r));
@@ -2577,24 +2594,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
  "existing hash%s\n",
 

MonetDB: default - Attempting to reduce stack deepness further

2020-12-21 Thread Pedro Ferreira
Changeset: 44069977606a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44069977606a
Modified Files:

sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.sql

sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.stable.out

sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.test
Branch: default
Log Message:

Attempting to reduce stack deepness further


diffs (34 lines):

diff --git 
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.sql
 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.sql
--- 
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.sql
+++ 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.sql
@@ -1,3 +1,3 @@
 select cast( 
1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1
 as bigint);
 
-select cast( 
1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(
 
1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1
  as bigint);
+select cast( 
1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1)
 ) as bigint);
diff --git 
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.stable.out
 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.stable.out
--- 
a/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.stable.out
+++ 
b/sql/test/BugDay_2005-10-06_2.9.3/Tests/huge_expression_and_column_name.SF-921173.stable.out
@@ -73,7 +73,7 @@ stdout of test 'huge_expression_and_colu
 % %1 # name
 % bigint # type
 % 4 # length
-[ 501  ]
+[ 251  ]
 
 # 16:51:10 >  
 # 16:51:10 >  Done.
diff --git 

MonetDB: default - Approved output in new format

2020-12-21 Thread Pedro Ferreira
Changeset: 4f447e715675 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4f447e715675
Modified Files:
sql/test/mapi/Tests/sql_int128.test
Branch: default
Log Message:

Approved output in new format


diffs (25 lines):

diff --git a/sql/test/mapi/Tests/sql_int128.test 
b/sql/test/mapi/Tests/sql_int128.test
--- a/sql/test/mapi/Tests/sql_int128.test
+++ b/sql/test/mapi/Tests/sql_int128.test
@@ -18,10 +18,6 @@ sql.mvc
 1
 sql.tid
 1
-sql.bind
-1
-algebra.projection
-1
 algebra.project
 1
 sql.update
@@ -42,10 +38,6 @@ sql.mvc
 1
 sql.tid
 1
-sql.bind
-1
-algebra.projection
-1
 algebra.project
 1
 sql.update
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Fixed test expected output

2020-12-21 Thread Pedro Ferreira
Changeset: f4885bd25d60 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4885bd25d60
Modified Files:
sql/test/Users/Tests/columnRights.SQL.py
Branch: default
Log Message:

Fixed test expected output


diffs (15 lines):

diff --git a/sql/test/Users/Tests/columnRights.SQL.py 
b/sql/test/Users/Tests/columnRights.SQL.py
--- a/sql/test/Users/Tests/columnRights.SQL.py
+++ b/sql/test/Users/Tests/columnRights.SQL.py
@@ -29,9 +29,9 @@ with SQLTestCase() as tc:
 # FIXME: the following two queries currently fail due to the problems
 #   discussed in issue #7035.  May need to fix the expected error once that
 #   issue is fixed
-tc.execute("UPDATE orders SET name = name || 'book title goes 
here';").assertFailed(err_code='42000', err_message="UPDATE: inufficient 
privileges for user 'alice' to update table 'orders'")
+tc.execute("UPDATE orders SET name = name || 'book title goes 
here';").assertFailed(err_code='42000', err_message="SELECT: identifier 'name' 
unknown")
 # but not this update involving the 'price' column
-tc.execute("UPDATE orders SET name = 'new book title' where price = 
12;").assertSucceeded().assertRowCount(2)
+tc.execute("UPDATE orders SET name = 'new book title' where price = 
12;").assertSucceeded().assertRowCount(1)
 
 # clean up
 tc.connect(username="monetdb", password="monetdb")
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Updated error messages

2020-12-21 Thread Pedro Ferreira
Changeset: c4dc56b92f01 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c4dc56b92f01
Modified Files:
sql/server/rel_updates.c
Branch: default
Log Message:

Updated error messages


diffs (34 lines):

diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -1076,8 +1076,9 @@ update_table(sql_query *query, dlist *qn
/* We have always to reduce the column visibility because of 
the SET clause */
if (!table_privs(sql, t, PRIV_SELECT)) {
sql_rel *nres = NULL;
-   if (!(nres = rel_reduce_on_column_privileges(sql, res, 
t)) && opt_where) /* on global updates the user may be able to upd*/
-   return sql_error(sql, 02, SQLSTATE(42000) 
"UPDATE: insufficient privileges for user '%s' to update table '%s'", 
sqlvar_get_string(find_global_var(sql, mvc_bind_schema(sql, "sys"), 
"current_user")), tname);
+   if (!(nres = rel_reduce_on_column_privileges(sql, res, 
t)) && opt_where) /* on global updates the user may be able to update */
+   return sql_error(sql, 02, SQLSTATE(42000) 
"UPDATE: insufficient privileges for user '%s' to update table '%s'",
+
get_string_global_var(sql, "current_user"), tname);
if (!nres) {
res->exps = sa_list(sql->sa); /* hasn't select 
privilege on any column, add just TID column to the list */
} else {
@@ -1166,7 +1167,8 @@ delete_table(sql_query *query, dlist *qn
 
if (!table_privs(sql, t, PRIV_SELECT)) {
if (!(r = rel_reduce_on_column_privileges(sql, 
r, t)))
-   return sql_error(sql, 02, 
SQLSTATE(42000) "DELETE FROM: insufficient privileges for user '%s' to delete 
from table '%s'", sqlvar_get_string(find_global_var(sql, mvc_bind_schema(sql, 
"sys"), "current_user")), tname);
+   return sql_error(sql, 02, 
SQLSTATE(42000) "DELETE FROM: insufficient privileges for user '%s' to delete 
from table '%s'",
+
get_string_global_var(sql, "current_user"), tname);
list_append(r->exps, exp_column(sql->sa, alias 
? alias : tname, TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1));
}
if (!(r = rel_logical_exp(query, r, opt_where, 
sql_where)))
@@ -1271,7 +1273,7 @@ merge_into_table(sql_query *query, dlist
if (!table_privs(sql, t, PRIV_SELECT)) {
if (!(bt = rel_reduce_on_column_privileges(sql, bt, t)))
return sql_error(sql, 02, SQLSTATE(42000) "MERGE: 
access denied for %s to table %s%s%s'%s'",
-
sqlvar_get_string(find_global_var(sql, mvc_bind_schema(sql, "sys"), 
"current_user")), t->s ? "'":"", t->s ? t->s->base.name : "", t->s ? "'.":"", 
tname);
+
get_string_global_var(sql, "current_user"), t->s ? "'":"", t->s ? 
t->s->base.name : "", t->s ? "'.":"", tname);
list_append(bt->exps, exp_column(sql->sa, alias ? alias : 
tname, TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1));
}
joined = table_ref(query, NULL, tref, 0, NULL);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Update test with changes from Oct2020 branch.

2020-12-21 Thread Sjoerd Mullender
Changeset: 2948146bdbf2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2948146bdbf2
Modified Files:
sql/test/astro/Tests/astro.test
Branch: default
Log Message:

Update test with changes from Oct2020 branch.


diffs (53 lines):

diff --git a/sql/test/astro/Tests/astro.test b/sql/test/astro/Tests/astro.test
--- a/sql/test/astro/Tests/astro.test
+++ b/sql/test/astro/Tests/astro.test
@@ -69,7 +69,7 @@ update(
 | single project (
 | | single left outer join (
 | | | semijoin (
-| | | | table("sys"."fluxz") [ "fluxz"."runcat" NOT NULL, "fluxz"."filter" NOT 
NULL, "fluxz"."f_datapoints" NOT NULL, "fluxz"."active" NOT NULL, 
"fluxz"."avg_flux" NOT NULL, "fluxz"."avg_fluxsq" NOT NULL, "fluxz"."avg_w" NOT 
NULL, "fluxz"."avg_wflux" NOT NULL, "fluxz"."avg_wfluxsq" NOT NULL, 
"fluxz"."avg_dec_zone_deg" NOT NULL, "fluxz"."%TID%" NOT NULL ] COUNT ,
+| | | | table("sys"."fluxz") [ "fluxz"."runcat" NOT NULL, "fluxz"."filter" NOT 
NULL, "fluxz"."%TID%" NOT NULL ] COUNT ,
 | | | | select (
 | | | | | table("sys"."cm_flux") [ "cm_flux"."runcat" NOT NULL, 
"cm_flux"."filter" NOT NULL, "cm_flux"."active" NOT NULL ] COUNT 
 | | | | ) [ "cm_flux"."active" NOT NULL = boolean "true", "cm_flux"."filter" 
NOT NULL = char(1) "g" ]
@@ -84,6 +84,40 @@ update(
 ) [ "fluxz"."%TID%" NOT NULL, "fluxz"."filter" NOT NULL, 
"fluxz"."f_datapoints" NOT NULL, "fluxz"."avg_flux" NOT NULL, 
"fluxz"."avg_fluxsq" NOT NULL, "fluxz"."avg_w" NOT NULL, "fluxz"."avg_wflux" 
NOT NULL, "fluxz"."avg_wfluxsq" NOT NULL, "fluxz"."avg_dec_zone_deg" NOT NULL ]
 
 statement ok
+UPDATE fluxz
+   SET (filter
+   ,f_datapoints
+   ,avg_flux
+   ,avg_fluxsq
+   ,avg_w
+   ,avg_wflux
+   ,avg_wfluxsq
+   ,avg_dec_zone_deg
+   )
+   =
+   (SELECT filter
+  ,f_datapoints
+  ,avg_flux
+  ,avg_fluxsq
+  ,avg_w
+  ,avg_wflux
+  ,avg_wfluxsq
+  ,avg_dec_zone_deg
+  FROM cm_flux 
+ WHERE cm_flux.runcat = fluxz.runcat 
+   AND cm_flux.active = TRUE 
+   AND cm_flux.filter = 'g' 
+   AND cm_flux.filter = fluxz.filter
+   )
+ WHERE EXISTS (SELECT runcat
+ FROM cm_flux
+WHERE cm_flux.runcat = fluxz.runcat 
+  AND cm_flux.active = TRUE 
+  AND cm_flux.filter = 'g' 
+  AND cm_flux.filter = fluxz.filter
+  )
+
+statement ok
 drop table "fluxz"
 
 statement ok
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Oct2020 branch.

2020-12-21 Thread Sjoerd Mullender
Changeset: 091132e1ee74 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=091132e1ee74
Modified Files:
MonetDB.spec
gdk/gdk_join.c
gdk/gdk_private.h
sql/server/rel_updates.c

sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out.Windows
sql/test/BugTracker-2020/Tests/All
sql/test/mapi/Tests/sql_int128.sql
Branch: default
Log Message:

Merge with Oct2020 branch.


diffs (truncated from 906 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -2698,7 +2698,7 @@ sed -i 's|/var/run|/run|' \
   are equal to 1.1.  (The old code returned 33554432 instead of 1.1e8.)
 
 * Sun Nov  5 2017 Sjoerd Mullender  - 11.27.9-20171105
-- BZ#6460 - selinux doen't allow mmap
+- BZ#6460: selinux doen't allow mmap
 
 * Mon Oct 23 2017 Sjoerd Mullender  - 11.27.9-20171023
 - Rebuilt.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -2469,6 +2469,12 @@ monetdb (11.27.11) unstable; urgency=low
 
 monetdb (11.27.9) unstable; urgency=low
 
+  * BZ#6460: selinux doen't allow mmap
+
+ -- Sjoerd Mullender   Sun, 5 Nov 2017 09:56:39 +0100
+
+monetdb (11.27.9) unstable; urgency=low
+
   * Rebuilt.
   * BZ#6207: identifier ambiguous when grouping and selecting the same
 column twice
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2500,7 +2500,8 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 struct canditer *restrict lci, struct canditer *restrict rci,
 bool nil_matches, bool nil_on_miss, bool semi, bool only_misses,
 bool not_in, bool max_one,
-BUN estimate, lng t0, bool swapped, bool hash, bool phash,
+BUN estimate, lng t0, bool swapped,
+bool hash, bool phash, bool hash_cand,
 const char *reason)
 {
oid lo, ro;
@@ -2519,7 +2520,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
const char *v = (const char *) 
bool lskipped = false;  /* whether we skipped values in l */
Hash *restrict hsh = NULL;
-   bool hash_cand = false;
 
assert(!BATtvoid(r));
assert(ATOMtype(l->ttype) == ATOMtype(r->ttype));
@@ -2555,7 +2555,24 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 
rl = rci->seq - r->hseqbase;
rh = canditer_last(rci) + 1 - r->hseqbase;
-   if (phash) {
+   if (hash_cand) {
+   /* we need to create a hash on r specific for the
+* candidate list */
+   char ext[32];
+   assert(rci->s);
+   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
+   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
+ "hash for candidate list " ALGOBATFMT "%s%s\n",
+ ALGOBATPAR(r), ALGOBATPAR(rci->s),
+ r->thash ? " ignoring existing hash" : "",
+ swapped ? " (swapped)" : "");
+   if (snprintf(ext, sizeof(ext), "thshjn%x",
+(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
+   goto bailout;
+   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
+   goto bailout;
+   }
+   } else if (phash) {
/* there is a hash on the parent which we should use */
MT_thread_setalgorithm(swapped ? "hashjoin using parent hash 
(swapped)" : "hashjoin using parent hash");
BAT *b = BBPdescriptor(VIEWtparent(r));
@@ -2577,24 +2594,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
  "existing hash%s\n",
  ALGOBATPAR(r),
  swapped ? " (swapped)" : "");
-   } else if (rci->tpe != cand_dense || rci->ncand != BATcount(r)) {
-   /* we need to create a hash on r specific for the
-* candidate list */
-   char ext[32];
-   assert(rci->s);
-   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
-   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
- "hash for candidate list " ALGOBATFMT "%s%s\n",
- ALGOBATPAR(r), ALGOBATPAR(rci->s),
- r->thash ? " ignoring existing hash" : "",
- swapped ? " (swapped)" : "");
-   if (snprintf(ext, sizeof(ext), "thshjn%x",
-(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
-   goto bailout;
-   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
-   goto bailout;
-   }
-   hash_cand = true;
} else {
/* we need to create a hash on r */
MT_thread_setalgorithm(swapped ? "hashjoin using new hash