MonetDB: Mar2018 - Also added upgrade output to the sql/test/tes...

2018-05-17 Thread Martin van Dinther
Changeset: 364ec372f783 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=364ec372f783
Modified Files:
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: Mar2018
Log Message:

Also added upgrade output to the 
sql/test/testdb-upgrade*/Tests/upgrade.stable.out* files
Note: I couldn't test it locally but I think this will become the upgrade 
output. Have to wait on the testweb to see if it needs some small finetuning.


diffs (truncated from 374 to 300 lines):

diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -33,6 +33,43 @@ delete from systemfunctions where functi
 set schema "testschema";
 commit;
 
+Running database upgrade commands:
+set schema "sys";
+DROP VIEW sys.dependencies_vw;
+DROP VIEW sys.ids;
+CREATE VIEW sys.ids (id, name, schema_id, table_id, table_name, obj_type, 
sys_table) AS
+SELECT id, name, cast(null as int) as schema_id, cast(null as int) as 
table_id, cast(null as varchar(124)) as table_name, 'author' AS obj_type, 
'sys.auths' AS sys_table FROM sys.auths UNION ALL
+SELECT id, name, cast(null as int) as schema_id, cast(null as int) as 
table_id, cast(null as varchar(124)) as table_name, 'schema', 'sys.schemas' 
FROM sys.schemas UNION ALL
+SELECT id, name, schema_id, id as table_id, name as table_name, case when type 
= 1 then 'view' else 'table' end, 'sys._tables' FROM sys._tables UNION ALL
+SELECT id, name, schema_id, id as table_id, name as table_name, case when type 
= 1 then 'view' else 'table' end, 'tmp._tables' FROM tmp._tables UNION ALL
+SELECT c.id, c.name, t.schema_id, c.table_id, t.name as table_name, 'column', 
'sys._columns' FROM sys._columns c JOIN sys._tables t ON c.table_id = t.id 
UNION ALL
+SELECT c.id, c.name, t.schema_id, c.table_id, t.name as table_name, 'column', 
'tmp._columns' FROM tmp._columns c JOIN tmp._tables t ON c.table_id = t.id 
UNION ALL
+SELECT k.id, k.name, t.schema_id, k.table_id, t.name as table_name, 'key', 
'sys.keys' FROM sys.keys k JOIN sys._tables t ON k.table_id = t.id UNION ALL
+SELECT k.id, k.name, t.schema_id, k.table_id, t.name as table_name, 'key', 
'tmp.keys' FROM tmp.keys k JOIN tmp._tables t ON k.table_id = t.id UNION ALL
+SELECT i.id, i.name, t.schema_id, i.table_id, t.name as table_name, 'index', 
'sys.idxs' FROM sys.idxs i JOIN sys._tables t ON i.table_id = t.id UNION ALL
+SELECT i.id, i.name, t.schema_id, i.table_id, t.name as table_name, 'index', 
'tmp.idxs' FROM tmp.idxs i JOIN tmp._tables t ON i.table_id = t.id UNION ALL
+SELECT g.id, g.name, t.schema_id, g.table_id, t.name as table_name, 'trigger', 
'sys.triggers' FROM sys.triggers g JOIN sys._tables t ON g.table_id = t.id 
UNION ALL
+SELECT g.id, g.name, t.schema_id, g.table_id, t.name as table_name, 'trigger', 
'tmp.triggers' FROM tmp.triggers g JOIN tmp._tables t ON g.table_id = t.id 
UNION ALL
+SELECT id, name, schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, case when type = 2 then 'procedure' else 
'function' end, 'sys.functions' FROM sys.functions UNION ALL
+SELECT a.id, a.name, f.schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, case when f.type = 2 then 'procedure arg' else 
'function arg' end, 'sys.args' FROM sys.args a JOIN sys.functions f ON 
a.func_id = f.id UNION ALL
+SELECT id, name, schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, 'sequence', 'sys.sequences' FROM sys.sequences 
UNION ALL
+SELECT id, sqlname, schema_id, cast(null as int) as table_id, cast(null as 
varchar(124)) as table_name, 'type', 'sys.types' FROM sys.types WHERE id > 2000 
/* exclude system types to prevent duplicates with auths.id */
+ ORDER BY id;
+GRANT SELECT ON sys.ids TO PUBLIC;
+CREATE VIEW sys.dependencies_vw AS
+SELECT d.id, i1.obj_type, i1.name,
+   d.depend_id as used_by_id, i2.obj_type as used_by_obj_type, i2.name as 
used_by_name,
+   d.depend_type, dt.dependency_type_name
+  FROM sys.dependencies d
+  JOIN sys.ids i1 ON d.id = i1.id
+  JOIN sys.ids i2 ON d.depend_id = i2.id
+  JOIN sys.dependency_types dt ON d.depend_type = dt.dependency_type_id
+ ORDER BY id, depend_id;
+GRANT SELECT ON sys.dependencies_vw TO PUBLIC;
+update sys._tables set system = true where name in ('ids', 'dependencies_vw') 
and schema_id in (select id from 

MonetDB: Mar2018 - Corrected the definition of view sys.ids whic...

2018-05-17 Thread Martin van Dinther
Changeset: 62c00fdffc43 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=62c00fdffc43
Modified Files:
sql/ChangeLog.Mar2018
sql/backends/monet5/sql_upgrades.c
sql/scripts/21_dependency_views.sql
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: Mar2018
Log Message:

Corrected the definition of view sys.ids which has been introduced in Mar2018 
release.
For the tmp.keys, tmp.idxs and tmp.triggers query parts it should have been 
joined with tmp._tables instead of sys._tables.
Also added upgrade code.
Note: view sys.dependencies_vw depends on sys.ids, so it needed to be dropped 
first and also recreated later.


diffs (255 lines):

diff --git a/sql/ChangeLog.Mar2018 b/sql/ChangeLog.Mar2018
--- a/sql/ChangeLog.Mar2018
+++ b/sql/ChangeLog.Mar2018
@@ -1,3 +1,6 @@
 # ChangeLog file for sql
 # This file is updated with Maddlog
 
+* Thu May 17 2018 Martin van Dinther 
+- Corrected the definition of view: sys.ids.
+
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
@@ -647,7 +647,7 @@ sql_update_jul2017(Client c, mvc *sql)
res_table *output;
BAT *b;
 
-   if( buf== NULL)
+   if( buf == NULL)
throw(SQL, "sql_update_jul2017", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"sys\";\n");
 
@@ -776,7 +776,7 @@ sql_update_jul2017_sp2(Client c)
size_t bufsize = 2048, pos = 0;
char *buf = GDKmalloc(bufsize);
 
-   if (buf== NULL)
+   if (buf == NULL)
throw(SQL, "sql_update_jul2017_sp2", 
SQLSTATE(HY001) MAL_MALLOC_FAIL);
 
/* 51_sys_schema_extensions.sql and 25_debug.sql */
@@ -861,7 +861,7 @@ sql_update_mar2018_geom(Client c, mvc *s
char *buf = GDKmalloc(bufsize), *err = NULL;
char *schema = stack_get_string(sql, "current_schema");
 
-   if (buf== NULL)
+   if (buf == NULL)
throw(SQL, "sql_update_mar2018_geom", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos, "set schema \"sys\";\n");
 
@@ -927,7 +927,7 @@ sql_update_mar2018(Client c, mvc *sql)
 
schema = stack_get_string(sql, "current_schema");
buf = GDKmalloc(bufsize);
-   if (buf== NULL)
+   if (buf == NULL)
throw(SQL, "sql_update_mar2018", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
s = mvc_bind_schema(sql, "sys");
 
@@ -1394,7 +1394,7 @@ sql_update_mar2018_netcdf(Client c, mvc 
 
schema = stack_get_string(sql, "current_schema");
buf = GDKmalloc(bufsize);
-   if (buf== NULL)
+   if (buf == NULL)
throw(SQL, "sql_update_mar2018_netcdf", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
 
pos += snprintf(buf + pos, bufsize - pos, "set schema sys;\n");
@@ -1435,7 +1435,7 @@ sql_update_mar2018_samtools(Client c, mv
 
schema = stack_get_string(sql, "current_schema");
buf = GDKmalloc(bufsize);
-   if (buf== NULL)
+   if (buf == NULL)
throw(SQL, "sql_update_mar2018_samtools", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
 
pos += snprintf(buf + pos, bufsize - pos, "set schema sys;\n");
@@ -1529,6 +1529,76 @@ sql_update_mar2018_sp1(Client c, mvc *sq
return err; /* usually MAL_SUCCEED */
 }
 
+static str
+sql_replace_Mar2018_ids_view(Client c, mvc *sql)
+{
+   size_t bufsize = 4400, pos = 0;
+   char *buf = GDKmalloc(bufsize), *err = NULL;
+   char *schema;
+   sql_schema *s;
+   sql_table *t;
+
+   if (buf == NULL)
+   throw(SQL, "sql_replace_Mar2018_ids_view", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+
+   schema = stack_get_string(sql, "current_schema");
+   s = mvc_bind_schema(sql, "sys");
+   t = mvc_bind_table(sql, s, "ids");
+   t->system = 0;  /* make it non-system else the drop view will fail */
+   t = mvc_bind_table(sql, s, "dependencies_vw");  /* dependencies_vw uses 
view sys.ids so must be removed first */
+   t->system = 0;
+
+   /* 21_dependency_views.sql */
+   pos += snprintf(buf + pos, bufsize - pos,
+   "set schema \"sys\";\n"
+   "DROP VIEW sys.dependencies_vw;\n"
+   "DROP VIEW sys.ids;\n"
+
+   "CREATE VIEW sys.ids (id, name, schema_id, table_id, 
table_name, obj_type, sys_table) AS\n"
+   "SELECT id, name, cast(null as int) as schema_id, 
cast(null as int) as table_id, cast(null as varchar(124)) as table_name, 
'author' AS obj_type, 'sys.auths' AS sys_table FROM sys.auths UNION ALL\n"
+   "SELECT id, name, cast(null as int) as 

MonetDB: merge-partitions - Added test for updates on a subtable

2018-05-17 Thread Pedro Ferreira
Changeset: e5a899bdd23d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e5a899bdd23d
Added Files:
sql/test/merge-partitions/Tests/mergepart17.sql
sql/test/merge-partitions/Tests/mergepart17.stable.err
sql/test/merge-partitions/Tests/mergepart17.stable.out
Modified Files:
sql/test/merge-partitions/Tests/All
Branch: merge-partitions
Log Message:

Added test for updates on a subtable


diffs (260 lines):

diff --git a/sql/test/merge-partitions/Tests/All 
b/sql/test/merge-partitions/Tests/All
--- a/sql/test/merge-partitions/Tests/All
+++ b/sql/test/merge-partitions/Tests/All
@@ -15,3 +15,4 @@ mergepart13
 HAVE_GEOM?mergepart14
 mergepart15
 mergepart16
+mergepart17
diff --git a/sql/test/merge-partitions/Tests/mergepart17.sql 
b/sql/test/merge-partitions/Tests/mergepart17.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/merge-partitions/Tests/mergepart17.sql
@@ -0,0 +1,45 @@
+CREATE MERGE TABLE testupdates (a int, b varchar(32)) PARTITION BY RANGE (a);
+CREATE TABLE sublimits1 (a int, b varchar(32));
+
+INSERT INTO sublimits1 VALUES (1000, 'ups');
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 100; 
--error
+TRUNCATE sublimits1;
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 100;
+
+INSERT INTO sublimits1 VALUES (100, 'ok');
+UPDATE sublimits1 SET a = a + 1; --error
+UPDATE sublimits1 SET b = 'p' || b WHERE a = 100;
+
+SELECT a, b FROM testupdates;
+SELECT a, b FROM sublimits1;
+
+ALTER TABLE testupdates DROP TABLE sublimits1;
+
+UPDATE sublimits1 SET a = a + 1;
+UPDATE sublimits1 SET b = b || 's' WHERE a = 101;
+
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 100; 
--error
+UPDATE sublimits1 SET a = a - 1;
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 100;
+
+SELECT a, b FROM testupdates;
+SELECT a, b FROM sublimits1;
+
+ALTER TABLE testupdates DROP TABLE sublimits1;
+
+START TRANSACTION;
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 100;
+ROLLBACK;
+
+UPDATE sublimits1 SET a = a + 1;
+
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 101;
+
+SELECT a, b FROM sublimits1;
+SELECT a, b FROM testupdates;
+
+ALTER TABLE testupdates DROP TABLE sublimits1;
+ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 AND 100; 
--error
+
+DROP TABLE sublimits1;
+DROP TABLE testupdates;
diff --git a/sql/test/merge-partitions/Tests/mergepart17.stable.err 
b/sql/test/merge-partitions/Tests/mergepart17.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/merge-partitions/Tests/mergepart17.stable.err
@@ -0,0 +1,53 @@
+stderr of test 'mergepart17` in directory 'sql/test/merge-partitions` itself:
+
+
+# 16:54:54 >  
+# 16:54:54 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=33193" "--set" 
"mapi_usock=/var/tmp/mtest-9208/.s.monetdb.33193" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/ferreira/repositories/MonetDB-merge-partitions/BUILD/var/MonetDB/mTests_sql_test_merge-partitions"
 "--set" "embedded_r=yes" "--set" "embedded_py=true" "--set" "embedded_c=true"
+# 16:54:54 >  
+
+# builtin opt  gdk_dbpath = 
/home/ferreira/repositories/MonetDB-merge-partitions/BUILD/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 = 33193
+# cmdline opt  mapi_usock = /var/tmp/mtest-9208/.s.monetdb.33193
+# cmdline opt  monet_prompt = 
+# cmdline opt  gdk_dbpath = 
/home/ferreira/repositories/MonetDB-merge-partitions/BUILD/var/MonetDB/mTests_sql_test_merge-partitions
+# cmdline opt  embedded_r = yes
+# cmdline opt  embedded_py = true
+# cmdline opt  embedded_c = true
+# cmdline opt  gdk_debug = 553648138
+
+# 16:54:55 >  
+# 16:54:55 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-9208" "--port=33193"
+# 16:54:55 >  
+
+MAPI  = (monetdb) /var/tmp/mtest-9208/.s.monetdb.33193
+QUERY = ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 
AND 100; --error
+ERROR = !ALTER TABLE: there are values in the column a, outside the partition 
range
+CODE  = M0M29
+MAPI  = (monetdb) /var/tmp/mtest-9208/.s.monetdb.33193
+QUERY = UPDATE sublimits1 SET a = a + 1; --error
+ERROR = !UPDATE: Update on the partitioned column not possible at the moment
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-9208/.s.monetdb.33193
+QUERY = ALTER TABLE testupdates ADD TABLE sublimits1 AS PARTITION BETWEEN 1 
AND 100; --error
+ERROR = !ALTER TABLE: there are values in the column a, outside the partition 
range
+CODE  = M0M29
+MAPI  = (monetdb) 

monetdb-java: default - Fix warnings:

2018-05-17 Thread Martin van Dinther
Changeset: 68b9452f1215 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=68b9452f1215
Modified Files:
src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
Branch: default
Log Message:

Fix warnings:
  [javadoc] 
/export/scratch1/dinther/javadev/monetdb-java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java:303:
 warning: attribute obsolete, use CSS instead: size
  [javadoc]  * A JDBC Compliant TM driver 
always returns false.


diffs (129 lines):

diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java 
b/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
@@ -300,7 +300,7 @@ public class MonetDatabaseMetaData exten
/**
 * Does the database treat mixed case unquoted SQL identifiers
 * as case sensitive and as a result store them in mixed case?
-* A JDBC Compliant TM driver always 
returns false.
+* A JDBC Compliant TM driver always returns false.
 *
 * @return false
 */
@@ -345,7 +345,7 @@ public class MonetDatabaseMetaData exten
/**
 * Does the database treat mixed case quoted SQL identifiers as
 * case sensitive and as a result store them in mixed case?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so
 */
@@ -390,7 +390,7 @@ public class MonetDatabaseMetaData exten
/**
 * What is the string used to quote SQL identifiers?
 * This returns a space if identifier quoting isn't supported.
-* A JDBC Compliant TM driver
+* A JDBC Compliant TM driver
 * will always use a double quote character.
 *
 * @return the quoting string
@@ -578,7 +578,7 @@ public class MonetDatabaseMetaData exten
 *
 * If so, the SQL AS clause can be used to provide names for
 * computed columns or to provide alias names for columns as required.
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * e.g.
 *
@@ -597,7 +597,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Are concatenations between NULL and non-NULL values NULL?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so
 */
@@ -763,7 +763,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Are table correlation names supported?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so
 */
@@ -844,7 +844,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Is the escape character in "LIKE" clauses supported?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so
 */
@@ -877,7 +877,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Can columns be defined as non-nullable.
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so
 */
@@ -925,7 +925,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Does this driver support the ANSI-92 entry level SQL grammar?
-* All JDBC Compliant TM drivers must 
return true.
+* All JDBC Compliant TM drivers must return true.
 *
 * @return true if so
 */
@@ -1201,7 +1201,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Are subqueries in comparison expressions supported?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 * MonetDB also supports this
 *
 * @return true if so; false otherwise
@@ -1213,7 +1213,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Are subqueries in 'exists' expressions supported?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so; false otherwise
 */
@@ -1224,7 +1224,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Are subqueries in 'in' statements supported?
-* A JDBC Compliant TM driver always 
returns true.
+* A JDBC Compliant TM driver always returns true.
 *
 * @return true if so; false otherwise
 */
@@ -1235,7 +1235,7 @@ public class MonetDatabaseMetaData exten
 
/**
 * Are subqueries in quantified expressions 

MonetDB: Mar2018 - Changed casting to int such that output colum...

2018-05-17 Thread Martin van Dinther
Changeset: dc0a36efeb9d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dc0a36efeb9d
Modified Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.sql

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
Branch: Mar2018
Log Message:

Changed casting to int such that output column becomes bigint, which is 
supported on all platforms.


diffs (20 lines):

diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.sql
@@ -1,3 +1,3 @@
 SELECT ALL + 62 * + - CAST( ( CASE WHEN NULL NOT IN ( CAST ( CAST ( - 77 AS 
INTEGER ) AS INTEGER ) )
 THEN NULL WHEN ( NULL ) NOT IN ( 94 * COUNT ( * ) ) THEN + ( NULLIF ( 45, 80 + 
90 ) ) - COUNT ( * )
-ELSE NULL END ) AS BIGINT) AS col2;
+ELSE NULL END ) AS INT) AS col2;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
@@ -29,7 +29,7 @@ Ready.
 #ELSE NULL END ) AS BIGINT) AS col2;
 % .L14 # table_name
 % col2 # name
-% hugeint # type
+% bigint # type
 % 1 # length
 [ NULL ]
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: merge-partitions - As I don't know the transaction mana...

2018-05-17 Thread Pedro Ferreira
Changeset: e01286a0b8f5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e01286a0b8f5
Modified Files:
sql/server/rel_propagate.c
sql/server/rel_schema.c
sql/server/rel_updates.c
sql/test/merge-partitions/Tests/mergepart15.stable.err
Branch: merge-partitions
Log Message:

As I don't know the transaction manager entirely :( I will simply check the 
cached value of the upper merge table. If the bottom table could not be found, 
then is no longer part of the merge table.


diffs (71 lines):

diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c
--- a/sql/server/rel_propagate.c
+++ b/sql/server/rel_propagate.c
@@ -461,9 +461,14 @@ rel_propagate(mvc *sql, sql_rel *rel, in
} else {
assert(0);
}
-   } else if(t->p && (isRangePartitionTable(t->p) || 
isListPartitionTable(t->p)) && !find_prop(l->p, PROP_USED)) {
-   if(is_insert(rel->op)) { //insertion directly to 
sub-table (must do validation)
-   return rel_subtable_insert(sql, rel, t, 
changes);
+   } else if(t->p) {
+   sql_part *pt = find_sql_part(t->p, t->base.name);
+   if(!pt) {
+   t->p = NULL;
+   } else if((isRangePartitionTable(t->p) || 
isListPartitionTable(t->p)) && !find_prop(l->p, PROP_USED)) {
+   if(is_insert(rel->op)) { //insertion directly 
to sub-table (must do validation)
+   return rel_subtable_insert(sql, rel, t, 
changes);
+   }
}
}
}
diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -1060,7 +1060,8 @@ table_element(mvc *sql, symbol *s, sql_s
 }
 
 static int
-create_partition_column(mvc *sql, sql_table *t, int tt, symbol* partition_def) 
{
+create_partition_column(mvc *sql, sql_table *t, int tt, symbol* partition_def)
+{
if((tt == tt_list_partition || tt == tt_range_partition) && 
partition_def) {
dlist* list = partition_def->data.lval;
str colname = list->h->next->data.sval;
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
@@ -904,10 +904,14 @@ update_table(mvc *sql, dlist *qname, dli
 
if(isRangePartitionTable(t) || isListPartitionTable(t)) {
partitioned_column = t->pcol->colnr;
-   } else if(t->p && (isRangePartitionTable(t->p) || 
isListPartitionTable(t->p))) {
-   partitioned_column = t->p->pcol->colnr;
+   } else if(t->p) {
+   sql_part *pt = find_sql_part(t->p, t->base.name);
+   if(!pt) {
+   t->p = NULL;
+   } else if(isRangePartitionTable(t->p) || 
isListPartitionTable(t->p)) {
+   partitioned_column = t->p->pcol->colnr;
+   }
}
-
res = bt;
 #if 0
dlist *selection = dlist_create(sql->sa);
diff --git a/sql/test/merge-partitions/Tests/mergepart15.stable.err 
b/sql/test/merge-partitions/Tests/mergepart15.stable.err
--- a/sql/test/merge-partitions/Tests/mergepart15.stable.err
+++ b/sql/test/merge-partitions/Tests/mergepart15.stable.err
@@ -30,9 +30,9 @@ stderr of test 'mergepart15` in director
 
 MAPI  = (monetdb) /var/tmp/mtest-26053/.s.monetdb.37352
 QUERY = ALTER TABLE testme ADD TABLE sublimits1 AS PARTITION WITH NULL; --error
-ERROR = !ALTER TABLE: there are non-null values in the column which is not 
allowed for this partition
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-26053/.s.monetdb.37352
+ERROR = !ALTER TABLE: there are values in the column a, outside the partition 
range
+CODE  = M0M29
+MAPI  = (monetdb) /var/tmp/mtest-18994/.s.monetdb.34581
 QUERY = INSERT INTO testme VALUES (2, 'third'); --error
 ERROR = !INSERT: the insert violates the partition range of values
 CODE  = M0M29
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


monetdb-java: default - Updated ChangeLog and ChangeLog-Archive ...

2018-05-17 Thread Martin van Dinther
Changeset: 60334b96df18 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=60334b96df18
Modified Files:
ChangeLog
ChangeLog-Archive
Branch: default
Log Message:

Updated ChangeLog and ChangeLog-Archive in preparation for new release of JDBC 
driver


diffs (71 lines):

diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
 # ChangeLog file for monetdb-java
 # This file is updated with Maddlog
 
+* Wed May 23 2018 Sjoerd Mullender 
+- Compiled and released new jars: monetdb-jdbc-2.28.jar, monetdb-mcl-1.17.jar
+  and updated jdbcclient.jar
+
 * Thu Apr 26 2018 Martin van Dinther 
 - Corrected and extended output of DatabaseMetaData methods
   getTimeDateFunctions() and getSystemFunctions().  The Date/Time functions
@@ -26,3 +30,10 @@
   comment has been set for the table / view / column / procedure / function
   via the SQL command COMMENT ON   IS 'comment-text'.
 
+* Thu Dec 14 2017 Martin van Dinther 
+- Fixed a problem with retrieving Dates and Timestamps which contained a
+  year value less than 1000. It would throw an SQLDataException with message:
+   Could not convert value to a Date. Expected JDBC date escape format
+   -[m]m-[d]d.
+  See also: https://www.monetdb.org/bugzilla/show_bug.cgi?id=6468
+
diff --git a/ChangeLog-Archive b/ChangeLog-Archive
--- a/ChangeLog-Archive
+++ b/ChangeLog-Archive
@@ -1,6 +1,42 @@
 # DO NOT EDIT THIS FILE -- MAINTAINED AUTOMATICALLY
 # This file contains past monetdb-java ChangeLog entries
 
+* Wed May 23 2018 Sjoerd Mullender 
+- Compiled and released new jars: monetdb-jdbc-2.28.jar, monetdb-mcl-1.17.jar
+  and updated jdbcclient.jar
+
+* Thu Apr 26 2018 Martin van Dinther 
+- Corrected and extended output of DatabaseMetaData methods
+  getTimeDateFunctions() and getSystemFunctions().  The Date/Time functions
+  (curdate, current_date, current_time, current_timestamp, curtime,
+  local_timezone, localtime, localtimestamp) were returned by
+  getSystemFunctions() but are now returned by getTimeDateFunctions().
+  getTimeDateFunctions() now also lists functions: date_to_str, extract, now,
+  str_to_date, str_to_time, str_to_timestamp, time_to_str and timestamp_to_str.
+- Improved DatabaseMetaData methods getTablePrivileges() and
+  getColumnPrivileges() by returning also any combination of privileges
+  for the table or column in the PRIVILEGE result column. Previously only
+  single privileges (SELECT or UPDATE or INSERT or DELETE or EXECUTE or
+  GRANT) would be returned.
+
+* Thu Apr 19 2018 Martin van Dinther 
+- Corrected method DatabaseMetaData.getFunctions() for result column
+  FUNCTION_TYPE.  It used to return DatabaseMetaData.functionResultUnknown
+  value for Analytic (functions.type 6) and Loader function (functions type 7).
+  It now returns DatabaseMetaData.functionNoTable for Analytic functions and
+  DatabaseMetaData.functionReturnsTable for Loader functions.
+- DatabaseMetaData methods getTables(), getColumns(), getProcedures() and
+  getFunctions() now return the comment in the REMARKS result column when a
+  comment has been set for the table / view / column / procedure / function
+  via the SQL command COMMENT ON   IS 'comment-text'.
+
+* Thu Dec 14 2017 Martin van Dinther 
+- Fixed a problem with retrieving Dates and Timestamps which contained a
+  year value less than 1000. It would throw an SQLDataException with message:
+   Could not convert value to a Date. Expected JDBC date escape format
+   -[m]m-[d]d.
+  See also: https://www.monetdb.org/bugzilla/show_bug.cgi?id=6468
+
 * Mon Oct 23 2017 Sjoerd Mullender 
 - Compiled and released new jars: monetdb-jdbc-2.27.jar, monetdb-mcl-1.16.jar
   and updated jdbcclient.jar
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: merge-partitions - Generate an exp_or instead of a whol...

2018-05-17 Thread Pedro Ferreira
Changeset: 601237f8fd11 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=601237f8fd11
Modified Files:
sql/server/rel_propagate.c
sql/test/merge-partitions/Tests/mergepart06.stable.out
Branch: merge-partitions
Log Message:

Generate an exp_or instead of a whole new relation, so NULL values are inserted 
in order.


diffs (97 lines):

diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c
--- a/sql/server/rel_propagate.c
+++ b/sql/server/rel_propagate.c
@@ -239,36 +239,26 @@ rel_generate_subinserts(mvc *sql, sql_re
le = exp_column(sql->sa, exp_relname(le), exp_name(le), 
exp_subtype(le), le->card, has_nil(le), is_intern(le));
 
if(isRangePartitionTable(t)) {
-   sql_exp *e1, *e2;
-
+   sql_exp *e1, *e2, *range;
e1 = create_table_part_atom_exp(sql, pt->tpe, 
pt->part.range.minvalue);
e2 = create_table_part_atom_exp(sql, pt->tpe, 
pt->part.range.maxvalue);
-   dup = rel_compare_exp_(sql, dup, le, e1, e2, 3, 0);
+   range = exp_compare2(sql->sa, le, e1, e2, 3);
 
if(accum) {
-   sql_exp *nr = exp_compare2(sql->sa, anti_le, 
exp_copy(sql->sa, e1), exp_copy(sql->sa, e2), 3);
-   accum = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), accum),
-  
list_append(new_exp_list(sql->sa), nr), 1);
+   accum = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), exp_copy(sql->sa, range)),
+  
list_append(new_exp_list(sql->sa), accum), 1);
} else {
-   accum = exp_compare2(sql->sa, anti_le, 
exp_copy(sql->sa, e1), exp_copy(sql->sa, e2), 3);
+   accum = exp_copy(sql->sa, range);
}
 
if(pt->with_nills) { /* handle the nulls case */
-   sql_rel *extra;
-   sql_exp *nils = rel_unop_(sql, le, NULL, 
"isnull", card_value),
-   *anti_nils = rel_unop_(sql, 
anti_le, NULL, "isnull", card_value);
+   sql_exp *nils = rel_unop_(sql, le, NULL, 
"isnull", card_value);
nils = exp_compare(sql->sa, nils, 
exp_atom_bool(sql->sa, 1), cmp_equal);
-
-   if(accum) {
-   sql_exp *nr = exp_compare(sql->sa, 
anti_nils, exp_atom_bool(sql->sa, 1), cmp_notequal);
-   accum = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), accum),
-  
list_append(new_exp_list(sql->sa), nr), 1);
-   } else {
-   accum = exp_compare(sql->sa, anti_nils, 
exp_atom_bool(sql->sa, 1), cmp_notequal);
-   }
-   extra = rel_select(sql->sa, rel->r, nils);
-   dup = rel_or(sql, NULL, dup, extra, NULL, NULL, 
NULL);
+   range = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range),
+  
list_append(new_exp_list(sql->sa), nils), 0);
+   found_nils = 1;
}
+   dup = rel_select(sql->sa, dup, range);
} else if(isListPartitionTable(t)) {
sql_exp *ein;
list *exps = new_exp_list(sql->sa);
@@ -314,15 +304,15 @@ rel_generate_subinserts(mvc *sql, sql_re
anti_exp = accum;
} else if(isListPartitionTable(t)) {
anti_exp = exp_in(sql->sa, anti_le, anti_exps, cmp_notin);
-   if(!found_nils) {
-   sql_exp *anti_nils = rel_unop_(sql, anti_le, NULL, 
"isnull", card_value);
-   anti_nils = exp_compare(sql->sa, anti_nils, 
exp_atom_bool(sql->sa, 1), cmp_equal);
-   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), anti_exp),
- 
list_append(new_exp_list(sql->sa), anti_nils), 0);
-   }
} else {
assert(0);
}
+   if(!found_nils) {
+   sql_exp *anti_nils = rel_unop_(sql, anti_le, NULL, "isnull", 
card_value);
+   anti_nils = exp_compare(sql->sa, anti_nils, 
exp_atom_bool(sql->sa, 1), cmp_equal);
+   anti_exp = exp_or(sql->sa, list_append(new_exp_list(sql->sa), 
anti_exp),
+ 
list_append(new_exp_list(sql->sa), anti_nils), 0);
+   }
//generate a count 

MonetDB: remote_auth - Merge with default

2018-05-17 Thread Panagiotis Koutsourakis
Changeset: 742d0f2c8f8e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=742d0f2c8f8e
Branch: remote_auth
Log Message:

Merge with default

For some reason previous merge did not go through correctly

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


MonetDB: default - Merge with Mar2018

2018-05-17 Thread Panagiotis Koutsourakis
Changeset: 928ee25bf49a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=928ee25bf49a
Added Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.out
Modified Files:
sql/backends/monet5/sql_upgrades.c

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
Branch: default
Log Message:

Merge with Mar2018


diffs (207 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
@@ -1509,7 +1509,7 @@ sql_update_mar2018_sp1(Client c, mvc *sq
char *schema = stack_get_string(sql, "current_schema");
 
if (buf == NULL)
-   throw(SQL, "sql_update_dec2016_sp3", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   throw(SQL, "sql_update_mar2018_sp1", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos,
"set schema \"sys\";\n"
"drop function 
sys.dependencies_functions_os_triggers();\n"
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
@@ -29,7 +29,7 @@ Ready.
 #ELSE NULL END ) AS BIGINT) AS col2;
 % .L14 # table_name
 % col2 # name
-% bigint # type
+% hugeint # type
 % 1 # length
 [ NULL ]
 
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
@@ -28,11 +28,11 @@ Ready.
 #INSERT INTO tab0 VALUES (97,1,99), (15,81,47), (87,21,10);
 [ 3]
 #SELECT ALL - ( - COUNT ( * ) ) FROM tab0 AS cor0 WHERE col0 / ( - + col2 ) 
NOT IN ( + + col0, + col0 * + ( col1 ), + ( + - col0 ) * - 45, + CAST ( NULL AS 
INTEGER ) );
-% sys.L34 # table_name
-% L34 # name
+% sys.L31 # table_name
+% L31 # name
 % bigint # type
 % 1 # length
-[ 3]
+[ 0]
 #DROP TABLE tab0;
 
 # 19:12:39 >  
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
@@ -2,3 +2,22 @@ CREATE TABLE tab2(col0 INTEGER, col1 INT
 INSERT INTO tab2 VALUES(64,77,40),(75,67,58),(46,51,23);
 SELECT * FROM tab2 WHERE + col2 NOT IN ( + - 59 + + ( 76 ), col1, + CAST ( 
NULL AS INTEGER ), col1, - 19, col1 );
 DROP TABLE tab2;
+
+CREATE TABLE CITIES(CITY varchar(50) NULL);
+INSERT INTO CITIES
+   SELECT 'Paris' UNION ALL
+   SELECT 'Montreal' UNION ALL
+   SELECT 'New York' UNION ALL
+   SELECT NULL;
+
+SELECT 'Found Montreal' WHERE 'Montreal' IN (SELECT city from CITIES);
+SELECT 'Found Sidney' WHERE 'Sidney' IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York');
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York', NULL);
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal';
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal' AND 
'Sidney'<>null;
+
+SELECT city from CITIES WHERE city in (select city from CITIES);
+--SELECT 'Sidney Not Found' WHERE NOT EXISTS (SELECT 1/0 FROM CITIES WHERE 
CITY = 'Sidney');
+drop table CITIES;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'sqlitelogictest-select-not-in-wrong.Bug-6602` in directory 
'sql/test/BugTracker-2018` itself:
+
+
+# 21:00:27 >  
+# 21:00:27 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31602" "--set" 
"mapi_usock=/var/tmp/mtest-15721/.s.monetdb.31602" "--set" "monet_prompt=" 
"--forcemito" 

MonetDB: Mar2018 - Fix typo

2018-05-17 Thread Panagiotis Koutsourakis
Changeset: fb0bd0357e1f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb0bd0357e1f
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: Mar2018
Log Message:

Fix typo


diffs (12 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
@@ -1509,7 +1509,7 @@ sql_update_mar2018_sp1(Client c, mvc *sq
char *schema = stack_get_string(sql, "current_schema");
 
if (buf == NULL)
-   throw(SQL, "sql_update_dec2016_sp3", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   throw(SQL, "sql_update_mar2018_sp1", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos,
"set schema \"sys\";\n"
"drop function 
sys.dependencies_functions_os_triggers();\n"
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: remote_auth - Merge with default

2018-05-17 Thread Panagiotis Koutsourakis
Changeset: 2d3b6c5615b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2d3b6c5615b2
Added Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.out
Modified Files:
sql/backends/monet5/sql_upgrades.c

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
Branch: remote_auth
Log Message:

Merge with default


diffs (207 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
@@ -1509,7 +1509,7 @@ sql_update_mar2018_sp1(Client c, mvc *sq
char *schema = stack_get_string(sql, "current_schema");
 
if (buf == NULL)
-   throw(SQL, "sql_update_dec2016_sp3", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   throw(SQL, "sql_update_mar2018_sp1", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos,
"set schema \"sys\";\n"
"drop function 
sys.dependencies_functions_os_triggers();\n"
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
@@ -29,7 +29,7 @@ Ready.
 #ELSE NULL END ) AS BIGINT) AS col2;
 % .L14 # table_name
 % col2 # name
-% bigint # type
+% hugeint # type
 % 1 # length
 [ NULL ]
 
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
@@ -28,11 +28,11 @@ Ready.
 #INSERT INTO tab0 VALUES (97,1,99), (15,81,47), (87,21,10);
 [ 3]
 #SELECT ALL - ( - COUNT ( * ) ) FROM tab0 AS cor0 WHERE col0 / ( - + col2 ) 
NOT IN ( + + col0, + col0 * + ( col1 ), + ( + - col0 ) * - 45, + CAST ( NULL AS 
INTEGER ) );
-% sys.L34 # table_name
-% L34 # name
+% sys.L31 # table_name
+% L31 # name
 % bigint # type
 % 1 # length
-[ 3]
+[ 0]
 #DROP TABLE tab0;
 
 # 19:12:39 >  
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
@@ -2,3 +2,22 @@ CREATE TABLE tab2(col0 INTEGER, col1 INT
 INSERT INTO tab2 VALUES(64,77,40),(75,67,58),(46,51,23);
 SELECT * FROM tab2 WHERE + col2 NOT IN ( + - 59 + + ( 76 ), col1, + CAST ( 
NULL AS INTEGER ), col1, - 19, col1 );
 DROP TABLE tab2;
+
+CREATE TABLE CITIES(CITY varchar(50) NULL);
+INSERT INTO CITIES
+   SELECT 'Paris' UNION ALL
+   SELECT 'Montreal' UNION ALL
+   SELECT 'New York' UNION ALL
+   SELECT NULL;
+
+SELECT 'Found Montreal' WHERE 'Montreal' IN (SELECT city from CITIES);
+SELECT 'Found Sidney' WHERE 'Sidney' IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York');
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York', NULL);
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal';
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal' AND 
'Sidney'<>null;
+
+SELECT city from CITIES WHERE city in (select city from CITIES);
+--SELECT 'Sidney Not Found' WHERE NOT EXISTS (SELECT 1/0 FROM CITIES WHERE 
CITY = 'Sidney');
+drop table CITIES;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'sqlitelogictest-select-not-in-wrong.Bug-6602` in directory 
'sql/test/BugTracker-2018` itself:
+
+
+# 21:00:27 >  
+# 21:00:27 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31602" "--set" 
"mapi_usock=/var/tmp/mtest-15721/.s.monetdb.31602" "--set" "monet_prompt=" 
"--forcemito" 

MonetDB: remote_auth - Fix typo

2018-05-17 Thread Panagiotis Koutsourakis
Changeset: c67066874453 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c67066874453
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: remote_auth
Log Message:

Fix typo


diffs (12 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
@@ -1509,7 +1509,7 @@ sql_update_mar2018_sp1(Client c, mvc *sq
char *schema = stack_get_string(sql, "current_schema");
 
if (buf == NULL)
-   throw(SQL, "sql_update_dec2016_sp3", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   throw(SQL, "sql_update_mar2018_sp1", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos,
"set schema \"sys\";\n"
"drop function 
sys.dependencies_functions_os_triggers();\n"
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: remote_auth - Merge with Mar2018

2018-05-17 Thread Panagiotis Koutsourakis
Changeset: 14285c374de0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=14285c374de0
Added Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.out
Modified Files:
sql/backends/monet5/sql_upgrades.c

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
Branch: remote_auth
Log Message:

Merge with Mar2018


diffs (207 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
@@ -1509,7 +1509,7 @@ sql_update_mar2018_sp1(Client c, mvc *sq
char *schema = stack_get_string(sql, "current_schema");
 
if (buf == NULL)
-   throw(SQL, "sql_update_dec2016_sp3", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+   throw(SQL, "sql_update_mar2018_sp1", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
pos += snprintf(buf + pos, bufsize - pos,
"set schema \"sys\";\n"
"drop function 
sys.dependencies_functions_os_triggers();\n"
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
@@ -29,7 +29,7 @@ Ready.
 #ELSE NULL END ) AS BIGINT) AS col2;
 % .L14 # table_name
 % col2 # name
-% bigint # type
+% hugeint # type
 % 1 # length
 [ NULL ]
 
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
@@ -28,11 +28,11 @@ Ready.
 #INSERT INTO tab0 VALUES (97,1,99), (15,81,47), (87,21,10);
 [ 3]
 #SELECT ALL - ( - COUNT ( * ) ) FROM tab0 AS cor0 WHERE col0 / ( - + col2 ) 
NOT IN ( + + col0, + col0 * + ( col1 ), + ( + - col0 ) * - 45, + CAST ( NULL AS 
INTEGER ) );
-% sys.L34 # table_name
-% L34 # name
+% sys.L31 # table_name
+% L31 # name
 % bigint # type
 % 1 # length
-[ 3]
+[ 0]
 #DROP TABLE tab0;
 
 # 19:12:39 >  
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
@@ -2,3 +2,22 @@ CREATE TABLE tab2(col0 INTEGER, col1 INT
 INSERT INTO tab2 VALUES(64,77,40),(75,67,58),(46,51,23);
 SELECT * FROM tab2 WHERE + col2 NOT IN ( + - 59 + + ( 76 ), col1, + CAST ( 
NULL AS INTEGER ), col1, - 19, col1 );
 DROP TABLE tab2;
+
+CREATE TABLE CITIES(CITY varchar(50) NULL);
+INSERT INTO CITIES
+   SELECT 'Paris' UNION ALL
+   SELECT 'Montreal' UNION ALL
+   SELECT 'New York' UNION ALL
+   SELECT NULL;
+
+SELECT 'Found Montreal' WHERE 'Montreal' IN (SELECT city from CITIES);
+SELECT 'Found Sidney' WHERE 'Sidney' IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York');
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York', NULL);
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal';
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal' AND 
'Sidney'<>null;
+
+SELECT city from CITIES WHERE city in (select city from CITIES);
+--SELECT 'Sidney Not Found' WHERE NOT EXISTS (SELECT 1/0 FROM CITIES WHERE 
CITY = 'Sidney');
+drop table CITIES;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'sqlitelogictest-select-not-in-wrong.Bug-6602` in directory 
'sql/test/BugTracker-2018` itself:
+
+
+# 21:00:27 >  
+# 21:00:27 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31602" "--set" 
"mapi_usock=/var/tmp/mtest-15721/.s.monetdb.31602" "--set" "monet_prompt=" 
"--forcemito" 

MonetDB: merge-partitions - Do the proper validation for partiti...

2018-05-17 Thread Pedro Ferreira
Changeset: 94013ed66263 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94013ed66263
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_cat.c
sql/rel.txt
sql/server/rel_schema.c
sql/test/merge-partitions/Tests/mergepart03.stable.err
sql/test/merge-partitions/Tests/mergepart03.stable.out
sql/test/merge-partitions/Tests/mergepart04.stable.err
sql/test/merge-partitions/Tests/mergepart05.stable.err
sql/test/merge-partitions/Tests/mergepart07.stable.err
Branch: merge-partitions
Log Message:

Do the proper validation for partitions by range.

However I found another bug :(


diffs (truncated from 432 to 300 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4904,7 +4904,7 @@ rel2bin_exception(backend *be, sql_rel *
 {
stmt *l = NULL, *r = NULL;
node *n = NULL;
-   sql_exp *except = NULL;
+   list *slist = sa_list(be->mvc->sa);
 
if(find_prop(rel->p, PROP_DISTRIBUTE) && be->cur_append == 0) /* create 
affected rows accumulator */
create_merge_partitions_accumulator(be);
@@ -4914,16 +4914,17 @@ rel2bin_exception(backend *be, sql_rel *
 if (rel->r)  /* first construct the sub relation */
r = subrel_bin(be, rel->r, refs);
 
-   if(rel->exps && list_length(rel->exps) == 1) {
-   n = rel->exps->h;
-   except = n->data;
-   return exp_bin(be, except, l, r, NULL, NULL, NULL, NULL);
+   if(rel->exps) {
+   for(n = rel->exps->h; n; n = n->next) {
+   sql_exp *e = n->data;
+   stmt *s = exp_bin(be, e, l, r, NULL, NULL, NULL, NULL);
+   append(slist, s);
+   }
} else { //if there is no exception condition, just generate a 
statement list
-   list *slist = sa_list(be->mvc->sa);
list_append(slist, l);
list_append(slist, r);
-   return stmt_list(be, slist);
}
+   return stmt_list(be, slist);
 }
 
 static stmt *
diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c
--- a/sql/backends/monet5/sql_cat.c
+++ b/sql/backends/monet5/sql_cat.c
@@ -185,13 +185,12 @@ alter_table_add_range_partition(mvc *sql
sql_table *mt = NULL, *pt = NULL;
sql_part *err = NULL;
str msg = MAL_SUCCEED, err_min = NULL, err_max = NULL, escaped_min = 
NULL, escaped_max = NULL;
-   sql_column *col = NULL, *bcol = NULL;
-   BAT *diff1 = NULL, *diff2 = NULL, *cbind = NULL;
-   int tp1 = 0, errcode = 0, i = 0;
+   sql_column *col = NULL;
+   int tp1 = 0, errcode = 0;
ptr pmin = NULL, pmax = NULL;
size_t smin = 0, smax = 0, serr_min = 0, serr_max = 0;
ssize_t (*atomtostr)(str *, size_t *, const void *);
-   int accesses[3] = {RDONLY, RD_INS, RD_UPD_VAL}, free_pmin = 1, 
free_pmax = 1;
+   int free_pmin = 1, free_pmax = 1;
 
if((msg = validate_alter_table_add_table(sql, 
"sql.alter_table_add_range_partition", msname, mtname, psname, ptname, , 
))) {
return msg;
@@ -261,62 +260,6 @@ alter_table_add_range_partition(mvc *sql
goto finish;
}
 
-   bcol = mvc_bind_column(sql, pt, col->base.name);
-
-   for(i = 0 ; i < 3 ; i++) {
-   if(cbind) {
-   BBPunfix(cbind->batCacheid);
-   cbind = NULL;
-   }
-   if(diff1) {
-   BBPunfix(diff1->batCacheid);
-   diff1 = NULL;
-   }
-   if(diff2) {
-   BBPunfix(diff2->batCacheid);
-   diff2 = NULL;
-   }
-   if((cbind = store_funcs.bind_col(sql->session->tr, bcol, 
accesses[i])) == NULL) {
-   msg = 
createException(SQL,"sql.alter_table_add_range_partition",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-   goto finish;
-   }
-   if(!with_nills && cbind->tnil) {
-   msg = 
createException(SQL,"sql.alter_table_add_range_partition",SQLSTATE(42000)
-   "ALTER 
TABLE: there are null values in the column which is not allowed for this 
partition");
-   goto finish;
-   }
-   if(!pmin && !pmax) {
-   if((diff1 = BATselect(cbind, NULL, ATOMnilptr(tp1), 
NULL, 1, 1, 1)) == NULL) {
-   msg = 
createException(SQL,"sql.alter_table_add_range_partition",SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-   goto finish;
-   }
-   if(BATcount(diff1) > 0) {
-   msg = 

MonetDB: Mar2018 - added stable output for bug 6602 (and correct...

2018-05-17 Thread Niels Nes
Changeset: 1d3a15ef3aee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1d3a15ef3aee
Added Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.out
Modified Files:

sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out

sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
Branch: Mar2018
Log Message:

added stable output for bug 6602 (and correct for bugs 6530 and 6594)


diffs (195 lines):

diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-not-in.Bug-6594.stable.out
@@ -29,7 +29,7 @@ Ready.
 #ELSE NULL END ) AS BIGINT) AS col2;
 % .L14 # table_name
 % col2 # name
-% bigint # type
+% hugeint # type
 % 1 # length
 [ NULL ]
 
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-not-in-wrong-results.Bug-6530.stable.out
@@ -28,11 +28,11 @@ Ready.
 #INSERT INTO tab0 VALUES (97,1,99), (15,81,47), (87,21,10);
 [ 3]
 #SELECT ALL - ( - COUNT ( * ) ) FROM tab0 AS cor0 WHERE col0 / ( - + col2 ) 
NOT IN ( + + col0, + col0 * + ( col1 ), + ( + - col0 ) * - 45, + CAST ( NULL AS 
INTEGER ) );
-% sys.L34 # table_name
-% L34 # name
+% sys.L31 # table_name
+% L31 # name
 % bigint # type
 % 1 # length
-[ 3]
+[ 0]
 #DROP TABLE tab0;
 
 # 19:12:39 >  
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.sql
@@ -2,3 +2,22 @@ CREATE TABLE tab2(col0 INTEGER, col1 INT
 INSERT INTO tab2 VALUES(64,77,40),(75,67,58),(46,51,23);
 SELECT * FROM tab2 WHERE + col2 NOT IN ( + - 59 + + ( 76 ), col1, + CAST ( 
NULL AS INTEGER ), col1, - 19, col1 );
 DROP TABLE tab2;
+
+CREATE TABLE CITIES(CITY varchar(50) NULL);
+INSERT INTO CITIES
+   SELECT 'Paris' UNION ALL
+   SELECT 'Montreal' UNION ALL
+   SELECT 'New York' UNION ALL
+   SELECT NULL;
+
+SELECT 'Found Montreal' WHERE 'Montreal' IN (SELECT city from CITIES);
+SELECT 'Found Sidney' WHERE 'Sidney' IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN (SELECT city from CITIES);
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York');
+SELECT 'Sidney Not Found' WHERE 'Sidney' NOT IN ('Paris','Montreal','New 
York', NULL);
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal';
+SELECT 'Sidney Not Found' WHERE 'Sidney'<>'Paris' AND 'Sidney'<>'Montreal' AND 
'Sidney'<>null;
+
+SELECT city from CITIES WHERE city in (select city from CITIES);
+--SELECT 'Sidney Not Found' WHERE NOT EXISTS (SELECT 1/0 FROM CITIES WHERE 
CITY = 'Sidney');
+drop table CITIES;
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
new file mode 100644
--- /dev/null
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-select-not-in-wrong.Bug-6602.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'sqlitelogictest-select-not-in-wrong.Bug-6602` in directory 
'sql/test/BugTracker-2018` itself:
+
+
+# 21:00:27 >  
+# 21:00:27 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31602" "--set" 
"mapi_usock=/var/tmp/mtest-15721/.s.monetdb.31602" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/hrel/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2018"
 "--set" "embedded_c=true"
+# 21:00:27 >  
+
+# builtin opt  gdk_dbpath = 
/home/niels/scratch/rc-old/Linux-x86_64/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 = 31602
+# cmdline opt  mapi_usock =