MonetDB: Oct2020 - Fix old changelog entry.

2020-12-18 Thread Sjoerd Mullender
Changeset: 124006178a3f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=124006178a3f
Modified Files:
MonetDB.spec
debian/changelog
misc/packages/deb/changelog
misc/packages/rpm/changelog
Branch: Oct2020
Log Message:

Fix old changelog entry.


diffs (56 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -2720,7 +2720,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/misc/packages/deb/changelog b/misc/packages/deb/changelog
--- a/misc/packages/deb/changelog
+++ b/misc/packages/deb/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/misc/packages/rpm/changelog b/misc/packages/rpm/changelog
--- a/misc/packages/rpm/changelog
+++ b/misc/packages/rpm/changelog
@@ -1844,7 +1844,7 @@
   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.
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Add upgrade code.

2020-12-18 Thread Sjoerd Mullender
Changeset: 7ea1cab8361e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ea1cab8361e
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:

Add upgrade code.


diffs (truncated from 880 to 300 lines):

diff --git a/sql/backends/monet5/sql_upgrades.c 
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -2718,6 +2718,40 @@ sql_update_default(Client c, mvc *sql, c
"  END || ')'\n"
"END\n"
"END;\n"
+   "END;\n"
+   "CREATE FUNCTION 
sys.describe_table(schemaName string, tableName string)\n"
+   "  RETURNS TABLE(name string, query 
string, type string, id integer, remark string)\n"
+   "BEGIN\n"
+   "  RETURN SELECT t.name, t.query, 
tt.table_type_name, t.id, c.remark\n"
+   "FROM sys.schemas s, 
sys.table_types tt, sys._tables t\n"
+   "LEFT OUTER JOIN sys.comments c ON 
t.id = c.id\n"
+   "  WHERE s.name = schemaName\n"
+   "  AND t.schema_id = s.id\n"
+   "  AND t.name = tableName\n"
+   "  AND t.type = tt.table_type_id;\n"
+   "END;\n"
+   "CREATE FUNCTION 
sys.describe_columns(schemaName string, tableName string)\n"
+   "  RETURNS TABLE(name string, type 
string, digits integer, scale integer, Nulls boolean, cDefault string, number 
integer, sqltype string, remark string)\n"
+   "BEGIN\n"
+   "  RETURN SELECT c.name, c.\"type\", 
c.type_digits, c.type_scale, c.\"null\", c.\"default\", c.number, 
describe_type(c.\"type\", c.type_digits, c.type_scale), com.remark\n"
+   "FROM sys._tables t, sys.schemas s, 
sys._columns c\n"
+   "LEFT OUTER JOIN sys.comments com 
ON c.id = com.id\n"
+   "  WHERE c.table_id = t.id\n"
+   "  AND t.name = tableName\n"
+   "  AND t.schema_id = s.id\n"
+   "  AND s.name = schemaName\n"
+   "ORDER BY c.number;\n"
+   "END;\n"
+   "CREATE FUNCTION 
sys.describe_function(schemaName string, functionName string)\n"
+   "  RETURNS TABLE(id integer, name 
string, type string, language string, remark string)\n"
+   "BEGIN\n"
+   "  RETURN SELECT f.id, f.name, 
ft.function_type_keyword, fl.language_keyword, c.remark\n"
+   "FROM sys.functions f\n"
+   "JOIN sys.schemas s ON f.schema_id 
= s.id\n"
+   "JOIN sys.function_types ft ON 
f.type = ft.function_type_id\n"
+   "LEFT OUTER JOIN 
sys.function_languages fl ON f.language = fl.language_id\n"
+

MonetDB: Oct2020 - Missed closing quotes on Windows output

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

sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out.Windows
Branch: Oct2020
Log Message:

Missed closing quotes on Windows output


diffs (15 lines):

diff --git 
a/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out.Windows
 
b/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out.Windows
--- 
a/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out.Windows
+++ 
b/sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out.Windows
@@ -41,9 +41,9 @@ insert(
 % clob # type
 % 203 # length
 insert(
-| table("sys."cm_tmp") [ "cm_tmp"."i", "cm_tmp"."%TID%" NOT NULL ] COUNT 
+| table("sys"."cm_tmp") [ "cm_tmp"."i", "cm_tmp"."%TID%" NOT NULL ] COUNT 
 | union (
-| | table ("sys."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", varchar 
"NULL", varchar "null", varchar "a:\\file1", bigint "-1", bigint "0", int "0", 
int "0", varchar "NULL", int "0", int "1"), 
+| | table ("sys"."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", 
varchar "NULL", varchar "null", varchar "a:\\file1", bigint "-1", bigint "0", 
int "0", int "0", varchar "NULL", int "0", int "1"), 
 | | ) [ "cm_tmp"."i" ] COUNT ,
 | | table ("sys"."copyfrom"(table("cm_tmp"), varchar "|", varchar "\n", 
varchar "NULL", varchar "null", varchar "Z:/file2", bigint "-1", bigint "0", 
int "0", int "0", varchar "NULL", int "0", int "1"), 
 | | ) [ "cm_tmp"."i" ] COUNT 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Add cast: sometimes SQLUINTEGER is defined as...

2020-12-18 Thread Sjoerd Mullender
Changeset: e1cbba16af80 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e1cbba16af80
Modified Files:
clients/odbc/samples/testgetinfo.c
Branch: default
Log Message:

Add cast: sometimes SQLUINTEGER is defined as unsigned long.


diffs (19 lines):

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, &i, sizeof(i), 
&resultlen);
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, &s, sizeof(s), 
&resultlen);
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;
}
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Fix 32 bit output.

2020-12-18 Thread Sjoerd Mullender
Changeset: 1665370e7e1a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1665370e7e1a
Modified Files:
sql/test/emptydb/Tests/check.stable.out.32bit
Branch: default
Log Message:

Fix 32 bit output.


diffs (truncated from 377 to 300 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit 
b/sql/test/emptydb/Tests/check.stable.out.32bit
--- a/sql/test/emptydb/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb/Tests/check.stable.out.32bit
@@ -1022,7 +1022,7 @@ create function sys.deltas ("schema" str
 create function sys.describe_columns(schemaname string, tablename string) 
returns table(name string, type string, digits integer, scale integer, nulls 
boolean, cdefault string, number integer, sqltype string, remark string) begin 
return select c.name, c."type", c.type_digits, c.type_scale, c."null", 
c."default", c.number, describe_type(c."type", c.type_digits, c.type_scale), 
com.remark from sys._tables t, sys.schemas s, sys._columns c left outer join 
sys.comments com on c.id = com.id where c.table_id = t.id and t.name = 
tablename and t.schema_id = s.id and s.name = schemaname order by c.number; end;
 create function sys.describe_function(schemaname string, functionname string) 
returns table(id integer, name string, type string, language string, remark 
string) begin return select f.id, f.name, ft.function_type_keyword, 
fl.language_keyword, c.remark from sys.functions f join sys.schemas s on 
f.schema_id = s.id join sys.function_types ft on f.type = ft.function_type_id 
left outer join sys.function_languages fl on f.language = fl.language_id left 
outer join sys.comments c on f.id = c.id where f.name=functionname and s.name = 
schemaname; end;
 create function sys.describe_table(schemaname string, tablename string) 
returns table(name string, query string, type string, id integer, remark 
string) begin return select t.name, t.query, tt.table_type_name, t.id, c.remark 
from sys.schemas s, sys.table_types tt, sys._tables t left outer join 
sys.comments c on t.id = c.id where s.name = schemaname and t.schema_id = s.id 
and t.name = tablename and t.type = tt.table_type_id; end;
-create function sys.describe_type(ctype string, digits integer, tscale 
integer) returns string begin return case ctype when 'bigint' then 'BIGINT' 
when 'blob' then case digits when 0 then 'BINARY LARGE OBJECT' else 'BINARY 
LARGE OBJECT(' || cast(digits as string) || ')' end when 'boolean' then 
'BOOLEAN' when 'char' then case digits when 1 then 'CHARACTER' else 
'CHARACTER(' || cast(digits as string) || ')' end when 'clob' then case digits 
when 0 then 'CHARACTER LARGE OBJECT' else 'CHARACTER LARGE OBJECT(' || 
cast(digits as string) || ')' end when 'date' then 'DATE' when 'day_interval' 
then 'INTERVAL DAY' when 'decimal' then 'DECIMAL(' || cast(digits as string) || 
',' || cast(tscale as string) || ')' when 'double' then case when digits = 53 
and tscale = 0 then 'DOUBLE' when tscale = 0 then 'FLOAT(' || cast(digits as 
string) || ')' else 'FLOAT(' || cast(digits as string) || ',' || cast(tscale as 
string) || ')' end when 'geometry' then case digits when 4 then 
'GEOMETRY(POINT' || case ts
 cale when 0 then '' else ',' || cast(tscale as string) end || ')' when 8 then 
'GEOMETRY(LINESTRING' || case tscale when 0 then '' else ',' || cast(tscale as 
string) end || ')' when 16 then 'GEOMETRY(POLYGON' || case tscale when 0 then 
'' else ',' || cast(tscale as string) end || ')' when 20 then 
'GEOMETRY(MULTIPOINT' || case tscale when 0 then '' else ',' || cast(tscale as 
string) end || ')' when 24 then 'GEOMETRY(MULTILINESTRING' || case tscale when 
0 then '' else ',' || cast(tscale as string) end || ')' when 28 then 
'GEOMETRY(MULTIPOLYGON' || case tscale when 0 then '' else ',' || cast(tscale 
as string) end || ')' when 32 then 'GEOMETRY(GEOMETRYCOLLECTION' || case tscale 
when 0 then '' else ',' || cast(tscale as string) end || ')' else 'GEOMETRY' 
end when 'hugeint' then 'HUGEINT' when 'int' then 'INTEGER' when 
'month_interval' then case digits when 1 then 'INTERVAL YEAR' when 2 then 
'INTERVAL YEAR TO MONTH' when 3 then 'INTERVAL MONTH' end when 'real' then case 
when digits = 24 an
 d tscale = 0 then 'REAL' when tscale = 0 then 'FLOAT(' || cast(digits as 
string) || ')' else 'FLOAT(' || cast(digits as string) || ',' || cast(tscale as 
string) || ')' end when 'sec_interval' then case digits when 4 then 'INTERVAL 
DAY' when 5 then 'INTERVAL DAY TO HOUR' when 6 then 'INTERVAL DAY TO MINUTE' 
when 7 then 'INTERVAL DAY TO SECOND' when 8 then 'INTERVAL HOUR' when 9 then 
'INTERVAL HOUR TO MINUTE' when 10 then 'INTERVAL HOUR TO SECOND' when 11 then 
'INTERVAL MINUTE' when 12 then 'INTERVAL MINUTE TO SECOND' when 13 then 
'INTERVAL SECOND' end when 'smallint' then 'SMALLINT' when 'time' then case 
digits when 1 then 'TIME' else 'TIME(' || cast(digits - 1 as string) || ')' end 
when 'timestamp' then case digits when 7 then 'TIMESTAMP' else 'TIMESTAMP(' || 
cast(digits - 1 as string) || ')' end 

MonetDB: default - Reapproved dependency tests after describe fu...

2020-12-18 Thread Pedro Ferreira
Changeset: 13b76f8fb50d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=13b76f8fb50d
Modified Files:
sql/test/Dependencies/Tests/dependency_DBobjects.test
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
Branch: default
Log Message:

Reapproved dependency tests after describe functions changes


diffs (44 lines):

diff --git a/sql/test/Dependencies/Tests/dependency_DBobjects.test 
b/sql/test/Dependencies/Tests/dependency_DBobjects.test
--- a/sql/test/Dependencies/Tests/dependency_DBobjects.test
+++ b/sql/test/Dependencies/Tests/dependency_DBobjects.test
@@ -201,6 +201,9 @@ DEP_FUNC
 table_types
 describe_table
 DEP_FUNC
+types
+describe_type
+DEP_FUNC
 
 query TTT rowsort
 SELECT c.name, v.name, 'DEP_VIEW' from sys.columns as c, sys.tables as v, 
sys.dependencies as dep where c.id = dep.id AND v.id = dep.depend_id AND 
dep.depend_type = 5 AND v.type = 1 order by c.name, v.name
@@ -289,7 +292,7 @@ DEP_INDEX
 query TTT rowsort
 SELECT c.name, f.name, 'DEP_FUNC' from sys.functions as f, sys.columns as c, 
sys.dependencies as dep where c.id = dep.id AND f.id = dep.depend_id AND 
dep.depend_type = 7 ORDER BY c.name, f.name
 
-231 values hashing to af0e8e04145602bfcd5f1132155f90eb
+255 values hashing to e2d9a3e1109be2f236e4d7f734331ef0
 
 query TTT rowsort
 SELECT c.name, tri.name, 'DEP_TRIGGER' from sys.columns as c, sys.triggers as 
tri, sys.dependencies as dep where dep.id = c.id AND dep.depend_id =tri.id AND 
dep.depend_type = 8 order by c.name, tri.name
diff --git a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test 
b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
--- a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
+++ b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
@@ -113,6 +113,9 @@ DEP_FUNC
 table_types
 describe_table
 DEP_FUNC
+types
+describe_type
+DEP_FUNC
 
 query TTT rowsort
 SELECT c.name, v.name, 'DEP_VIEW' from sys.columns as c, sys.tables as v, 
sys.dependencies as dep where c.id = dep.id AND v.id = dep.depend_id AND 
dep.depend_type = 5 AND v.type in (1, 11, 21, 31) order by c.name, v.name
@@ -181,7 +184,7 @@ SELECT c.name, i.name, 'DEP_INDEX' from 
 query TTT rowsort
 SELECT c.name, f.name, 'DEP_FUNC' from sys.functions as f, sys.columns as c, 
sys.dependencies as dep where c.id = dep.id AND f.id = dep.depend_id AND 
dep.depend_type = 7 ORDER BY c.name, f.name
 
-216 values hashing to e8f79649cf289338183a5bd412bf2ca0
+240 values hashing to a54398d1b2159982985fb2a8b3dd764e
 
 query TTT rowsort
 SELECT c.name, tri.name, 'DEP_TRIGGER' from sys.columns as c, sys.objects as 
tri, sys.dependencies as dep where dep.id = c.id AND dep.depend_id =tri.id AND 
dep.depend_type = 8 order by c.name, tri.name
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Silence Windows.

2020-12-18 Thread Sjoerd Mullender
Changeset: 99d19bf89c42 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=99d19bf89c42
Modified Files:
sql/test/mapi/Tests/python3_dbapi.SQL.bat
sql/test/mapi/Tests/sample0.SQL.bat
sql/test/mapi/Tests/sample1.SQL.bat
sql/test/mapi/Tests/sample4.SQL.bat
sql/test/mapi/Tests/smack00.SQL.bat
sql/test/mapi/Tests/smack01.SQL.bat
Branch: default
Log Message:

Silence Windows.


diffs (62 lines):

diff --git a/sql/test/mapi/Tests/python3_dbapi.SQL.bat 
b/sql/test/mapi/Tests/python3_dbapi.SQL.bat
--- a/sql/test/mapi/Tests/python3_dbapi.SQL.bat
+++ b/sql/test/mapi/Tests/python3_dbapi.SQL.bat
@@ -1,8 +1,5 @@
 @echo off
 
-prompt # $t $g  
-echo on
-
 rem must be aligned with the installation directory chosen in
 rem clients/examples/python
 set testpath=%TSTSRCBASE%\clients\examples\python
diff --git a/sql/test/mapi/Tests/sample0.SQL.bat 
b/sql/test/mapi/Tests/sample0.SQL.bat
--- a/sql/test/mapi/Tests/sample0.SQL.bat
+++ b/sql/test/mapi/Tests/sample0.SQL.bat
@@ -1,6 +1,3 @@
 @echo off
 
-prompt # $t $g  
-echo on
-
 sample0.exe %HOST% %MAPIPORT% sql
diff --git a/sql/test/mapi/Tests/sample1.SQL.bat 
b/sql/test/mapi/Tests/sample1.SQL.bat
--- a/sql/test/mapi/Tests/sample1.SQL.bat
+++ b/sql/test/mapi/Tests/sample1.SQL.bat
@@ -1,6 +1,3 @@
 @echo off
 
-prompt # $t $g  
-echo on
-
 sample1.exe %HOST% %MAPIPORT% sql
diff --git a/sql/test/mapi/Tests/sample4.SQL.bat 
b/sql/test/mapi/Tests/sample4.SQL.bat
--- a/sql/test/mapi/Tests/sample4.SQL.bat
+++ b/sql/test/mapi/Tests/sample4.SQL.bat
@@ -1,6 +1,3 @@
 @echo off
 
-prompt # $t $g  
-echo on
-
 sample4.exe %HOST% %MAPIPORT% sql
diff --git a/sql/test/mapi/Tests/smack00.SQL.bat 
b/sql/test/mapi/Tests/smack00.SQL.bat
--- a/sql/test/mapi/Tests/smack00.SQL.bat
+++ b/sql/test/mapi/Tests/smack00.SQL.bat
@@ -1,6 +1,3 @@
 @echo off
 
-prompt # $t $g  
-echo on
-
 smack00.exe %MAPIPORT% sql
diff --git a/sql/test/mapi/Tests/smack01.SQL.bat 
b/sql/test/mapi/Tests/smack01.SQL.bat
--- a/sql/test/mapi/Tests/smack01.SQL.bat
+++ b/sql/test/mapi/Tests/smack01.SQL.bat
@@ -1,6 +1,3 @@
 @echo off
 
-prompt # $t $g  
-echo on
-
 smack01.exe %MAPIPORT% sql
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-perl: default - Also pass MONETDB_DATABASE

2020-12-18 Thread Joeri van Ruth
Changeset: 17959d0d6923 for monetdb-perl
URL: https://dev.monetdb.org/hg/monetdb-perl?cmd=changeset;node=17959d0d6923
Modified Files:
MonetDB-CLI-MapiPP/MonetDB/CLI/t/02cxn.t
MonetDB-CLI/MonetDB/t/02cxn.t
Branch: default
Log Message:

Also pass MONETDB_DATABASE


diffs (30 lines):

diff --git a/MonetDB-CLI-MapiPP/MonetDB/CLI/t/02cxn.t 
b/MonetDB-CLI-MapiPP/MonetDB/CLI/t/02cxn.t
--- a/MonetDB-CLI-MapiPP/MonetDB/CLI/t/02cxn.t
+++ b/MonetDB-CLI-MapiPP/MonetDB/CLI/t/02cxn.t
@@ -20,9 +20,10 @@ my $port = $ENV{MONETDB_PORT} || 5;
 my $user = $ENV{MONETDB_USER} || 'monetdb';
 my $pass = $ENV{MONETDB_PASS} || 'monetdb';
 my $lang = 'sql';
+my $database = $ENV{MONETDB_DATABASE} || 'demo';
 
 my $cxn = eval {
-  MonetDB::CLI::MapiPP->connect( $host, $port, $user, $pass, $lang )
+  MonetDB::CLI::MapiPP->connect( $host, $port, $user, $pass, $lang, $database )
 };
 ok(!$@,'connect') or print "# $@";
 ok( $cxn,"Connection object: $cxn");
diff --git a/MonetDB-CLI/MonetDB/t/02cxn.t b/MonetDB-CLI/MonetDB/t/02cxn.t
--- a/MonetDB-CLI/MonetDB/t/02cxn.t
+++ b/MonetDB-CLI/MonetDB/t/02cxn.t
@@ -20,9 +20,10 @@ my $port = $ENV{MONETDB_PORT} || 5;
 my $user = $ENV{MONETDB_USER} || 'monetdb';
 my $pass = $ENV{MONETDB_PASS} || 'monetdb';
 my $lang = 'sql';
+my $database = $ENV{MONETDB_DATABASE} || 'demo';
 
 my $cxn = eval {
-  MonetDB::CLI->connect( $host, $port, $user, $pass, $lang )
+  MonetDB::CLI->connect( $host, $port, $user, $pass, $lang, $database )
 };
 ok(!$@,'connect') or print "# $@";
 ok( $cxn,"Connection object: $cxn");
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-perl: default - Still need DBI

2020-12-18 Thread Joeri van Ruth
Changeset: 03e6ddee4090 for monetdb-perl
URL: https://dev.monetdb.org/hg/monetdb-perl?cmd=changeset;node=03e6ddee4090
Modified Files:
.github/workflows/runtests.yml
Branch: default
Log Message:

Still need DBI


diffs (17 lines):

diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml
--- a/.github/workflows/runtests.yml
+++ b/.github/workflows/runtests.yml
@@ -23,6 +23,13 @@ jobs:
 
   - uses: actions/checkout@v2
 
+  - name: Install libdbi-perl
+run: |
+  set -x -e
+  lsb_release -c -s
+  sudo apt-get -qq update
+  sudo apt-get -qq install -y libdbi-perl
+
   - name: Run Unit-Tests
 run: |
   set -x -e
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-perl: default - Run monetdb in a service container

2020-12-18 Thread Joeri van Ruth
Changeset: b35ed8684036 for monetdb-perl
URL: https://dev.monetdb.org/hg/monetdb-perl?cmd=changeset;node=b35ed8684036
Modified Files:
.github/workflows/runtests.yml
runtests.sh
Branch: default
Log Message:

Run monetdb in a service container

So we can later test against multiple versions of MonetDB
by taking the image name from a matrix


diffs (70 lines):

diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml
--- a/.github/workflows/runtests.yml
+++ b/.github/workflows/runtests.yml
@@ -11,22 +11,18 @@ jobs:
   runtests:
 runs-on: ubuntu-latest
 env:
-  DBFARM: /var/lib/monetdb
+  DBI_DSN: dbi:monetdb:database=demo
+
+services:
+  monetdb:
+image: monetdb/monetdb:latest
+ports:
+  - 5:5
 
 steps:
+
   - uses: actions/checkout@v2
 
-  - name: Install MonetDB
-run: |
-  set -x -e
-  lsb_release -c -s
-  sudo apt-get -qq update
-  sudo apt-get -qq install -y software-properties-common curl make 
libdbi-perl
-  curl -s https://www.monetdb.org/downloads/MonetDB-GPG-KEY | sudo 
apt-key add -
-  sudo add-apt-repository "deb http://dev.monetdb.org/downloads/deb/ 
$(lsb_release -c -s) monetdb"
-  sudo apt-get -qq update
-  sudo apt-get -qq install -qqy monetdb5-server
-
   - name: Run Unit-Tests
 run: |
   set -x -e
diff --git a/runtests.sh b/runtests.sh
--- a/runtests.sh
+++ b/runtests.sh
@@ -1,31 +1,11 @@
 #!/bin/bash
 
-DBPATH="$PWD"/DB
-
-
 set -e -x
 
-# Start the mserver
-rm -rf "$DBPATH"
-mkdir "$DBPATH"
-mserver5 --dbpath="$DBPATH/perltestdb" >"$DBPATH/mserver5.log" 2>&1 &
-pid=$!
-# Make sure to kill it when the script ends
-trap "kill -9 $pid 2>/dev/null" EXIT
-
+export DBI_DSN=dbi:monetdb:database=demo
 
-# After a few seconds, check if it's still running
-sleep 3
-if ! kill -0 $pid 2>/dev/null; then
-   echo "MSERVER STOPPED EARLY"
-   cat "$DBPATH/mserver5.log"
-   exit 1
-fi
-
-export DBI_DSN=dbi:monetdb:database=perltestdb
 export PERL5LIB=$PWD/MonetDB-CLI-MapiPP:$PWD/MonetDB-CLI:$PWD
 
-
 for i in DBD MonetDB-CLI/MonetDB MonetDB-CLI-MapiPP/MonetDB/CLI
 do
(
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-perl: default - Try taking the MonetDB container version...

2020-12-18 Thread Joeri van Ruth
Changeset: 472a9445eb6a for monetdb-perl
URL: https://dev.monetdb.org/hg/monetdb-perl?cmd=changeset;node=472a9445eb6a
Modified Files:
.github/workflows/runtests.yml
Branch: default
Log Message:

Try taking the MonetDB container version from a matrix


diffs (31 lines):

diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml
--- a/.github/workflows/runtests.yml
+++ b/.github/workflows/runtests.yml
@@ -9,13 +9,18 @@ on:
 
 jobs:
   runtests:
+strategy:
+  matrix:
+monetdb_image:
+  - monetdb/monetdb:latest
+  - monetdb/monetdb:Jun2020-SP1
 runs-on: ubuntu-latest
 env:
   DBI_DSN: dbi:monetdb:database=demo
 
 services:
   monetdb:
-image: monetdb/monetdb:latest
+image: ${{monetdb_image}}
 ports:
   - 5:5
 
@@ -26,7 +31,6 @@ jobs:
   - name: Install libdbi-perl
 run: |
   set -x -e
-  lsb_release -c -s
   sudo apt-get -qq update
   sudo apt-get -qq install -y libdbi-perl
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-perl: default - Syntax refinement

2020-12-18 Thread Joeri van Ruth
Changeset: 8d6cfd04bde0 for monetdb-perl
URL: https://dev.monetdb.org/hg/monetdb-perl?cmd=changeset;node=8d6cfd04bde0
Modified Files:
.github/workflows/runtests.yml
Branch: default
Log Message:

Syntax refinement


diffs (12 lines):

diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml
--- a/.github/workflows/runtests.yml
+++ b/.github/workflows/runtests.yml
@@ -20,7 +20,7 @@ jobs:
 
 services:
   monetdb:
-image: ${{monetdb_image}}
+image: ${{ matrix.monetdb_image }}
 ports:
   - 5:5
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Reduce query deepness further

2020-12-18 Thread Pedro Ferreira
Changeset: 9a8f60bcefb5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a8f60bcefb5
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:

Reduce query 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+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1
 
+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+(1+
 
(1+(1+(1+(1+(1+(1+(1+(1)))

MonetDB: Jun2020 - Work around stupid Intel compiler.

2020-12-18 Thread Sjoerd Mullender
Changeset: 8463d2cb4629 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8463d2cb4629
Modified Files:
gdk/gdk_private.h
Branch: Jun2020
Log Message:

Work around stupid Intel compiler.


diffs (40 lines):

diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -276,6 +276,28 @@ BAT *virtualize(BAT *bn)
b->timprints ? "I" : b->theap.parentid && 
BBP_cache(b->theap.parentid)->timprints ? "(I)" : ""
 /* use ALGOOPTBAT* when BAT is optional (can be NULL) */
 #define ALGOOPTBATFMT  "%s%s" BUNFMT "%s" OIDFMT "%s%s%s%s%s%s%s%s%s%s%s%s"
+#if defined(_MSC_VER) && defined(__INTEL_COMPILER)
+/* stupid Intel compiler can't handle the "complexity" */
+#define ALGOOPTBATPAR(b)   \
+   b ? BATgetId(b) : "",   \
+   b ? "#" : "",   \
+   b ? BATcount(b) : 0,\
+   b ? "@" : "",   \
+   b ? b->hseqbase : 0,\
+   b ? "[" : "",   \
+   b ? ATOMname(b->ttype) : "",\
+   b ? "]" : "",   \
+   b ? !b->batTransient ? "P" : b->theap.parentid ? "V" : b->tvheap && 
b->tvheap->parentid != b->batCacheid ? "v" : "T" : "",  \
+   b ? BATtdense(b) ? "D" : b->ttype == TYPE_void && b->tvheap ? "X" : "" 
: "", \
+   b ? b->tsorted ? "S" : b->tnosorted ? "!s" : "" : "",   \
+   b ? b->trevsorted ? "R" : b->tnorevsorted ? "!r" : "" : "", \
+   b ? b->tkey ? "K" : b->tnokey[1] ? "!k" : "" : "",  \
+   b && b->tnonil ? "N" : "",  \
+   b && b->thash ? "H" : "",   \
+   b && b->torderidx ? "O" : "",   \
+   b ? b->timprints ? "I" : b->theap.parentid && 
BBP_cache(b->theap.parentid)->timprints ? "(I)" : "" : ""
+#else
+/* this is the version we actually want to use (and do use on most platforms) 
*/
 #define ALGOOPTBATPAR(b)   \
b ? BATgetId(b) : "",   \
b ? "#" : "",   \
@@ -294,6 +316,7 @@ BAT *virtualize(BAT *bn)
b && b->thash ? "H" : "",   \
b && b->torderidx ? "O" : "",   \
b ? b->timprints ? "I" : b->theap.parentid && 
BBP_cache(b->theap.parentid)->timprints ? "(I)" : "" : ""
+#endif
 
 #define BBP_BATMASK(128 * SIZEOF_SIZE_T - 1)
 #define BBP_THREADMASK 63
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - Merged with Jun2020, not changing any code.

2020-12-18 Thread Sjoerd Mullender
Changeset: c50eb74a9bab for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c50eb74a9bab
Modified Files:
gdk/gdk_private.h
Branch: Oct2020
Log Message:

Merged with Jun2020, not changing any code.
The problem with the Intel compiler that was fixed in the Jun2020
branch only occurred there.

___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Use .test format and enable test just for int...

2020-12-18 Thread Pedro Ferreira
Changeset: a9810d774e67 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a9810d774e67
Added Files:
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.test
Removed Files:
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.SQL.py
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.err
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
Modified Files:
sql/test/BugTracker-2016/Tests/All
Branch: default
Log Message:

Use .test format and enable test just for int128 installations


diffs (truncated from 23847 to 300 lines):

diff --git a/sql/test/BugTracker-2016/Tests/All 
b/sql/test/BugTracker-2016/Tests/All
--- a/sql/test/BugTracker-2016/Tests/All
+++ b/sql/test/BugTracker-2016/Tests/All
@@ -1,5 +1,5 @@
 HAVE_GEOM?storagemodel
-convert-function-test.Bug-3460
+HAVE_HGE?convert-function-test.Bug-3460
 HAVE_HGE?convert-function-test-hge.Bug-3460
 groupby_on_column_expression.Bug-3832
 LEFT-JOIN_with_OR_conditions_triggers_assertion.Bug-3908
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.SQL.py 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.SQL.py
deleted file mode 100644
--- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.SQL.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from MonetDBtesting.sqltest import SQLTestCase
-import pymonetdb, os
-
-conn1 = pymonetdb.connect(database=os.getenv("TSTDB"), 
port=int(os.getenv("MAPIPORT")), autocommit=True)
-cur1 = conn1.cursor()
-try:
-cur1.execute('select cast(1 as hugeint)')
-suffix = '.int128'
-except pymonetdb.DatabaseError as e:
-suffix = ''
-cur1.close()
-conn1.close()
-
-with SQLTestCase() as tc:
-tc.connect()
-with open('convert-function-test.Bug-3460.sql') as f:
-tc.execute(query=None, client='mclient', stdin=f)\
-
.assertMatchStableOut(fout='convert-function-test.Bug-3460.stable.out%s' % 
(suffix))\
-
.assertMatchStableError(ferr='convert-function-test.Bug-3460.stable.err%s' % 
(suffix))
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.err 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.err
deleted file mode 100644
--- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.err
+++ /dev/null
@@ -1,3240 +0,0 @@
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, bit) from T_BOOLEAN; -- BIT not valid data type
-ERROR = !Type (bit) unknown in: "select v, convert(v, bit)"
-!syntax error in: "from"
-CODE  = 22000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, hugeint) from T_BOOLEAN;
-ERROR = !Type (hugeint) unknown in: "select v, convert(v, hugeint)"
-!syntax error in: "from"
-CODE  = 22000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, float) from T_BOOLEAN; -- conversion not supported
-ERROR = !types boolean(1,0) and double(53,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, float(24)) from T_BOOLEAN; -- conversion not 
supported
-ERROR = !types boolean(1,0) and real(24,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, real) from T_BOOLEAN; -- conversion not supported
-ERROR = !types boolean(1,0) and real(24,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, double) from T_BOOLEAN; -- conversion not 
supported
-ERROR = !types boolean(1,0) and double(53,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, double precision) from T_BOOLEAN; -- conversion 
not supported
-ERROR = !types boolean(1,0) and double(53,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, numeric) from T_BOOLEAN; -- conversion not 
supported
-ERROR = !types boolean(1,0) and decimal(18,3) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, decimal) from T_BOOLEAN; -- conversion not 
supported
-ERROR = !types boolean(1,0) and decimal(18,3) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, numeric(7)) from T_BOOLEAN; -- conversion not 
supported
-ERROR = !types boolean(1,0) and decimal(7,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-146634/.s.monetdb.36912
-QUERY = SELECT v, convert(v, decimal(9)) from T_BOOLEAN; -- conversion not 
supported
-ERROR = !types boolean(1,0) and decimal(9,0) are not equal for column 'v'
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-1466

MonetDB: default - Forgot newline at the end of byte string

2020-12-18 Thread Pedro Ferreira
Changeset: 1724928b31c9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1724928b31c9
Modified Files:
sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
Branch: default
Log Message:

Forgot newline at the end of byte string


diffs (12 lines):

diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py 
b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
--- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
+++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
@@ -57,7 +57,7 @@ with process.client('sql', text=False, s
 sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)'")
 
 # Using BOM as a SQL identifier
-INPUT5 = b"\x53\x45\x4C\x45\x43\x54\x20\x22\xEF\xBB\xBF\x22\x3B"
+INPUT5 = b"\x53\x45\x4C\x45\x43\x54\x20\x22\xEF\xBB\xBF\x22\x3B\x0A"
 with process.client('sql', text=False, stdin=process.PIPE, 
stdout=process.PIPE, stderr=process.PIPE) as c:
 out, err = c.communicate(INPUT5)
 retcode = c.returncode
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Print errors obtained

2020-12-18 Thread Pedro Ferreira
Changeset: 24d0cfa5d8e0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=24d0cfa5d8e0
Modified Files:
sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
Branch: default
Log Message:

Print errors obtained


diffs (45 lines):

diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py 
b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
--- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
+++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py
@@ -19,7 +19,7 @@ with process.client('sql', text=False, s
 if retcode == 0:
 sys.stderr.write("Expected nonzero return code")
 if not err or b'Unexpected character (U+FEFF)' not in err:
-sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)'")
+sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)', instead got '%s'" % (err))
 
 # This line starts with the BOM followed by SELECT 1;\n
 INPUT2 = b"\xEF\xBB\xBF\x53\x45\x4C\x45\x43\x54\x20\x31\x3B\x0A"
@@ -30,7 +30,7 @@ with process.client('sql', text=False, s
 if retcode == 0:
 sys.stderr.write("Expected nonzero return code")
 if not err or b'Unexpected character (U+FEFF)' not in err:
-sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)'")
+sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)', instead got '%s'" % (err))
 if "[ 1\\t]" not in str(out):
 sys.stderr.write("The select 1; after the BOM character should have 
run and returned the result 1")
 
@@ -43,7 +43,7 @@ with process.client('sql', text=False, s
 if retcode == 0:
 sys.stderr.write("Expected nonzero return code")
 if not err or b'syntax error in' not in err:
-sys.stderr.write("Expected stderr to contain 'syntax error in'")
+sys.stderr.write("Expected stderr to contain 'syntax error in', 
instead got '%s'" % (err))
 
 # More than one BOM scattered over the entire statement
 INPUT4 = 
b"\x53\x45\xEF\xBB\xBF\x4C\x45\xEF\xBB\xBF\x43\x54\xEF\xBB\xBF\x20\x31\xEF\xBB\xBF\x3B\xEF\xBB\xBF\x0A"
@@ -54,7 +54,7 @@ with process.client('sql', text=False, s
 if retcode == 0:
 sys.stderr.write("Expected nonzero return code")
 if not err or b'Unexpected character (U+FEFF)' not in err:
-sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)'")
+sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)', instead got '%s'" % (err))
 
 # Using BOM as a SQL identifier
 INPUT5 = b"\x53\x45\x4C\x45\x43\x54\x20\x22\xEF\xBB\xBF\x22\x3B\x0A"
@@ -65,4 +65,4 @@ with process.client('sql', text=False, s
 if retcode == 0:
 sys.stderr.write("Expected nonzero return code")
 if not err or b'Unexpected character (U+FEFF)' not in err:
-sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)'")
+sys.stderr.write("Expected stderr to contain 'Unexpected character 
(U+FEFF)', instead got '%s'" % (err))
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - clean up

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

clean up


diffs (truncated from 370 to 300 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
@@ -3,13 +3,13 @@ role
 table
 table_privs
 unknown_user
+withGrantOption
+grantMonetdb
 createSetUp
-withGrantOption
 columnRights
 changePasswordUser
 renameUser
 changeSchemaUser
-grantMonetdb
 copyinto
 schemaRights
 metadataConsistency
diff --git a/sql/test/Users/Tests/grantMonetdb.SQL.py 
b/sql/test/Users/Tests/grantMonetdb.SQL.py
--- a/sql/test/Users/Tests/grantMonetdb.SQL.py
+++ b/sql/test/Users/Tests/grantMonetdb.SQL.py
@@ -1,42 +1,59 @@
 ###
-# Grant monetdb rights to a user.
-# Verify that the user can assume the monetdb role and CREATE new users, GRANT 
privileges and roles.
+# Grant sysadmin rights to a user.
+# Verify that the user can assume the sysadmin role and CREATE new users, 
GRANT privileges and roles.
 ###
 
 from MonetDBtesting.sqltest import SQLTestCase
 
-with SQLTestCase() as tc:
-tc.connect(username="monetdb", password="monetdb")
-tc.execute("GRANT sysadmin TO alice;").assertSucceeded()
-tc.connect(username="alice", password="alice")
-tc.execute("""
-SET ROLE sysadmin;
-CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;""").assertFailed(err_code='M0M27')
-tc.execute("GRANT ALL ON orders TO april;").assertSucceeded()
-tc.execute("GRANT sysadmin TO april;").assertFailed(err_code='0P000')
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
 
-# import os, sys
-# try:
-# from MonetDBtesting import process
-# except ImportError:
-# import process
+mdb.execute("CREATE SCHEMA library;").assertSucceeded()
 
-# 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()
-
-# sql_test_client('monetdb', 'monetdb', input="""\
-# GRANT sysadmin TO alice;
-# """)
+mdb.execute("CREATE USER alice WITH PASSWORD 'alice' name 'alice' schema 
library;").assertSucceeded()
+mdb.execute("CREATE USER april WITH PASSWORD 'april' name 'april' schema 
library;").assertSucceeded()
 
 
-# sql_test_client('alice', 'alice', input="""\
-# SET ROLE sysadmin;
-# CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA library;
-# GRANT ALL ON orders TO april;
-# GRANT sysadmin TO april;
-# """)
+mdb.execute("CREATE TABLE library.orders(price int, name 
VARCHAR(100));").assertSucceeded()
+
+with SQLTestCase() as tc:
+tc.connect(username="alice", password="alice")
+# alice is not a sysadmin yet
+tc.execute("SET ROLE sysadmin;").assertFailed(err_code='42000', 
err_message="Role (sysadmin) missing")
+tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='42M31', err_message="Insufficient privileges 
to create user 'may'")
+tc.execute("GRANT ALL ON library.orders TO 
april;").assertFailed(err_code='01007', err_message="GRANT: Grantor 'alice' is 
not allowed to grant privileges for table 'orders'")
+# give alice sysadmin rights
+mdb.execute("GRANT sysadmin TO alice;").assertSucceeded()
+tc.execute("SET ROLE sysadmin;").assertSucceeded()
+# FIXME: this query should probably not fail
+tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='M0M27', err_message="CREATE USER: access 
denied for user 'alice'")
+
+with SQLTestCase() as tc2:
+# check that april can only SEL/INS/UPD/DEL the table after the 
GRANT ALL
+tc2.connect(username="april", password="april")
+tc2.execute("INSERT INTO library.orders VALUES (12, 'abc'), (42, 
'def');").assertFailed(err_code='42000', err_message="INSERT INTO: insufficient 
privileges for user 'april' to insert into table 'orders'")
+tc2.execute("UPDATE library.orders SET price = price*2 WHERE price 
< 42;").assertFailed(err_code='42000', err_message="UPDATE: insufficient 
privileges for user 'april' to update table 'orders'")
+tc2.execute("DELETE FROM library.orders WHERE price = 
42;").assertFailed(err_code='42000', err_message="DELETE FROM: insufficient 
privileges for user 'april' to delete from table 'orde

MonetDB: Jun2020 - Optionally ignore existing hash table to buil...

2020-12-18 Thread Sjoerd Mullender
Changeset: c947c880211a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c947c880211a
Modified Files:
gdk/gdk_join.c
Branch: Jun2020
Log Message:

Optionally ignore existing hash table to build one with candidate list.
When deciding to do a hash join, and on which side to use the hash,
take one more option into account: even when there is a hash already,
it might still be cheaper to build a new one taking a candidate list
into account.


diffs (truncated from 451 to 300 lines):

diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2487,7 +2487,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;
@@ -2506,7 +2507,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
const char *v = (const char *) &lval;
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));
@@ -2542,7 +2542,23 @@ 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);
+   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 */
BAT *b = BBPdescriptor(VIEWtparent(r));
TRC_DEBUG(ALGO, "%s(%s): using "
@@ -2562,23 +2578,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);
-   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 */
TRC_DEBUG(ALGO, ALGOBATFMT ": creating hash%s\n",
@@ -3053,6 +3052,79 @@ guess_uniques(BAT *b, struct canditer *c
return B;
 }
 
+/* estimate the cost of doing a hashjoin with a hash on r; return value
+ * is the estimated cost, the last three arguments receive some extra
+ * information */
+static double
+joincost(BAT *r, struct canditer *lci, struct canditer *rci,
+bool *hash, bool *phash, bool *cand)
+{
+   bool rhash = BATcheckhash(r);
+   bool prhash = false;
+   bool rcand = false;
+   double rcost = 1;
+   bat parent;
+   BAT *b;
+
+   if (rci->noids > 0) {
+   /* if we need to do binary search on candidate
+* list, take that into account */
+   rcost += log2((double) rci->noids);
+   }
+   rcost *= lci->ncand;
+   if (rhash) {
+   /* average chain length */
+   rcost *= (double) BATcount(r) / r->thash->nheads;
+   } else if ((parent = VIEWtparent(r)) != 0 &&
+  (b = BBPdescriptor(parent)) != NULL &&
+  BATcheckhash(b)) {
+   rhash = prhash = true;
+   /* average chain length */
+   rcost *= (double) BATcount(b) / b->th

MonetDB: Oct2020 - Merge with Jun2020 branch.

2020-12-18 Thread Sjoerd Mullender
Changeset: 20d5ae056058 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=20d5ae056058
Modified Files:
gdk/gdk_join.c
Branch: Oct2020
Log Message:

Merge with Jun2020 branch.


diffs (truncated from 453 to 300 lines):

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 *) &lval;
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 
(swapped)" : "hashjoin using new hash");
@@ -3071,6 +3070,79 @@ guess_uniques(BAT *b, struct canditer *c
return B;
 }
 
+/* estimate the cost of doing a hashjoin with a hash on r; return value
+ * is the estimated cost, the last three arguments receive some extra
+ * information */
+static double
+joincost(BAT *r, struct canditer *lci, struct canditer *rci,
+bool *hash, bool *phash, bool *cand)
+{
+   bool rhash = BATcheckhash(r);
+   bool prhash = false;
+   bool rcand = false;
+   double rcost = 1;
+   bat parent;
+   BAT *b;
+
+   if (rci->noids > 0) {
+   /* if we need to do binary search on candidate
+* list, take that into account */
+   rcost += log2((double) rci->noids);
+   }
+   rcost *= lci->ncand;
+   if (rhash) {
+   /* average chain length */
+   rcost *= (double) BATcount(r) / r->thash->nheads;
+   } else if ((parent = VIEWtparent(r)) != 0 &&
+  (b = BBPdescriptor(parent)) != NULL &&
+  BATcheckhash(b)) {
+   rhash 

MonetDB: unlock - optimize some more deletes handling

2020-12-18 Thread Niels Nes
Changeset: 38a40db4507d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38a40db4507d
Modified Files:
gdk/gdk_cand.c
gdk/gdk_cand.h
sql/backends/monet5/sql.c
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
sql/storage/bat/bat_table.c
Branch: unlock
Log Message:

optimize some more deletes handling


diffs (281 lines):

diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -1298,7 +1298,7 @@ BATnegcands(BUN nr, BAT *odels)
 }
 
 BAT *
-BATmaskedcands(oid hseq, BAT *masked, bool selected)
+BATmaskedcands(oid hseq, BUN nr, BAT *masked, bool selected)
 {
const char *nme;
Heap *msks;
@@ -1326,7 +1326,7 @@ BATmaskedcands(oid hseq, BAT *masked, bo
strconcat_len(msks->filename, sizeof(msks->filename),
  nme, ".theap", NULL);
 
-   nmask = (BATcount(masked) + 31) / 32;
+   nmask = (nr + 31) / 32;
if (HEAPalloc(msks, nmask + (sizeof(ccand_t)/sizeof(uint32_t)), 
sizeof(uint32_t), 0) != GDK_SUCCEED) {
GDKfree(msks);
BBPreclaim(bn);
@@ -1344,11 +1344,24 @@ BATmaskedcands(oid hseq, BAT *masked, bo
memcpy(r, Tloc(masked, 0), nmask * sizeof(uint32_t));
} else {
const uint32_t *s = (const uint32_t *) Tloc(masked, 0);
-   for (BUN i = 0; i < nmask; i++)
+   BUN nmask_ = (BATcount(masked) + 31)/32;
+   for (BUN i = 0; i < nmask_; i++)
r[i] = ~s[i];
}
+   if (nr > BATcount(masked)) {
+   BUN rest = BATcount(masked)&31, nmask_ = 
(BATcount(masked)+31)/32, nrest = nr;
+   int v = 0;
+   if (nmask_ > nmask)
+   nrest = 32-rest;
+
+   for (BUN j = rest; j < nrest; j++)
+   v |= 1U< 0)
r[nmask - 1] &= (1U << cnt) - 1;
cnt = 0;
diff --git a/gdk/gdk_cand.h b/gdk/gdk_cand.h
--- a/gdk/gdk_cand.h
+++ b/gdk/gdk_cand.h
@@ -202,7 +202,7 @@ gdk_export BAT *canditer_sliceval(struct
 gdk_export BAT *canditer_slice2(struct canditer *ci, BUN lo1, BUN hi1, BUN 
lo2, BUN hi2);
 gdk_export BAT *canditer_slice2val(struct canditer *ci, oid lo1, oid hi1, oid 
lo2, oid hi2);
 gdk_export BAT *BATnegcands(BUN nr, BAT *odels);
-gdk_export BAT *BATmaskedcands(oid hseq, BAT *masked, bool selected);
+gdk_export BAT *BATmaskedcands(oid hseq, BUN nr, BAT *masked, bool selected);
 gdk_export BAT *BATunmask(BAT *b);
 
 gdk_export BAT *BATmergecand(BAT *a, BAT *b);
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2309,7 +2309,7 @@ SQLtid(Client cntxt, MalBlkPtr mb, MalSt
}
/* true == deleted, need not deleted  */
if (bn) {
-   tids = BATmaskedcands(sb, bn, false);
+   tids = BATmaskedcands(sb, nr, bn, false);
BBPunfix(bn->batCacheid);
if (tids == NULL) {
throw(MAL, "sql.tids", SQLSTATE(45003) 
"TIDdeletes failed");
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
@@ -184,10 +184,11 @@ cs_real_update_bats( column_storage *cs,
 static size_t
 count_deletes(storage *d)
 {
-   /* needs to be optimized */
+   if (d->cached_cnt)
+   return d->cnt+d->ucnt;
+
+   lng cnt = 0;
BAT *b = temp_descriptor(d->cs.bid);
-   lng cnt = 0;
-
if (!d->cs.ucnt) {
if (BATsum(&cnt, TYPE_lng, b, NULL, true, false, false) != 
GDK_SUCCEED) {
bat_destroy(b);
@@ -218,7 +219,9 @@ count_deletes(storage *d)
}
bat_destroy(c);
}
-   return (size_t) cnt;
+   d->cached_cnt = 1;
+   d->cnt = (size_t)cnt;
+   return d->cnt;
 }
 
 static size_t
@@ -765,6 +768,9 @@ dup_dbat(storage *obat, storage *bat, in
MT_lock_unset(&segs_lock);
assert(bat->end <= bat->segs->end);
}
+   bat->cached_cnt = obat->cached_cnt;
+   bat->cnt = obat->cnt + obat->ucnt;
+   bat->ucnt = 0;
return dup_cs(&obat->cs, &bat->cs, TYPE_msk, is_new, temp);
 }
 
@@ -838,6 +844,7 @@ delta_delete_bat( storage *bat, BAT *i, 
 
if (i->ttype == TYPE_msk || mask_cand(i))
i = BATunmask(i);
+   bat->ucnt+=BATcount(i);
t = BATconstant(i->hseqbase, TYPE_msk, &T, BATcount(i), TRANSIENT);
int ok = LOG_OK;
 
@@ -855,6 +862,7 @@ delta_delete_val( storage *bat, oid rid,
 {
/* update pos */
msk T = TRUE;
+   bat->ucnt++;
return cs_update_val(&bat->cs, rid, &T, is_new);
 }
 
@@ -1011,8 +1019,8 @@ claim_tab(sql_trans *tr, sql_table *t, s
 
assert(isNew(t) || isTempTable(t) || s->cs.cleared || BATcount(b) =

MonetDB: unlock - merged with default

2020-12-18 Thread Niels Nes
Changeset: 88c6c926a8df for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=88c6c926a8df
Modified Files:
gdk/gdk_logger.c
gdk/gdk_project.c
monetdb5/mal/Tests/All
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_upgrades.c
sql/include/sql_catalog.h
sql/server/sql_parser.y
sql/storage/store.c
sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out

sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out
sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.test
sql/test/BugTracker-2017/Tests/caching_stats_bug.6374.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.test
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/mergetables/Tests/mergequery.stable.out
sql/test/mergetables/Tests/part-elim.stable.out
sql/test/miscellaneous/Tests/groupby_error.stable.out
sql/test/miscellaneous/Tests/groupby_error.test
sql/test/miscellaneous/Tests/groupby_prepare.stable.out
Branch: unlock
Log Message:

merged with default


diffs (truncated from 42545 to 300 lines):

diff --git a/clients/Tests/mclient-uri.SQL.bat 
b/clients/Tests/mclient-uri.SQL.bat
deleted file mode 100755
--- a/clients/Tests/mclient-uri.SQL.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@prompt # $t $g  
-@echo on
-
-@rem Windows doesn't do UNIX domain sockets, so only the one test here.
-
-mclient -d 
"mapi:monetdb://%HOST%:%MAPIPORT%/%TSTDB%?language=sql&user=monetdb" -f test -t 
none -E utf-8 -s "select 1"
diff --git a/clients/Tests/mclient-uri.SQL.py b/clients/Tests/mclient-uri.SQL.py
new file mode 100644
--- /dev/null
+++ b/clients/Tests/mclient-uri.SQL.py
@@ -0,0 +1,19 @@
+import os, sys
+from MonetDBtesting import process
+
+with process.client('sql', 
dbname='mapi:monetdb://{}:{}/{}?language=sql&user=monetdb'.format(os.getenv('HOST',
 'localhost'), os.getenv('MAPIPORT', 5), os.getenv('TSTDB', 'demo')), 
host='', port='', format='csv', echo=False, stdin=process.PIPE, 
stdout=process.PIPE, stderr=process.PIPE) as c:
+out, err = c.communicate('select 1;\n')
+
+if out != '1\n':
+print(out)
+if err:
+print(err, file=sys.stderr)
+
+if os.name != 'nt':
+with process.client('sql', 
dbname='mapi:monetdb://{}/.s.monetdb.{}?database={}&language=sql&user=monetdb'.format(os.getenv('MAPIHOST',
 '/tmp'), os.getenv('MAPIPORT', 5), os.getenv('TSTDB', 'demo')), host='', 
port='', format='csv', echo=False, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as c:
+out, err = c.communicate('select 1;\n')
+
+if out != '1\n':
+print(out)
+if err:
+print(err, file=sys.stderr)
diff --git a/clients/Tests/mclient-uri.SQL.sh b/clients/Tests/mclient-uri.SQL.sh
deleted file mode 100755
--- a/clients/Tests/mclient-uri.SQL.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# test the URI parsing capabilities of the MAPI library
-
-mclient -d "mapi:monetdb://$HOST:$MAPIPORT/$TSTDB?language=sql&user=monetdb" 
-f csv -t none -E utf-8 -s 'select 1' | grep -v '^1$'
-if [ $? -eq 2 ]; then
-   return 2;
-fi
-
-mclient -d 
"mapi:monetdb://$MAPIHOST/.s.monetdb.$MAPIPORT?database=$TSTDB&language=sql&user=monetdb"
 -f csv -t none -E utf-8 -s 'select 1' | grep -v '^1$'
-if [ $? -eq 2 ]; then
-   return 2;
-fi
diff --git a/clients/Tests/mclient-uri.stable.err 
b/clients/Tests/mclient-uri.stable.err
deleted file mode 100644
--- a/clients/Tests/mclient-uri.stable.err
+++ /dev/null
@@ -1,44 +0,0 @@
-stderr of test 'mclient-uri` in directory 'clients` itself:
-
-
-# 10:30:50 >  
-# 10:30:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=36840" "--set" 
"mapi_usock=/var/tmp/mtest-2769/.s.monetdb.36840" "--set" "monet_prompt=" 
"--forcemito" "--dbpath=/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_clients"
-# 10:30:50 >  
-
-# builtin opt  gdk_dbpath = /ufs/sjoerd/@Monet-stable/var/monetdb5/dbfarm/demo
-# builtin opt  gdk_debug = 0
-# builtin opt  gdk_vmtrim = no
-# builtin opt  monet_prompt = >
-# builtin opt  monet_daemon = no
-# builtin opt  mapi_port = 5
-# builtin opt  mapi_open = false
-# builtin opt  mapi_autosense = false
-# builtin opt  sql_optimizer = default_pipe
-# builtin opt  sql_debug = 0
-# cmdline opt  gdk_nr_threads = 0
-# cmdline opt  mapi_open = true
-# cmdline opt  mapi_port = 36840
-# cmdline opt  mapi_usock = /var/tmp/mtest-2769/.s.monetdb.36840
-# cmdline opt  monet_prompt = 
-# cmdline opt  gdk_dbpath = 
/ufs/sjoerd/@Monet-stable/var/MonetDB/mTests_clients
-# cmdline opt  gdk_debug = 536870922
-
-# 10:30:51 >  
-# 10:30:51 >  "./mclient-uri.SQL.sh" "mclient-uri"
-# 10:30:51 >  
-
-
-# 10:30:51 >  
-# 10:30:51 >  mclient -d 
mapi:monetdb://madrid:36840/mTe

MonetDB: unlock - fix compile

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

fix compile


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
@@ -1337,7 +1337,7 @@ bm_subcommit(logger *lg)
logbat_destroy(lb);
return GDK_FAIL;
}
-   assert(BBP_lrefs(bid) == lb->batSharecnt + 1 && 
BBP_refs(bid) <= lb->batSharecnt);
+   //assert(BBP_lrefs(bid) == lb->batSharecnt + 1 && 
BBP_refs(bid) <= lb->batSharecnt);
logbat_destroy(lb);
}
/* only project out the deleted with last id > lg->saved_tid
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - merged

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

merged


diffs (truncated from 370 to 300 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
@@ -3,13 +3,13 @@ role
 table
 table_privs
 unknown_user
+withGrantOption
+grantMonetdb
 createSetUp
-withGrantOption
 columnRights
 changePasswordUser
 renameUser
 changeSchemaUser
-grantMonetdb
 copyinto
 schemaRights
 metadataConsistency
diff --git a/sql/test/Users/Tests/grantMonetdb.SQL.py 
b/sql/test/Users/Tests/grantMonetdb.SQL.py
--- a/sql/test/Users/Tests/grantMonetdb.SQL.py
+++ b/sql/test/Users/Tests/grantMonetdb.SQL.py
@@ -1,42 +1,59 @@
 ###
-# Grant monetdb rights to a user.
-# Verify that the user can assume the monetdb role and CREATE new users, GRANT 
privileges and roles.
+# Grant sysadmin rights to a user.
+# Verify that the user can assume the sysadmin role and CREATE new users, 
GRANT privileges and roles.
 ###
 
 from MonetDBtesting.sqltest import SQLTestCase
 
-with SQLTestCase() as tc:
-tc.connect(username="monetdb", password="monetdb")
-tc.execute("GRANT sysadmin TO alice;").assertSucceeded()
-tc.connect(username="alice", password="alice")
-tc.execute("""
-SET ROLE sysadmin;
-CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;""").assertFailed(err_code='M0M27')
-tc.execute("GRANT ALL ON orders TO april;").assertSucceeded()
-tc.execute("GRANT sysadmin TO april;").assertFailed(err_code='0P000')
+with SQLTestCase() as mdb:
+mdb.connect(username="monetdb", password="monetdb")
 
-# import os, sys
-# try:
-# from MonetDBtesting import process
-# except ImportError:
-# import process
+mdb.execute("CREATE SCHEMA library;").assertSucceeded()
 
-# 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()
-
-# sql_test_client('monetdb', 'monetdb', input="""\
-# GRANT sysadmin TO alice;
-# """)
+mdb.execute("CREATE USER alice WITH PASSWORD 'alice' name 'alice' schema 
library;").assertSucceeded()
+mdb.execute("CREATE USER april WITH PASSWORD 'april' name 'april' schema 
library;").assertSucceeded()
 
 
-# sql_test_client('alice', 'alice', input="""\
-# SET ROLE sysadmin;
-# CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA library;
-# GRANT ALL ON orders TO april;
-# GRANT sysadmin TO april;
-# """)
+mdb.execute("CREATE TABLE library.orders(price int, name 
VARCHAR(100));").assertSucceeded()
+
+with SQLTestCase() as tc:
+tc.connect(username="alice", password="alice")
+# alice is not a sysadmin yet
+tc.execute("SET ROLE sysadmin;").assertFailed(err_code='42000', 
err_message="Role (sysadmin) missing")
+tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='42M31', err_message="Insufficient privileges 
to create user 'may'")
+tc.execute("GRANT ALL ON library.orders TO 
april;").assertFailed(err_code='01007', err_message="GRANT: Grantor 'alice' is 
not allowed to grant privileges for table 'orders'")
+# give alice sysadmin rights
+mdb.execute("GRANT sysadmin TO alice;").assertSucceeded()
+tc.execute("SET ROLE sysadmin;").assertSucceeded()
+# FIXME: this query should probably not fail
+tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='M0M27', err_message="CREATE USER: access 
denied for user 'alice'")
+
+with SQLTestCase() as tc2:
+# check that april can only SEL/INS/UPD/DEL the table after the 
GRANT ALL
+tc2.connect(username="april", password="april")
+tc2.execute("INSERT INTO library.orders VALUES (12, 'abc'), (42, 
'def');").assertFailed(err_code='42000', err_message="INSERT INTO: insufficient 
privileges for user 'april' to insert into table 'orders'")
+tc2.execute("UPDATE library.orders SET price = price*2 WHERE price 
< 42;").assertFailed(err_code='42000', err_message="UPDATE: insufficient 
privileges for user 'april' to update table 'orders'")
+tc2.execute("DELETE FROM library.orders WHERE price = 
42;").assertFailed(err_code='42000', err_message="DELETE FROM: insufficient 
privileges for user 'april' to delete from table 'orders'")
+tc2.execute("SELECT * FROM 
library.orders;").assertFailed(err_code='42000', err_message="SELECT: access 
denied for april to table 'library.orders'")
 
+tc.execute("GRANT ALL ON library.orders TO 
april;").assertSucceeded()
 
+tc2.execute("INSERT INTO library.orders VALUES (12, 'abc'), (42, 
'def');").assertRowCount(2)
+tc2.exec

MonetDB: default - Only the 'monetdb' user in its 'sysadmin' rol...

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

Only the 'monetdb' user in its 'sysadmin' role can create a user, see also 
Issue #7034
Updated test description and query accordingly


diffs (28 lines):

diff --git a/sql/test/Users/Tests/grantMonetdb.SQL.py 
b/sql/test/Users/Tests/grantMonetdb.SQL.py
--- a/sql/test/Users/Tests/grantMonetdb.SQL.py
+++ b/sql/test/Users/Tests/grantMonetdb.SQL.py
@@ -1,6 +1,8 @@
 ###
 # Grant sysadmin rights to a user.
-# Verify that the user can assume the sysadmin role and CREATE new users, 
GRANT privileges and roles.
+# Verify that the user can assume the sysadmin role and GRANT privileges and
+#   roles, but cannot CREATE new users since only 'monetdb' in its 'sysadmin'
+#   role can
 ###
 
 from MonetDBtesting.sqltest import SQLTestCase
@@ -20,12 +22,12 @@ with SQLTestCase() as mdb:
 tc.connect(username="alice", password="alice")
 # alice is not a sysadmin yet
 tc.execute("SET ROLE sysadmin;").assertFailed(err_code='42000', 
err_message="Role (sysadmin) missing")
-tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='42M31', err_message="Insufficient privileges 
to create user 'may'")
 tc.execute("GRANT ALL ON library.orders TO 
april;").assertFailed(err_code='01007', err_message="GRANT: Grantor 'alice' is 
not allowed to grant privileges for table 'orders'")
 # give alice sysadmin rights
 mdb.execute("GRANT sysadmin TO alice;").assertSucceeded()
 tc.execute("SET ROLE sysadmin;").assertSucceeded()
-# FIXME: this query should probably not fail
+
+# but alice cannot create another user
 tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='M0M27', err_message="CREATE USER: access 
denied for user 'alice'")
 
 with SQLTestCase() as tc2:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Add TODO.

2020-12-18 Thread Aris Koning
Changeset: 42d74df857c8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=42d74df857c8
Modified Files:
sql/common/sql_types.c
Branch: default
Log Message:

Add TODO.


diffs (11 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1224,6 +1224,7 @@ sqltypeinit( sql_allocator *sa)
/* the geom module is loaded */
GEOM = *t++ = sql_create_type(sa, "GEOMETRY", 0, SCALE_NONE, 0, 
EC_GEOM, "wkb");
/*POINT =*/ //*t++ = sql_create_type(sa, "POINT", 0, SCALE_FIX, 
0, EC_GEOM, "wkb");
+   // TODO: The GEOMETRYA  and MBR types should actually also be 
part of EC_GEOM. However this requires more (bat)calc. functions.
*t++ = sql_create_type(sa, "GEOMETRYA", 0, SCALE_NONE, 0, 
EC_EXTERNAL, "wkba");
 
MBR = *t++ = sql_create_type(sa, "MBR", 0, SCALE_NONE, 0, 
EC_EXTERNAL, "mbr");
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Backed out changeset 7b153446a92a

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

Backed out changeset 7b153446a92a


diffs (28 lines):

diff --git a/sql/test/Users/Tests/grantMonetdb.SQL.py 
b/sql/test/Users/Tests/grantMonetdb.SQL.py
--- a/sql/test/Users/Tests/grantMonetdb.SQL.py
+++ b/sql/test/Users/Tests/grantMonetdb.SQL.py
@@ -1,8 +1,6 @@
 ###
 # Grant sysadmin rights to a user.
-# Verify that the user can assume the sysadmin role and GRANT privileges and
-#   roles, but cannot CREATE new users since only 'monetdb' in its 'sysadmin'
-#   role can
+# Verify that the user can assume the sysadmin role and CREATE new users, 
GRANT privileges and roles.
 ###
 
 from MonetDBtesting.sqltest import SQLTestCase
@@ -22,12 +20,12 @@ with SQLTestCase() as mdb:
 tc.connect(username="alice", password="alice")
 # alice is not a sysadmin yet
 tc.execute("SET ROLE sysadmin;").assertFailed(err_code='42000', 
err_message="Role (sysadmin) missing")
+tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='42M31', err_message="Insufficient privileges 
to create user 'may'")
 tc.execute("GRANT ALL ON library.orders TO 
april;").assertFailed(err_code='01007', err_message="GRANT: Grantor 'alice' is 
not allowed to grant privileges for table 'orders'")
 # give alice sysadmin rights
 mdb.execute("GRANT sysadmin TO alice;").assertSucceeded()
 tc.execute("SET ROLE sysadmin;").assertSucceeded()
-
-# but alice cannot create another user
+# FIXME: this query should probably not fail
 tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='M0M27', err_message="CREATE USER: access 
denied for user 'alice'")
 
 with SQLTestCase() as tc2:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Fixed query output: a user who has assumed th...

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

Fixed query output: a user who has assumed the `sysadmin` role should be able
to create and drop another user

This query currently fails, and is reported in issue #7034


diffs (14 lines):

diff --git a/sql/test/Users/Tests/grantMonetdb.SQL.py 
b/sql/test/Users/Tests/grantMonetdb.SQL.py
--- a/sql/test/Users/Tests/grantMonetdb.SQL.py
+++ b/sql/test/Users/Tests/grantMonetdb.SQL.py
@@ -25,8 +25,8 @@ with SQLTestCase() as mdb:
 # give alice sysadmin rights
 mdb.execute("GRANT sysadmin TO alice;").assertSucceeded()
 tc.execute("SET ROLE sysadmin;").assertSucceeded()
-# FIXME: this query should probably not fail
-tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertFailed(err_code='M0M27', err_message="CREATE USER: access 
denied for user 'alice'")
+tc.execute("CREATE USER may WITH PASSWORD 'may' NAME 'May' SCHEMA 
library;").assertSucceeded()
+tc.execute("DROP USER may;").assertSucceeded()
 
 with SQLTestCase() as tc2:
 # check that april can only SEL/INS/UPD/DEL the table after the 
GRANT ALL
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: monetdbe-proxy - Dump user defined types;

2020-12-18 Thread Aris Koning
Changeset: 888b1101578a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=888b1101578a
Modified Files:
dump.sql
dump_output.sql
sql/scripts/52_describe.sql
sql/scripts/53_dump.sql
Branch: monetdbe-proxy
Log Message:

Dump user defined types;


diffs (70 lines):

diff --git a/dump.sql b/dump.sql
--- a/dump.sql
+++ b/dump.sql
@@ -43,6 +43,8 @@ BEGIN
 FROM sys.schemas s, sys.auths a
 WHERE s.authorization = a.id AND s.system = FALSE;
 
+   INSERT INTO dump_statements(s) SELECT * FROM 
sys.dump_user_defined_types();
+
 INSERT INTO dump_statements(s) --dump_add_schemas_to_users
SELECT
 'ALTER USER ' || sys.dq(ui.name) || ' SET SCHEMA ' || 
sys.dq(s.name) || ';'
@@ -85,11 +87,10 @@ BEGIN
INSERT INTO dump_statements(s) VALUES ('TRUNCATE sys.privileges;');
INSERT INTO dump_statements(s) SELECT * FROM sys.dump_privileges();
 
-   --TODO User Defined Types? sys.types
-   --TODO loaders ,procedures, window and filter sys.functions.
--TODO dumping table data
+   --TODO ALTER SEQUENCE using RESTART WITH after importing table_data.
+   --TODO loaders ,procedures, window and filter sys.functions.
--TODO look into order dependent group_concat
-   --TODO ALTER SEQUENCE using RESTART WITH after importing table_data.
--TODO ADD upgrade code 
 
 INSERT INTO dump_statements(s) VALUES ('COMMIT;');
diff --git a/dump_output.sql b/dump_output.sql
--- a/dump_output.sql
+++ b/dump_output.sql
@@ -5,6 +5,8 @@ CREATE USER "voc" WITH ENCRYPTED PASSWOR
 CREATE USER "voc2" WITH ENCRYPTED PASSWORD  
'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e'
  NAME  'VOC Explorer'  SCHEMA sys;
 CREATE SCHEMA "sbar" AUTHORIZATION monetdb;
 CREATE SCHEMA "sfoo" AUTHORIZATION monetdb;
+CREATE TYPE "sfoo"."json" EXTERNAL NAME "json";
+CREATE TYPE "sys"."t1" EXTERNAL NAME "json";
 ALTER USER "voc" SET SCHEMA "sfoo";
 CREATE SEQUENCE "sys"."seq1" AS BIGINT  START WITH 5 INCREMENT BY 3 MINVALUE 4 
MAXVALUE 10 CACHE 2 CYCLE;
 CREATE SEQUENCE "sys"."seq2" AS BIGINT  START WITH 4 INCREMENT BY 3 MINVALUE 4 
MAXVALUE 10 CACHE 2 CYCLE;
diff --git a/sql/scripts/52_describe.sql b/sql/scripts/52_describe.sql
--- a/sql/scripts/52_describe.sql
+++ b/sql/scripts/52_describe.sql
@@ -439,6 +439,12 @@ BEGIN
AND t.type = tt.table_type_id;
 END;
 
+CREATE FUNCTION sys.describe_user_defined_types() RETURNS TABLE(sch STRING, 
sql_tpe STRING, ext_tpe STRING)  BEGIN
+   RETURN
+   SELECT s.name, t.sqlname, t.systemname FROM sys.types t JOIN 
sys.schemas s ON t.schema_id = s.id
+   WHERE t.eclass = 18 AND ((s.name = 'sys' and t.sqlname not in 
('geometrya', 'mbr', 'url', 'inet', 'json', 'uuid', 'xml')) OR (s.name <> 
'sys'));
+END;
+
 CREATE FUNCTION describe_partition_tables()
 RETURNS TABLE(
m_sname STRING,
diff --git a/sql/scripts/53_dump.sql b/sql/scripts/53_dump.sql
--- a/sql/scripts/53_dump.sql
+++ b/sql/scripts/53_dump.sql
@@ -88,6 +88,12 @@ RETURN
SELECT 'COMMENT ON ' || c.tpe || ' ' || c.fqn || ' IS ' || SQ(c.rem) || 
';' FROM describe_comments() c;
 END;
 
+--CREATE FUNCTION sys.describe_user_defined_types() RETURNS TABLE(sch STRING, 
sql_tpe STRING, ext_tpe STRING)  BEGIN
+CREATE FUNCTION sys.dump_user_defined_types() RETURNS TABLE(stmt STRING)  BEGIN
+   RETURN
+   SELECT 'CREATE TYPE ' || FQN(sch, sql_tpe) || ' EXTERNAL NAME ' 
|| DQ(ext_tpe) || ';' FROM sys.describe_user_defined_types();
+END;
+
 CREATE FUNCTION dump_privileges() RETURNS TABLE (stmt STRING) BEGIN
 RETURN
SELECT
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: monetdbe-proxy - Update TODO's.

2020-12-18 Thread Aris Koning
Changeset: 12508066820c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=12508066820c
Modified Files:
dump.sql
Branch: monetdbe-proxy
Log Message:

Update TODO's.


diffs (18 lines):

diff --git a/dump.sql b/dump.sql
--- a/dump.sql
+++ b/dump.sql
@@ -85,12 +85,12 @@ BEGIN
INSERT INTO dump_statements(s) VALUES ('TRUNCATE sys.privileges;');
INSERT INTO dump_statements(s) SELECT * FROM sys.dump_privileges();
 
-   --check REFERENCES privilege
--TODO User Defined Types? sys.types
--TODO loaders ,procedures, window and filter sys.functions.
--TODO dumping table data
-   --look into order dependent group_concat
+   --TODO look into order dependent group_concat
--TODO ALTER SEQUENCE using RESTART WITH after importing table_data.
+   --TODO ADD upgrade code 
 
 INSERT INTO dump_statements(s) VALUES ('COMMIT;');
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - make sure claimed (but roled back) rows are no...

2020-12-18 Thread Niels Nes
Changeset: 3d75c6741eec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d75c6741eec
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_select.c
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out
Branch: unlock
Log Message:

make sure claimed (but roled back) rows are not kept.


diffs (154 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -156,7 +156,7 @@ gdk_return BATjoin(BAT **r1p, BAT **r2p,
 gdk_return BATkey(BAT *b, bool onoff);
 bool BATkeyed(BAT *b);
 gdk_return BATleftjoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, 
bool nil_matches, BUN estimate) __attribute__((__warn_unused_result__));
-BAT *BATmaskedcands(oid hseq, BAT *masked, bool selected);
+BAT *BATmaskedcands(oid hseq, BUN nr, BAT *masked, bool selected);
 void *BATmax(BAT *b, void *aggr);
 void *BATmax_skipnil(BAT *b, void *aggr, bit skipnil);
 BAT *BATmergecand(BAT *a, BAT *b);
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -32,6 +32,12 @@ BAT *
 virtualize(BAT *bn)
 {
/* input must be a valid candidate list or NULL */
+   if(bn && ((bn->ttype != TYPE_void && bn->ttype != TYPE_oid) || 
!bn->tkey || !bn->tsorted)) {
+   fprintf(stderr, "#bn type %d nil %d key %d sorted %d\n",
+   bn->ttype, is_oid_nil(bn->tseqbase),
+   bn->tkey, bn->tsorted);
+   fflush(stderr);
+   }
assert(bn == NULL ||
   (((bn->ttype == TYPE_void && !is_oid_nil(bn->tseqbase)) ||
 bn->ttype == TYPE_oid) &&
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
@@ -771,6 +771,7 @@ dup_dbat(storage *obat, storage *bat, in
bat->cached_cnt = obat->cached_cnt;
bat->cnt = obat->cnt + obat->ucnt;
bat->ucnt = 0;
+   bat->icnt = 0;
return dup_cs(&obat->cs, &bat->cs, TYPE_msk, is_new, temp);
 }
 
@@ -1070,13 +1071,16 @@ claim_tab(sql_trans *tr, sql_table *t, s
}
 #endif
s->cs.ucnt += cnt;
+   s->icnt += cnt;
}
 
assert(isNew(t) || isTempTable(t) || s->cs.cleared || BATcount(b) == 
slot);
if (isNew(t) || isTempTable(t) || s->cs.cleared)
deleted = FALSE;
-   else /* persistent central copy needs space marked deleted (such that 
other transactions don't see these rows) */
+   else { /* persistent central copy needs space marked deleted (such that 
other transactions don't see these rows) */
deleted = TRUE;
+   ps->cnt += cnt;
+   }
/* TODO first up to 32 boundary, then int writes */
for(lng i=0; i<(lng)cnt; i++) {
if (BUNappend(b, &deleted, true) != GDK_SUCCEED) {
@@ -1393,7 +1397,7 @@ create_del(sql_trans *tr, sql_table *t)
assert(!bat->segs && !bat->end);
bat->segs = new_segments(0);
bat->end = 0;
-   bat->cnt = bat->ucnt = 0;
+   bat->cnt = bat->ucnt = bat->icnt = 0;
bat->cached_cnt = 1;
 
b = bat_new(TYPE_msk, t->sz, PERSISTENT);
@@ -1720,7 +1724,7 @@ clear_del(sql_trans *tr, sql_table *t)
destroy_segments(s->segs);
s->segs = new_segments(0);
s->end = 0;
-   s->cnt = s->ucnt = 0;
+   s->cnt = s->ucnt = s->icnt = 0;
 }
 
 static BUN
@@ -1960,30 +1964,8 @@ tr_merge_delta( sql_trans *tr, sql_delta
 }
 
 static int
-cs_grow( column_storage *cs, BUN nr)
-{
-   if (cs->bid) {
-   BAT *cur = temp_descriptor(cs->bid);
-   if (!cur)
-   return LOG_ERR;
-   if (BATcount(cur) < nr) {
-   msk deleted = 0;
-   /* todo faster inserts */
-   for(BUN i = BATcount(cur); ics.cleared) {
destroy_segments(ts->segs);
MT_lock_set(&segs_lock);
@@ -1993,12 +1975,12 @@ tr_update_dbat( sql_trans *tr, storage *
assert(ts->segs->head);
ts->cnt = 0;
ts->ucnt = 0;
+   ts->icnt = 0;
} else {
assert(ts->segs == fs->segs);
/* merge segments or cleanup ? */
segment *segs = ts->segs->head, *seg = segs;
for (; segs; segs = segs->next) {
-   grow |= (segs->owner == tr);
if (segs->owner == tr || !segs->owner) {
/* merge range */
segs->owner = NULL;
@@ -2018,9 +2000,7 @@ tr_update_dbat( sql_trans *tr, storage *
ts->end = ts->segs->end;

MonetDB: default - Clean up and extended tests

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

Clean up and extended tests

The last two UPDATE queries currently fail, for more information see
https://github.com/MonetDB/MonetDB/issues/7035


diffs (83 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
@@ -5,8 +5,8 @@ table_privs
 unknown_user
 withGrantOption
 grantMonetdb
+columnRights
 createSetUp
-columnRights
 changePasswordUser
 renameUser
 changeSchemaUser
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
@@ -1,6 +1,6 @@
 ###
 # Grant SELECT and UPDATE to a user on two different columns.
-# Verify the user can SELECT and UPDATE on the column he has permissions for.
+# Verify the user can SELECT and UPDATE on the column it has permissions for.
 # Verify that the user cannot SELECT nor UPDATE on the column it did not get 
permissions for.
 ###
 
@@ -8,39 +8,28 @@ from MonetDBtesting.sqltest import SQLTe
 
 with SQLTestCase() as tc:
 tc.connect(username="monetdb", password="monetdb")
+
+tc.execute("CREATE SCHEMA library;").assertSucceeded()
+tc.execute("CREATE TABLE library.orders(price int, name 
VARCHAR(100));").assertSucceeded()
+tc.execute("INSERT INTO library.orders VALUES (12, 'abc'), (42, 
'def');").assertRowCount(2)
+
+tc.execute("CREATE USER alice WITH PASSWORD 'alice' name 'alice' schema 
library;").assertSucceeded()
 tc.execute("GRANT SELECT (price) ON library.orders TO 
alice;").assertSucceeded()
 tc.execute("GRANT UPDATE (name)  ON library.orders TO 
alice;").assertSucceeded()
 
 tc.connect(username="alice", password="alice")
-tc.execute("SELECT price FROM 
library.orders;").assertSucceeded().assertRowCount(0).assertDataResultMatch([])
-tc.execute("UPDATE library.orders SET name = 'book title goes 
here';").assertSucceeded().assertRowCount(0)
-tc.execute("SELECT name FROM library.orders; --insufficient 
rights").assertFailed(err_message="SELECT: identifier 'name' unknown")
-tc.execute("UPDATE orders SET price = 0; --insufficient 
rights").assertFailed(err_message="UPDATE: insufficient privileges for user 
'alice' to update table 'orders' on column 'price'")
-
-# import os, sys
-# try:
-# from MonetDBtesting import process
-# except ImportError:
-# import process
+# alice can select price but no name, and it cannot update it
+tc.execute("SELECT price FROM orders;").assertSucceeded().assertRowCount(2)
+tc.execute("SELECT name FROM orders;").assertFailed(err_code='42000', 
err_message="SELECT: identifier 'name' unknown")
+tc.execute("SELECT * FROM 
orders;").assertSucceeded().assertDataResultMatch([(12,), (42,)])
+tc.execute("UPDATE orders SET price = 0;").assertFailed(err_code='42000', 
err_message="UPDATE: insufficient privileges for user 'alice' to update table 
'orders' on column 'price'")
 
-# 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()
-
-# sql_test_client('monetdb', 'monetdb', input="""\
-# GRANT SELECT (price) ON library.orders TO alice;
-# GRANT UPDATE (name)  ON library.orders TO alice;
-# """)
+# alice can update name
+tc.execute("UPDATE orders SET name = 'book title goes 
here';").assertSucceeded().assertRowCount(2)
+# 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'")
+# but not this update involving the 'price' column
+tc.execute("UPDATE orders SET name = 'new book title' where price = 
12;").assertSucceeded().assertRowCount(2)
 
-
-
-# sql_test_client('alice', 'alice', input="""\
-# SELECT price FROM orders;
-# UPDATE orders SET name = 'book title goes here';
-# SELECT name FROM orders; --insufficient rights
-# UPDATE orders SET price = 0; --insufficient rights
-# """)
-
-
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - approved output

2020-12-18 Thread Niels Nes
Changeset: d4bbfda2f724 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d4bbfda2f724
Modified Files:
sql/test/mapi/Tests/sql_int128.test
Branch: unlock
Log Message:

approved output


diffs (12 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
@@ -168,6 +168,8 @@ querylog.define
 1
 sql.mvc
 1
+sql.claim
+1
 sql.append
 1
 sql.affectedRows
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: unlock - approved output

2020-12-18 Thread Niels Nes
Changeset: 3c9572faf534 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3c9572faf534
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: unlock
Log Message:

approved output


diffs (truncated from 697 to 300 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -136,7 +136,6 @@
 \dSf sys."evalalgebra"
 \dSf sys."fitsattach"
 \dSf sys."fitsload"
-\dSf sys."flush_log"
 \dSf sys."fuse"
 \dSf sys."generate_series"
 \dSf sys."geometrytype"
@@ -2159,7 +2158,7 @@ drop function pcre_replace(string, strin
 % .%1, .s, .f, .,  .,  .f, .fl,.,  .f, .f, 
.f, .f, .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  .,  .,  .,  .,  .,  .,  .,  .,  .,  
.,  . # table_name
 % %1,  name,   name,   system, query,  mod,language_name,  func_type,  
side_effect,varres, vararg, semantics,  name0,  type0,  type_digits0,   
type_scale0,inout0, name1,  type1,  type_digits1,   type_scale1,inout1, 
name2,  type2,  type_digits2,   type_scale2,inout2, name3,  type3,  
type_digits3,   type_scale3,inout3, name4,  type4,  type_digits4,   
type_scale4,inout4, name5,  type5,  type_digits5,   type_scale5,inout5, 
name6,  type6,  type_digits6,   type_scale6,inout6, name7,  type7,  
type_digits7,   type_scale7,inout7, name8,  type8,  type_digits8,   
type_scale8,inout8, name9,  type9,  type_digits9,   type_scale9,inout9, 
name10, type10, type_digits10,  type_scale10,   inout10,name11, type11, 
type_digits11,  type_scale11,   inout11,name12, type12, type_digits12,  
type_scale12,   inout12,name13, type13, type_digits13,  type_scale13,   
inout13,name14, type14, type_digits14,  type_scale14,   inout14,
name15, type15, type_digits15,  type_scale15,   inout15 # name
 % char,varchar,varchar,char,   varchar,
varchar,varchar,varchar,boolean,boolean,
boolean,boolean,varchar,varchar,int,int,
char,   varchar,varchar,int,int,char,   varchar,
varchar,int,int,char,   varchar,varchar,int,
int,char,   varchar,varchar,int,int,char,   
varchar,varchar,int,int,char,   varchar,
varchar,int,int,char,   varchar,varchar,int,
int,char,   varchar,varchar,int,int,char,   
varchar,varchar,int,int,char,   varchar,
varchar,int,int,char,   varchar,varchar,int,
int,char,   varchar,varchar,int,int,char,   
varchar,varchar,int,int,char,   varchar,
varchar,int,int,char,   varchar,varchar,int,
int,char # type
-% 13,  8,  24, 6,  3342,   9,  10, 26, 5,  5,  
5,  5,  11, 14, 4,  1,  3,  16, 14, 4,  
1,  3,  16, 14, 4,  1,  3,  27, 12, 4,  
1,  3,  9,  9,  2,  1,  3,  14, 14, 4,  
1,  3,  12, 14, 2,  1,  3,  11, 7,  2,  
1,  3,  11, 7,  2,  1,  3,  10, 6,  2,  
1,  3,  9,  6,  2,  1,  3,  6,  7,  2,  
1,  3,  8,  7,  2,  1,  3,  6,  7,  2,  
1,  3,  9,  7,  1,  1,  3,  6,  7,  1,  
1,  3 # length
+% 13,  8,  24, 6,  3342,   9,  10, 26, 5,  5,  
5,  5,  11, 14, 4,  1,  3,  16, 14, 4,  
1,  3,  16, 14, 4,  1,  3,  27, 12, 4,  
1,  3,  9,  9,  2,  1,  3,  14, 14, 4,  
1,  3,  12, 14, 3,  1,  3,  11, 7,  2,  
1,  3,  11, 7,  2,  1,  3,  10, 6,  2,  
1,  3,  9,  7,

MonetDB: Oct2020 - Added test and fix for bug 7035, ie dont be t...

2020-12-18 Thread Pedro Ferreira
Changeset: 11a67b229142 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=11a67b229142
Added Files:
sql/test/BugTracker-2020/Tests/user-update-privs.Bug-7035.py
sql/test/BugTracker-2020/Tests/user-update-privs.Bug-7035.stable.err
sql/test/BugTracker-2020/Tests/user-update-privs.Bug-7035.stable.out
Modified Files:
sql/server/rel_updates.c
sql/test/BugTracker-2020/Tests/All
sql/test/astro/Tests/update.sql
sql/test/astro/Tests/update.stable.out
sql/test/mapi/Tests/sql_int128.stable.out.int128
Branch: Oct2020
Log Message:

Added test and fix for bug 7035, ie dont be too aggressive on select privileges 
on update queries. Reduce column visibility likewise in read queries


diffs (truncated from 451 to 300 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
@@ -1075,11 +1075,23 @@ update_table(sql_query *query, dlist *qn
return sql_error(sql, 02, SQLSTATE(3F000) "UPDATE: no such 
schema '%s'", sname);
t = find_table_on_scope(sql, &s, sname, tname);
if (update_allowed(sql, t, tname, "UPDATE", "update", 0) != NULL) {
-   sql_rel *r = NULL, *bt = rel_basetable(sql, t, alias ? alias : 
tname), *res = bt;
+   sql_rel *r = NULL, *res = rel_basetable(sql, t, alias ? alias : 
tname);
 
+   /* 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) {
+   res->exps = sa_list(sql->sa); /* hasn't select 
privilege on any column, add just TID column to the list */
+   } else {
+   res = nres; /* add TID column to the columns it 
has permission to */
+   }
+   list_append(res->exps, exp_column(sql->sa, alias ? 
alias : tname, TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1));
+   }
if (opt_from) {
dlist *fl = opt_from->data.lval;
-   list *refs = list_append(new_exp_list(sql->sa), (char*) 
rel_name(bt));
+   list *refs = list_append(new_exp_list(sql->sa), (char*) 
rel_name(res));
 
for (dnode *n = fl->h; n && res; n = n->next) {
sql_rel *fnd = table_ref(query, NULL, 
n->data.sym, 0, refs);
@@ -1093,8 +1105,6 @@ update_table(sql_query *query, dlist *qn
return NULL;
}
if (opt_where) {
-   if (!table_privs(sql, t, PRIV_SELECT))
-   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 (!(r = rel_logical_exp(query, res, opt_where, 
sql_where)))
return NULL;
/* handle join */
@@ -1107,7 +1117,7 @@ update_table(sql_query *query, dlist *qn
} else {/* update all */
r = res;
}
-   return update_generate_assignments(query, t, r, bt, 
assignmentlist, "UPDATE");
+   return update_generate_assignments(query, t, r, 
rel_basetable(sql, t, alias ? alias : tname), assignmentlist, "UPDATE");
}
return NULL;
 }
@@ -1158,8 +1168,11 @@ delete_table(sql_query *query, dlist *qn
if (opt_where) {
sql_exp *e;
 
-   if (!table_privs(sql, t, PRIV_SELECT))
-   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);
+   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);
+   list_append(r->exps, exp_column(sql->sa, alias 
? alias : tname, TID, sql_bind_local

MonetDB: default - Clean up

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

Clean up


diffs (12 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
@@ -33,3 +33,8 @@ with SQLTestCase() as tc:
 # but not this update involving the 'price' column
 tc.execute("UPDATE orders SET name = 'new book title' where price = 
12;").assertSucceeded().assertRowCount(2)
 
+# clean up
+tc.connect(username="monetdb", password="monetdb")
+tc.execute("DROP USER alice;").assertSucceeded()
+tc.execute("DROP TABLE library.orders;").assertSucceeded()
+tc.execute("DROP SCHEMA library;").assertSucceeded()
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - clean up

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

clean up


diffs (111 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
@@ -6,12 +6,12 @@ unknown_user
 withGrantOption
 grantMonetdb
 columnRights
-createSetUp
 changePasswordUser
-renameUser
-changeSchemaUser
 copyinto
 schemaRights
 metadataConsistency
 createUserRollback
 userCallFunction
+createSetUp
+renameUser
+changeSchemaUser
diff --git a/sql/test/Users/Tests/changePasswordUser.SQL.py 
b/sql/test/Users/Tests/changePasswordUser.SQL.py
--- a/sql/test/Users/Tests/changePasswordUser.SQL.py
+++ b/sql/test/Users/Tests/changePasswordUser.SQL.py
@@ -10,59 +10,26 @@ logging.basicConfig(level=logging.FATAL)
 
 with SQLTestCase() as tc:
 tc.connect(username="monetdb", password="monetdb")
+tc.execute("CREATE USER april WITH PASSWORD 'april' NAME 'april' SCHEMA 
sys;").assertSucceeded()
+tc.connect(username="april", password="april")
+tc.execute("select current_user, 'password is 
\"april\"';").assertSucceeded()\
+.assertDataResultMatch([("april", "password is \"april\"",)])
+
+tc.connect(username="monetdb", password="monetdb")
 tc.execute("ALTER USER april WITH UNENCRYPTED PASSWORD 
'april2';").assertSucceeded()
 tc.connect(username="april", password="april")
-tc.execute("select 'password april';").assertFailed()
+tc.execute("select 'password incorrect 
april';").assertFailed(err_code=None, 
err_message="InvalidCredentialsException:checkCredentials:invalid credentials 
for user 'april'")
 tc.connect(username="april", password="april2")
-tc.execute("select 'password april2';")\
-.assertSucceeded()\
-.assertRowCount(1).assertDataResultMatch([("password april2",)])
+tc.execute("select 'password correct april2';").assertSucceeded()\
+.assertDataResultMatch([("password correct april2",)])
+# april tries to change its password with an incorrect old password
 tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD 
PASSWORD 'april3';")\
-.assertFailed(err_message='ALTER USER: Access denied')
+.assertFailed(err_code="M0M27", err_message='ALTER USER: Access 
denied')
 tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 
'april2';").assertSucceeded()
 tc.connect(username="april", password="april2")
 tc.execute("select 'password april2 (wrong!!!)';").assertFailed()
 tc.connect(username="april", password="april")
-tc.execute("select 'password change 
successfully';").assertSucceeded().assertRowCount(1).assertDataResultMatch([("password
 change successfully",)])
-
-# import os, sys
-# try:
-# from MonetDBtesting import process
-# except ImportError:
-# import process
-
-# 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()
-
-# sql_test_client('monetdb', 'monetdb', input="""\
-# ALTER USER april  WITH UNENCRYPTED PASSWORD 'april2';
-# """)
+tc.execute("select 'password change 
successfully';").assertSucceeded().assertDataResultMatch([("password change 
successfully",)])
 
-# # try to log in with old password
-# sql_test_client('april', 'april', input="""\
-# select 'password april';
-# """)
-
-# # try to log in with new password
-# sql_test_client('april', 'april2', input="""\
-# select 'password april2';
-# ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3';
-# ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 'april2';
-# """)
-
-# # try to log in with old password
-# sql_test_client('april', 'april2', input="""\
-# select 'password april2 (wrong!!!)';
-# """)
-
-
-# # try to log in with the new password
-# sql_test_client('april', 'april', input="""\
-# select 'password change successfully';
-# """)
-
-
-
+tc.connect(username="monetdb", password="monetdb")
+tc.execute("DROP USER april;").assertSucceeded()
diff --git a/sql/test/Users/Tests/changePasswordUser.reqtests 
b/sql/test/Users/Tests/changePasswordUser.reqtests
deleted file mode 100644
--- a/sql/test/Users/Tests/changePasswordUser.reqtests
+++ /dev/null
@@ -1,1 +0,0 @@
-createSetUp
diff --git a/sql/test/Users/Tests/unknown_user.SQL.py 
b/sql/test/Users/Tests/unknown_user.SQL.py
--- a/sql/test/Users/Tests/unknown_user.SQL.py
+++ b/sql/test/Users/Tests/unknown_user.SQL.py
@@ -26,3 +26,5 @@ with SQLTestCase() as tc:
 tc.exec

MonetDB: unlock - Check boundaries so that we don't get overflow.

2020-12-18 Thread Sjoerd Mullender
Changeset: 8801848d6f1b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8801848d6f1b
Modified Files:
gdk/gdk_cand.c
Branch: unlock
Log Message:

Check boundaries so that we don't get overflow.


diffs (32 lines):

diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c
--- a/gdk/gdk_cand.c
+++ b/gdk/gdk_cand.c
@@ -1007,15 +1007,20 @@ canditer_sliceval_mask(struct canditer *
return NULL;
bn->tkey = true;
 
-   lo1 -= ci->mskoff;
-   hi1 -= ci->mskoff;
-   for (oid o = lo1; o < hi1 && cnt1 > 0; o++) {
-   if (ci->mask[o / 32] & (1U << (o % 32))) {
-   if (BUNappend(bn, &(oid){o + ci->mskoff}, false) != 
GDK_SUCCEED) {
-   BBPreclaim(bn);
-   return NULL;
+   if (hi1 > ci->mskoff) {
+   if (lo1 < ci->mskoff)
+   lo1 = 0;
+   else
+   lo1 -= ci->mskoff;
+   hi1 -= ci->mskoff;
+   for (oid o = lo1; o < hi1 && cnt1 > 0; o++) {
+   if (ci->mask[o / 32] & (1U << (o % 32))) {
+   if (BUNappend(bn, &(oid){o + ci->mskoff}, 
false) != GDK_SUCCEED) {
+   BBPreclaim(bn);
+   return NULL;
+   }
+   cnt1--;
}
-   cnt1--;
}
}
if (cnt2 > 0) {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: jun-order - fix div by zero problem

2020-12-18 Thread Niels Nes
Changeset: 1b471c0608b9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1b471c0608b9
Modified Files:
sql/server/rel_optimizer.c
Branch: jun-order
Log Message:

fix div by zero problem


diffs (15 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -371,7 +371,10 @@ rel_properties(mvc *sql, global_props *g
 
if (np) {
lng ec = exps_count(rel->exps);
-   np->value = 
(void*)((cnt+ec-1)/ec);
+   if (ec>0)
+   np->value = 
(void*)((cnt+ec-1)/ec);
+   else
+   np->value = (void*)cnt;
}
}
}
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list