MonetDB: default - Approved output

2020-12-04 Thread Pedro Ferreira
Changeset: 8b63f3fa7b41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b63f3fa7b41
Modified Files:
sql/test/analytics/Tests/analytics00.stable.out
Branch: default
Log Message:

Approved output


diffs (39 lines):

diff --git a/sql/test/analytics/Tests/analytics00.stable.out 
b/sql/test/analytics/Tests/analytics00.stable.out
--- a/sql/test/analytics/Tests/analytics00.stable.out
+++ b/sql/test/analytics/Tests/analytics00.stable.out
@@ -2066,7 +2066,7 @@ project (
 % .plan # table_name
 % rel # name
 % clob # type
-% 320 # length
+% 329 # length
 project (
 | project (
 | | project (
@@ -2074,7 +2074,7 @@ project (
 | | | | table(sys.myorders) [ "myorders"."o_totalprice" NOT NULL, 
"myorders"."o_orderdate" NOT NULL ] COUNT 
 | | | ) [ "myorders"."o_totalprice" NOT NULL, sys.day("myorders"."o_orderdate" 
NOT NULL) NOT NULL as "%1"."%1" ]
 | | ) [ "myorders"."o_totalprice" NOT NULL, "%1"."%1" NOT NULL ] [ "%1"."%1" 
ASC NOT NULL ]
-| ) [ "%1"."%1" NOT NULL, boolean "false" as "%2"."%2", 
sys.max("myorders"."o_totalprice" NOT NULL, "%2"."%2", sys.diff("%1"."%1" NOT 
NULL), int "1", sys.window_bound("%1"."%1" ASC NOT NULL, int "1", int "0", int 
"0", int "2"), sys.window_bound("%1"."%1" ASC NOT NULL, int "1", int "5", int 
"0", int "0")) as "%3"."%3" ]
+| ) [ "%1"."%1" NOT NULL, boolean "false" as "%2"."%2", 
sys.max("myorders"."o_totalprice" NOT NULL, "%2"."%2" NOT NULL, 
sys.diff("%1"."%1" NOT NULL), int "1", sys.window_bound("%1"."%1" ASC NOT NULL, 
int "1", int "0", int "0", int "2"), sys.window_bound("%1"."%1" ASC NOT NULL, 
int "1", int "5", int "0", int "0")) as "%3"."%3" ]
 ) [ "%3"."%3" ]
 #SELECT MAX(o_totalprice) OVER (ORDER BY EXTRACT(DAY FROM o_orderdate) RANGE 
BETWEEN 2 PRECEDING AND CURRENT ROW) FROM myorders;
 % sys.%3 # table_name
@@ -2087,7 +2087,7 @@ project (
 % .plan # table_name
 % rel # name
 % clob # type
-% 393 # length
+% 402 # length
 project (
 | project (
 | | project (
@@ -2095,7 +2095,7 @@ project (
 | | | | table(sys.myorders) [ "myorders"."o_totalprice" NOT NULL, 
"myorders"."o_orderdate" NOT NULL ] COUNT 
 | | | ) [ "myorders"."o_totalprice" NOT NULL, 
sys.year("myorders"."o_orderdate" NOT NULL) NOT NULL as "%1"."%1" ]
 | | ) [ "myorders"."o_totalprice" NOT NULL, "%1"."%1" NOT NULL ] [ "%1"."%1" 
ASC NOT NULL ]
-| ) [ "%1"."%1" NOT NULL, boolean "false" as "%2"."%2", sys.diff("%1"."%1" NOT 
NULL) as "%3"."%3", sys.count("myorders"."o_totalprice" NOT NULL, boolean 
"true", "%2"."%2", sys.diff("%1"."%1" NOT NULL) as "%3"."%3", int "2", 
sys.window_bound("%3"."%3", int "2", int "0", int "0", tinyint "2"), 
sys.window_bound("%3"."%3", int "2", int "3", int "0", bigint 
"9223372036854775807")) as "%4"."%4" ]
+| ) [ "%1"."%1" NOT NULL, boolean "false" as "%2"."%2", sys.diff("%1"."%1" NOT 
NULL) as "%3"."%3", sys.count("myorders"."o_totalprice" NOT NULL, boolean 
"true", "%2"."%2" NOT NULL, sys.diff("%1"."%1" NOT NULL) as "%3"."%3", int "2", 
sys.window_bound("%3"."%3", int "2", int "0", int "0", tinyint "2"), 
sys.window_bound("%3"."%3", int "2", int "3", int "0", bigint 
"9223372036854775807")) as "%4"."%4" ]
 ) [ "%4"."%4" ]
 #SELECT COUNT(o_totalprice) OVER (ORDER BY EXTRACT(YEAR FROM o_orderdate) 
GROUPS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING) FROM myorders;
 % sys.%4 # table_name
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - change test from 9999->10000 into year overflow...

2020-12-04 Thread Niels Nes
Changeset: 683de6848db7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=683de6848db7
Modified Files:
sql/test/BugTracker-2008/Tests/year_overflow_bug.SF-2075133.test
Branch: mtest
Log Message:

change test from ->1 into year overflow from 1999 -> 2000.
added comment that we do support this (out of spec) feature of more than 4 
digits years, but
that we only test 1999->2000 because other dbs and pymonetdb cannot handle this.


diffs (24 lines):

diff --git a/sql/test/BugTracker-2008/Tests/year_overflow_bug.SF-2075133.test 
b/sql/test/BugTracker-2008/Tests/year_overflow_bug.SF-2075133.test
--- a/sql/test/BugTracker-2008/Tests/year_overflow_bug.SF-2075133.test
+++ b/sql/test/BugTracker-2008/Tests/year_overflow_bug.SF-2075133.test
@@ -1,14 +1,18 @@
 statement ok
 CREATE TABLE A (a DATE)
 
+# Within a , the  shall contain four digits.
+# do see this a a feature (ie  -> 1)
+# but as pymonetdb and other db's don't support this we changed the test (not 
the code)
+
 statement ok
-INSERT INTO A VALUES ( DATE '-01-01' + INTERVAL '1-00' YEAR TO MONTH)
+INSERT INTO A VALUES ( DATE '1999-01-01' + INTERVAL '1-00' YEAR TO MONTH)
 
 query T nosort
 -- This currently is a limitation of pymonetdb
 select * from A
 
-1-01-01
+2000-01-01
 
 statement ok
 drop table a
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Oct2020 - More testing

2020-12-04 Thread Pedro Ferreira
Changeset: 020b46f0275f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=020b46f0275f
Modified Files:
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
Branch: Oct2020
Log Message:

More testing


diffs (70 lines):

diff --git a/sql/test/merge-partitions/Tests/mergepart30.sql 
b/sql/test/merge-partitions/Tests/mergepart30.sql
--- a/sql/test/merge-partitions/Tests/mergepart30.sql
+++ b/sql/test/merge-partitions/Tests/mergepart30.sql
@@ -106,10 +106,16 @@ ALTER TABLE table1 ADD TABLE another3 AS
 ALTER TABLE table1 ADD TABLE another4 AS PARTITION FOR NULL VALUES;
 
 ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM -100 TO -1; --error, 
conflicts with another1
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM RANGE MINVALUE TO -1; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM RANGE MINVALUE TO 0; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM RANGE MINVALUE TO 
RANGE MAXVALUE; --error, conflicts with another1
 ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 0 TO 0; --error, 
conflicts with another1
 ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 10 TO 10; --error, 
conflicts with another2
 ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 10 TO 11; --error, 
conflicts with another2
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 10 TO RANGE MAXVALUE; 
--error, conflicts with another2
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 20 TO RANGE MAXVALUE; 
--error, conflicts with another2
 ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 9 TO 10; --error, 
conflicts with another3
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 9 TO 10 WITH NULL 
VALUES; --error, conflicts with another3
 ALTER TABLE table1 ADD TABLE another5 AS PARTITION FOR NULL VALUES; --error, 
conflicts with another4
 
 ALTER TABLE table1 DROP TABLE another1;
diff --git a/sql/test/merge-partitions/Tests/mergepart30.stable.err 
b/sql/test/merge-partitions/Tests/mergepart30.stable.err
--- a/sql/test/merge-partitions/Tests/mergepart30.stable.err
+++ b/sql/test/merge-partitions/Tests/mergepart30.stable.err
@@ -109,7 +109,19 @@ MAPI  = (monetdb) /var/tmp/mtest-99796/.
 QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM -100 TO -1; 
--error, conflicts with another1
 ERROR = !ALTER TABLE: conflicting partitions: -100 to -1 and absolute min 
value to 0 from table sys.another1
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-131881/.s.monetdb.39742
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
+QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM RANGE MINVALUE 
TO -1; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: absolute min value to -1 and 
absolute min value to 0 from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
+QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM RANGE MINVALUE 
TO 0; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: absolute min value to 0 and 
absolute min value to 0 from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
+QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM RANGE MINVALUE 
TO RANGE MAXVALUE; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: absolute min value to absolute 
max value and absolute min value to 0 from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
 QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 0 TO 0; 
--error, conflicts with another1
 ERROR = !ALTER TABLE: conflicting partitions: 0 to 0 and absolute min value to 
0 from table sys.another1
 CODE  = 42000
@@ -121,11 +133,23 @@ MAPI  = (monetdb) /var/tmp/mtest-127940/
 QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 10 TO 11; 
--error, conflicts with another2
 ERROR = !ALTER TABLE: conflicting partitions: 10 to 11 and 10 to absolute max 
value from table sys.another2
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-27/.s.monetdb.37141
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
+QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 10 TO RANGE 
MAXVALUE; --error, conflicts with another2
+ERROR = !ALTER TABLE: conflicting partitions: 10 to absolute max value and 10 
to absolute max value from table sys.another2
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
+QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 20 TO RANGE 
MAXVALUE; --error, conflicts with another2
+ERROR = !ALTER TABLE: conflicting partitions: 20 to absolute max value and 10 
to absolute max value from table sys.another2
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-158968/.s.monetdb.39045
 QUERY = ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 9 

MonetDB: default - Merged with Oct2020

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

Merged with Oct2020


diffs (truncated from 703 to 300 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
@@ -9062,19 +9062,26 @@ rel_merge_table_rewrite(visitor *v, sql_

skip |= nskip;

}

} else { /* limit1 to limit2 (general case), 
limit2 is exclusive */
+   
bool max_differ_min = 
ATOMcmp(col->type.type->localtype, >data.val, >data.val) != 0;
+

if (lval) {

if (next->flag == cmp_equal) {
-   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, false, true) != 0 :
-   

 exp_range_overlap(rmin, rmax, lval, hval, false, true) == 0;
+   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, false, max_differ_min) != 0 :
+   

 exp_range_overlap(rmin, rmax, lval, hval, false, 
max_differ_min) == 0;

} else if (hval != lval) { /* 
For the between case */

comp_type higher = 
range2rcompare(next->flag);
-   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, true) != 0 :
-   

 exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, 
true) == 0;
+   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, max_differ_min) != 
0 :
+   

 exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, 
max_differ_min) == 0;

} else {

switch (next->flag) {

case cmp_gt:
+   
skip |= 
next->anti ? VALcmp(&(lval->data), &(rmax->data)) < 0 : VALcmp(&(lval->data), 
&(rmax->data)) >= 0;
+   
break;

case cmp_gte:
-   
skip |= 
next->anti ? VALcmp(&(lval->data), &(rmax->data)) < 0 : VALcmp(&(lval->data), 
&(rmax->data)) 

MonetDB: Oct2020 - Updated child elimination optimization for ra...

2020-12-04 Thread Pedro Ferreira
Changeset: fb7ffb6bcd79 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb7ffb6bcd79
Modified Files:
sql/server/rel_optimizer.c
sql/test/merge-partitions/Tests/mergepart31.sql
sql/test/merge-partitions/Tests/mergepart31.stable.out
Branch: Oct2020
Log Message:

Updated child elimination optimization for range partitions with identical min 
and max values


diffs (215 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
@@ -9121,19 +9121,26 @@ rel_merge_table_rewrite(visitor *v, sql_

skip |= nskip;

}

} else { /* limit1 to limit2 (general case), 
limit2 is exclusive */
+   
bool max_differ_min = 
ATOMcmp(col->type.type->localtype, >data.val, >data.val) != 0;
+

if (lval) {

if (next->flag == cmp_equal) {
-   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, false, true) != 0 :
-   

 exp_range_overlap(rmin, rmax, lval, hval, false, true) == 0;
+   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, false, max_differ_min) != 0 :
+   

 exp_range_overlap(rmin, rmax, lval, hval, false, 
max_differ_min) == 0;

} else if (hval != lval) { /* 
For the between case */

comp_type higher = 
range2rcompare(next->flag);
-   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, true) != 0 :
-   

 exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, 
true) == 0;
+   
skip |= next->anti ? 
exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, max_differ_min) != 
0 :
+   

 exp_range_overlap(rmin, rmax, lval, hval, higher == cmp_lt, 
max_differ_min) == 0;

} else {

switch (next->flag) {

case cmp_gt:
+   
skip |= 
next->anti ? VALcmp(&(lval->data), &(rmax->data)) < 0 : VALcmp(&(lval->data), 
&(rmax->data)) >= 0;
+   
break;

case cmp_gte:
-   
 

MonetDB: Oct2020 - Merged with Jun2020

2020-12-04 Thread Pedro Ferreira
Changeset: d80919e1bc62 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d80919e1bc62
Modified Files:
sql/server/rel_propagate.c
sql/storage/sql_catalog.c
sql/test/merge-partitions/Tests/All
sql/test/merge-partitions/Tests/mergepart01.stable.err
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (truncated from 488 to 300 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
@@ -160,7 +160,7 @@ generate_partition_limits(sql_query *que
 }
 
 static sql_rel*
-create_range_partition_anti_rel(sql_query* query, sql_table *mt, sql_table 
*pt, bit with_nills, sql_exp *pmin, sql_exp *pmax, bool all_ranges)
+create_range_partition_anti_rel(sql_query* query, sql_table *mt, sql_table 
*pt, bit with_nills, sql_exp *pmin, sql_exp *pmax, bool all_ranges, bool 
max_equal_min)
 {
mvc *sql = query->sql;
sql_rel *anti_rel;
@@ -184,14 +184,18 @@ create_range_partition_anti_rel(sql_quer
if (!(e1 = exp_check_type(sql, , NULL, e1, 
type_equal)))
return NULL;
 
-   e2 = exp_copy(sql, pmax);
-   if (!(e2 = exp_check_type(sql, , NULL, e2, 
type_equal)))
-   return NULL;
+   if (max_equal_min) {
+   anti_exp = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e1, cmp_notequal);
+   } else {
+   e2 = exp_copy(sql, pmax);
+   if (!(e2 = exp_check_type(sql, , NULL, e2, 
type_equal)))
+   return NULL;
 
-   range1 = exp_compare(sql->sa, exp_copy(sql, anti_le), 
e1, 3);
-   range2 = exp_compare(sql->sa, exp_copy(sql, anti_le), 
e2, 1);
-   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range1),
-   
list_append(new_exp_list(sql->sa), range2), 0);
+   range1 = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e1, cmp_lt);
+   range2 = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e2, cmp_gte);
+   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range1),
+   
list_append(new_exp_list(sql->sa), range2), 0);
+   }
}
if (!with_nills) {
anti_nils = exp_compare(sql->sa, anti_nils, 
exp_atom_bool(sql->sa, 1), cmp_equal);
@@ -277,17 +281,19 @@ propagate_validation_to_upper_tables(sql
int (*atomcmp)(const void *, const void *) = 
ATOMcompare(tpe);
const void *nil = ATOMnilptr(tpe);
sql_exp *e1 = NULL, *e2 = NULL;
-   bool found_all = false;
+   bool found_all = false, max_equal_min = false;
 
if (atomcmp(spt->part.range.minvalue, nil) != 0 
&& atomcmp(spt->part.range.maxvalue, nil) != 0) {
+   max_equal_min = 
ATOMcmp(spt->tpe.type->localtype, spt->part.range.maxvalue, 
spt->part.range.minvalue) == 0;
e1 = exp_atom(sql->sa, 
atom_general_ptr(sql->sa, >tpe, spt->part.range.minvalue));
-   e2 = exp_atom(sql->sa, 
atom_general_ptr(sql->sa, >tpe, spt->part.range.maxvalue));
+   if (!max_equal_min)
+   e2 = exp_atom(sql->sa, 
atom_general_ptr(sql->sa, >tpe, spt->part.range.maxvalue));
} else {
assert(spt->with_nills);
found_all = is_bit_nil(spt->with_nills);
}
if (!found_all || !spt->with_nills)
-   rel = rel_list(sql->sa, rel, 
create_range_partition_anti_rel(query, it->t, pt, spt->with_nills, e1, e2, 
false));
+   rel = rel_list(sql->sa, rel, 
create_range_partition_anti_rel(query, it->t, pt, spt->with_nills, e1, e2, 
false, max_equal_min));
} else if (isListPartitionTable(it->t)) {
list *exps = new_exp_list(sql->sa);
for (node *n = spt->part.values->h ; n ; n = 
n->next) {
@@ -357,7 +363,12 @@ rel_alter_table_add_partition_range(sql_
rel_psm->nrcols = 0;
 
if (!is_bit_nil(with_nills)) {
-   res = 

MonetDB: Jun2020 - Added validation for missing range case where...

2020-12-04 Thread Pedro Ferreira
Changeset: 44c3b6a5a577 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44c3b6a5a577
Added Files:
sql/test/merge-partitions/Tests/mergepart32.sql
sql/test/merge-partitions/Tests/mergepart32.stable.err
sql/test/merge-partitions/Tests/mergepart32.stable.out
Modified Files:
sql/server/rel_propagate.c
sql/storage/sql_catalog.c
sql/test/merge-partitions/Tests/All
sql/test/merge-partitions/Tests/mergepart01.sql
sql/test/merge-partitions/Tests/mergepart01.stable.err
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
Branch: Jun2020
Log Message:

Added validation for missing range case where the min and max values are the 
same


diffs (truncated from 399 to 300 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
@@ -166,7 +166,7 @@ generate_partition_limits(sql_query *que
 }
 
 static sql_rel*
-create_range_partition_anti_rel(sql_query* query, sql_table *mt, sql_table 
*pt, bit with_nills, sql_exp *pmin, sql_exp *pmax, bool all_ranges)
+create_range_partition_anti_rel(sql_query* query, sql_table *mt, sql_table 
*pt, bit with_nills, sql_exp *pmin, sql_exp *pmax, bool all_ranges, bool 
max_equal_min)
 {
mvc *sql = query->sql;
sql_rel *anti_rel;
@@ -190,14 +190,18 @@ create_range_partition_anti_rel(sql_quer
if (!(e1 = exp_check_type(sql, , NULL, e1, 
type_equal)))
return NULL;
 
-   e2 = exp_copy(sql, pmax);
-   if (!(e2 = exp_check_type(sql, , NULL, e2, 
type_equal)))
-   return NULL;
+   if (max_equal_min) {
+   anti_exp = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e1, cmp_notequal);
+   } else {
+   e2 = exp_copy(sql, pmax);
+   if (!(e2 = exp_check_type(sql, , NULL, e2, 
type_equal)))
+   return NULL;
 
-   range1 = exp_compare(sql->sa, exp_copy(sql, anti_le), 
e1, 3);
-   range2 = exp_compare(sql->sa, exp_copy(sql, anti_le), 
e2, 1);
-   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range1),
-   
list_append(new_exp_list(sql->sa), range2), 0);
+   range1 = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e1, cmp_lt);
+   range2 = exp_compare(sql->sa, exp_copy(sql, 
anti_le), e2, cmp_gte);
+   anti_exp = exp_or(sql->sa, 
list_append(new_exp_list(sql->sa), range1),
+   
list_append(new_exp_list(sql->sa), range2), 0);
+   }
}
if (!with_nills) {
anti_nils = exp_compare(sql->sa, anti_nils, 
exp_atom_bool(sql->sa, 1), cmp_equal);
@@ -284,17 +288,19 @@ propagate_validation_to_upper_tables(sql
int (*atomcmp)(const void *, const void *) = 
ATOMcompare(tpe);
const void *nil = ATOMnilptr(tpe);
sql_exp *e1 = NULL, *e2 = NULL;
-   bool found_all = false;
+   bool found_all = false, max_equal_min = false;
 
if (atomcmp(spt->part.range.minvalue, nil) != 0 
&& atomcmp(spt->part.range.maxvalue, nil) != 0) {
+   max_equal_min = 
ATOMcmp(spt->tpe.type->localtype, spt->part.range.maxvalue, 
spt->part.range.minvalue) == 0;
e1 = create_table_part_atom_exp(sql, 
spt->tpe, spt->part.range.minvalue);
-   e2 = create_table_part_atom_exp(sql, 
spt->tpe, spt->part.range.maxvalue);
+   if (!max_equal_min)
+   e2 = 
create_table_part_atom_exp(sql, spt->tpe, spt->part.range.maxvalue);
} else {
assert(spt->with_nills);
found_all = is_bit_nil(spt->with_nills);
}
if (!found_all || !spt->with_nills)
-   rel = rel_list(sql->sa, rel, 
create_range_partition_anti_rel(query, it->t, pt, spt->with_nills, e1, e2, 
false));
+   rel = rel_list(sql->sa, rel, 
create_range_partition_anti_rel(query, it->t, pt, spt->with_nills, e1, e2, 
false, max_equal_min));
} else if (isListPartitionTable(it->t)) {
list *exps 

MonetDB: mtest - clean up

2020-12-04 Thread svetlin
Changeset: 180e17d412a0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=180e17d412a0
Modified Files:
sql/test/BugTracker-2015/Tests/All
Branch: mtest
Log Message:

clean up


diffs (11 lines):

diff --git a/sql/test/BugTracker-2015/Tests/All 
b/sql/test/BugTracker-2015/Tests/All
--- a/sql/test/BugTracker-2015/Tests/All
+++ b/sql/test/BugTracker-2015/Tests/All
@@ -7,7 +7,6 @@ alter-table.Bug-3828-part2
 inet-ordering.Bug-3646
 sharp-alias.Bug-3467
 name_conflict.Bug-3650
-prepare_unop_crash.Bug-3653
 and_or_in.Bug-3655
 HAVE_PYMONETDB?acidity2-fail.Bug-3635
 inet-ordering.Bug-3660
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - merge heads

2020-12-04 Thread svetlin
Changeset: b3df92a7710c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3df92a7710c
Branch: mtest
Log Message:

merge heads


diffs (148 lines):

diff --git a/geom/BugTracker/Tests/copy_into_mbr.3492.test 
b/geom/BugTracker/Tests/copy_into_mbr.3492.test
--- a/geom/BugTracker/Tests/copy_into_mbr.3492.test
+++ b/geom/BugTracker/Tests/copy_into_mbr.3492.test
@@ -24,10 +24,10 @@ POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
 NULL
 2
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 3
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 4
 NULL
 NULL
@@ -43,13 +43,13 @@ SELECT * FROM geom ORDER BY id
 
 1
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 2
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 3
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 4
 NULL
 NULL
@@ -68,13 +68,13 @@ SELECT * FROM newgeom ORDER BY id
 
 1
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 2
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 3
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 4
 NULL
 NULL
diff --git a/geom/sql/functions/Tests/ST_MakeBox2D.test 
b/geom/sql/functions/Tests/ST_MakeBox2D.test
--- a/geom/sql/functions/Tests/ST_MakeBox2D.test
+++ b/geom/sql/functions/Tests/ST_MakeBox2D.test
@@ -1,7 +1,7 @@
 query T nosort
 select ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625), ST_Point(-987121.375 
,529933.1875))
 
-BOX (-989502.1875 528439.5625, -987121.375 529933.1875)
+BOX (-989502.187500 528439.562500, -987121.375000 529933.187500)
 
 query T rowsort
 select ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625), null)
@@ -21,65 +21,65 @@ query TT nosort
 SELECT geom AS "P", ST_MakeBox2D(geom, ST_Point(90, 90)) AS "BOX2D" FROM t
 
 POINT (10 20)
-BOX (10 20, 90 90)
+BOX (10.00 20.00, 90.00 90.00)
 POINT (30 40)
-BOX (30 40, 90 90)
+BOX (30.00 40.00, 90.00 90.00)
 POINT (50 60)
-BOX (50 60, 90 90)
+BOX (50.00 60.00, 90.00 90.00)
 POINT (70 80)
-BOX (70 80, 90 90)
+BOX (70.00 80.00, 90.00 90.00)
 
 query TTT nosort
 SELECT g1.geom AS "P1", g2.geom AS "P2", ST_MakeBox2D(g1.geom, g2.geom) AS 
"BOX2D" FROM t g1, t g2
 
 POINT (10 20)
 POINT (10 20)
-BOX (10 20, 10 20)
+BOX (10.00 20.00, 10.00 20.00)
 POINT (10 20)
 POINT (30 40)
-BOX (10 20, 30 40)
+BOX (10.00 20.00, 30.00 40.00)
 POINT (10 20)
 POINT (50 60)
-BOX (10 20, 50 60)
+BOX (10.00 20.00, 50.00 60.00)
 POINT (10 20)
 POINT (70 80)
-BOX (10 20, 70 80)
+BOX (10.00 20.00, 70.00 80.00)
 POINT (30 40)
 POINT (10 20)
-BOX (10 20, 30 40)
+BOX (10.00 20.00, 30.00 40.00)
 POINT (30 40)
 POINT (30 40)
-BOX (30 40, 30 40)
+BOX (30.00 40.00, 30.00 40.00)
 POINT (30 40)
 POINT (50 60)
-BOX (30 40, 50 60)
+BOX (30.00 40.00, 50.00 60.00)
 POINT (30 40)
 POINT (70 80)
-BOX (30 40, 70 80)
+BOX (30.00 40.00, 70.00 80.00)
 POINT (50 60)
 POINT (10 20)
-BOX (10 20, 50 60)
+BOX (10.00 20.00, 50.00 60.00)
 POINT (50 60)
 POINT (30 40)
-BOX (30 40, 50 60)
+BOX (30.00 40.00, 50.00 60.00)
 POINT (50 60)
 POINT (50 60)
-BOX (50 60, 50 60)
+BOX (50.00 60.00, 50.00 60.00)
 POINT (50 60)
 POINT (70 80)
-BOX (50 60, 70 80)
+BOX (50.00 60.00, 70.00 80.00)
 POINT (70 80)
 POINT (10 20)
-BOX (10 20, 70 80)
+BOX (10.00 20.00, 70.00 80.00)
 POINT (70 80)
 POINT (30 40)
-BOX (30 40, 70 80)
+BOX (30.00 40.00, 70.00 80.00)
 POINT (70 80)
 POINT (50 60)
-BOX (50 60, 70 80)
+BOX (50.00 60.00, 70.00 80.00)
 POINT (70 80)
 POINT (70 80)
-BOX (70 80, 70 80)
+BOX (70.00 80.00, 70.00 80.00)
 
 statement ok
 DROP TABLE t
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - move prepare_unop_crash

2020-12-04 Thread svetlin
Changeset: be73c6ef33f9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=be73c6ef33f9
Added Files:
sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.SQL.py
sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.sql
sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out
Modified Files:
sql/test/prepare/Tests/All
Branch: mtest
Log Message:

move prepare_unop_crash


diffs (74 lines):

diff --git a/sql/test/prepare/Tests/All b/sql/test/prepare/Tests/All
--- a/sql/test/prepare/Tests/All
+++ b/sql/test/prepare/Tests/All
@@ -1,3 +1,4 @@
 fixed_limit_for_prepare.Bug-3208
 prepare-complex
 prepare-smallint.Bug-3297
+prepare_unop_crash.Bug-3653
diff --git a/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.SQL.py 
b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.SQL.py
@@ -0,0 +1,11 @@
+from MonetDBtesting.sqltest import SQLTestCase
+
+qry = "PREPARE SELECT id FROM tables WHERE name = LOWER(?);"
+with SQLTestCase() as tc:
+# optional or default connection
+tc.connect()
+tc.execute(qry, client='mclient')\
+.assertSucceeded()\
+.assertMatchStableOut(fout='prepare_unop_crash.Bug-3653.stable.out')
+
+
diff --git a/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.sql 
b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.sql
@@ -0,0 +1,1 @@
+PREPARE SELECT id FROM tables WHERE name = LOWER(?);
diff --git a/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out 
b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out
@@ -0,0 +1,39 @@
+stdout of test 'prepare_unop_crash.Bug-3653` in directory 
'sql/test/BugTracker-2015` itself:
+
+
+# 08:58:48 >  
+# 08:58:48 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32270" "--set" 
"mapi_usock=/var/tmp/mtest-32037/.s.monetdb.32270" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2015"
 "--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 08:58:48 >  
+
+# MonetDB 5 server v11.19.8
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2015', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 7.333 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://localhost.nes.nl:32270/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-32037/.s.monetdb.32270
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+# MonetDB/R   module loaded
+
+
+# 08:58:49 >  
+# 08:58:49 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-32037" "--port=32270"
+# 08:58:49 >  
+
+#PREPARE SELECT id FROM tables WHERE name = LOWER(?);
+#PREPARE SELECT id FROM tables WHERE name = LOWER(?);
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
+% type,digits, scale,  schema, table,  column # name
+% varchar, int,int,str,str,str # type
+% 4,   2,  1,  0,  6,  2 # length
+[ "int",   32, 0,  "", "tables",   "id"]
+[ "clob",  0,  0,  NULL,   NULL,   NULL]
+
+# 08:58:49 >  
+# 08:58:49 >  "Done."
+# 08:58:49 >  
+
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - fixed test (MBRs output includes floats, with f...

2020-12-04 Thread Niels Nes
Changeset: c6b4e0d2375c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6b4e0d2375c
Modified Files:
geom/BugTracker/Tests/copy_into_mbr.3492.test
geom/sql/functions/Tests/ST_MakeBox2D.test
Branch: mtest
Log Message:

fixed test (MBRs output includes floats, with fixed 6 digits after the dot)
This is in mclient test formatter removed.


diffs (148 lines):

diff --git a/geom/BugTracker/Tests/copy_into_mbr.3492.test 
b/geom/BugTracker/Tests/copy_into_mbr.3492.test
--- a/geom/BugTracker/Tests/copy_into_mbr.3492.test
+++ b/geom/BugTracker/Tests/copy_into_mbr.3492.test
@@ -24,10 +24,10 @@ POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
 NULL
 2
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 3
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 4
 NULL
 NULL
@@ -43,13 +43,13 @@ SELECT * FROM geom ORDER BY id
 
 1
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 2
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 3
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 4
 NULL
 NULL
@@ -68,13 +68,13 @@ SELECT * FROM newgeom ORDER BY id
 
 1
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 2
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 3
 POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))
-BOX (1 2, 3 4)
+BOX (1.00 2.00, 3.00 4.00)
 4
 NULL
 NULL
diff --git a/geom/sql/functions/Tests/ST_MakeBox2D.test 
b/geom/sql/functions/Tests/ST_MakeBox2D.test
--- a/geom/sql/functions/Tests/ST_MakeBox2D.test
+++ b/geom/sql/functions/Tests/ST_MakeBox2D.test
@@ -1,7 +1,7 @@
 query T nosort
 select ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625), ST_Point(-987121.375 
,529933.1875))
 
-BOX (-989502.1875 528439.5625, -987121.375 529933.1875)
+BOX (-989502.187500 528439.562500, -987121.375000 529933.187500)
 
 query T rowsort
 select ST_MakeBox2D(ST_Point(-989502.1875, 528439.5625), null)
@@ -21,65 +21,65 @@ query TT nosort
 SELECT geom AS "P", ST_MakeBox2D(geom, ST_Point(90, 90)) AS "BOX2D" FROM t
 
 POINT (10 20)
-BOX (10 20, 90 90)
+BOX (10.00 20.00, 90.00 90.00)
 POINT (30 40)
-BOX (30 40, 90 90)
+BOX (30.00 40.00, 90.00 90.00)
 POINT (50 60)
-BOX (50 60, 90 90)
+BOX (50.00 60.00, 90.00 90.00)
 POINT (70 80)
-BOX (70 80, 90 90)
+BOX (70.00 80.00, 90.00 90.00)
 
 query TTT nosort
 SELECT g1.geom AS "P1", g2.geom AS "P2", ST_MakeBox2D(g1.geom, g2.geom) AS 
"BOX2D" FROM t g1, t g2
 
 POINT (10 20)
 POINT (10 20)
-BOX (10 20, 10 20)
+BOX (10.00 20.00, 10.00 20.00)
 POINT (10 20)
 POINT (30 40)
-BOX (10 20, 30 40)
+BOX (10.00 20.00, 30.00 40.00)
 POINT (10 20)
 POINT (50 60)
-BOX (10 20, 50 60)
+BOX (10.00 20.00, 50.00 60.00)
 POINT (10 20)
 POINT (70 80)
-BOX (10 20, 70 80)
+BOX (10.00 20.00, 70.00 80.00)
 POINT (30 40)
 POINT (10 20)
-BOX (10 20, 30 40)
+BOX (10.00 20.00, 30.00 40.00)
 POINT (30 40)
 POINT (30 40)
-BOX (30 40, 30 40)
+BOX (30.00 40.00, 30.00 40.00)
 POINT (30 40)
 POINT (50 60)
-BOX (30 40, 50 60)
+BOX (30.00 40.00, 50.00 60.00)
 POINT (30 40)
 POINT (70 80)
-BOX (30 40, 70 80)
+BOX (30.00 40.00, 70.00 80.00)
 POINT (50 60)
 POINT (10 20)
-BOX (10 20, 50 60)
+BOX (10.00 20.00, 50.00 60.00)
 POINT (50 60)
 POINT (30 40)
-BOX (30 40, 50 60)
+BOX (30.00 40.00, 50.00 60.00)
 POINT (50 60)
 POINT (50 60)
-BOX (50 60, 50 60)
+BOX (50.00 60.00, 50.00 60.00)
 POINT (50 60)
 POINT (70 80)
-BOX (50 60, 70 80)
+BOX (50.00 60.00, 70.00 80.00)
 POINT (70 80)
 POINT (10 20)
-BOX (10 20, 70 80)
+BOX (10.00 20.00, 70.00 80.00)
 POINT (70 80)
 POINT (30 40)
-BOX (30 40, 70 80)
+BOX (30.00 40.00, 70.00 80.00)
 POINT (70 80)
 POINT (50 60)
-BOX (50 60, 70 80)
+BOX (50.00 60.00, 70.00 80.00)
 POINT (70 80)
 POINT (70 80)
-BOX (70 80, 70 80)
+BOX (70.00 80.00, 70.00 80.00)
 
 statement ok
 DROP TABLE t
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - move prepare-smallint.Bug-3297

2020-12-04 Thread svetlin
Changeset: 3ca66fff56fd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3ca66fff56fd
Added Files:
sql/test/prepare/Tests/prepare-smallint.Bug-3297.SQL.py
sql/test/prepare/Tests/prepare-smallint.Bug-3297.sql
sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out
sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out.int128
Branch: mtest
Log Message:

move prepare-smallint.Bug-3297


diffs (197 lines):

diff --git a/sql/test/prepare/Tests/prepare-smallint.Bug-3297.SQL.py 
b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.SQL.py
@@ -0,0 +1,13 @@
+import os
+from MonetDBtesting.sqltest import SQLTestCase
+
+stableout = 'prepare-smallint.Bug-3297.stable.out.int128' if 
os.getenv('HAVE_HGE') else 'prepare-smallint.Bug-3297.stable.out'
+
+with SQLTestCase() as tc:
+# optional or default connection
+tc.connect()
+with open('prepare-smallint.Bug-3297.sql') as f:
+tc.execute(query=None, client='mclient', stdin=f)\
+.assertSucceeded()\
+.assertMatchStableOut(fout=stableout)
+
diff --git a/sql/test/prepare/Tests/prepare-smallint.Bug-3297.sql 
b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.sql
@@ -0,0 +1,14 @@
+CREATE TABLE ints ( val int );
+prepare INSERT INTO ints VALUES ( ? - 20 );
+exec **(1);
+exec **(10);
+exec **(100);
+exec **(1000);
+exec **(1);
+exec **(10);
+exec **(100);
+exec **(1000);
+exec **(1);
+exec **(10);
+select * from ints;
+drop table ints;
diff --git a/sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out 
b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out
@@ -0,0 +1,75 @@
+stdout of test 'prepare-smallint.Bug-3297` in directory 
'sql/test/BugTracker-2013` itself:
+
+
+# 20:19:33 >  
+# 20:19:33 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=35817" "--set" 
"mapi_usock=/var/tmp/mtest-25917/.s.monetdb.35817" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2013"
 "--set" "mal_listing=0"
+# 20:19:33 >  
+
+# MonetDB 5 server v11.15.4
+# This is an unreleased version
+# Serving database 'mTests_sql_test_BugTracker-2013', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 3.777 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on 
mapi:monetdb://niels.nesco.mine.nu:35817/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-25917/.s.monetdb.35817
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+
+# 20:19:34 >  
+# 20:19:34 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-25917" "--port=35817"
+# 20:19:34 >  
+
+#CREATE TABLE ints ( val int );
+#prepare INSERT INTO ints VALUES ( ? - 20 );
+#prepare INSERT INTO ints VALUES ( ? - 20 );
+% .prepare,.prepare,   .prepare,   .prepare,   .prepare,   
.prepare # table_name
+% type,digits, scale,  schema, table,  column # name
+% varchar, int,int,str,str,str # type
+% 6,   2,  1,  0,  0,  0 # length
+[ "bigint",64, 0,  NULL,   NULL,   NULL]
+#exec  5(1);
+[ 1]
+#exec  5(10);
+[ 1]
+#exec  5(100);
+[ 1]
+#exec  5(1000);
+[ 1]
+#exec  5(1);
+[ 1]
+#exec  5(10);
+[ 1]
+#exec  5(100);
+[ 1]
+#exec  5(1000);
+[ 1]
+#exec  5(1);
+[ 1]
+#exec  5(10);
+[ 1]
+#select * from ints;
+% sys.ints # table_name
+% val # name
+% int # type
+% 9 # length
+[ -19  ]
+[ -10  ]
+[ 80   ]
+[ 980  ]
+[ 9980 ]
+[ 99980]
+[ 80   ]
+[ 980  ]
+[ 9980 ]
+[ 99980]
+#drop table ints;
+
+# 20:19:34 >  
+# 20:19:34 >  "Done."
+# 20:19:34 >  
+
diff --git a/sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out.int128 
b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out.int128
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare-smallint.Bug-3297.stable.out.int128
@@ -0,0 +1,75 @@
+stdout of test 'prepare-smallint.Bug-3297` in directory 
'sql/test/BugTracker-2013` itself:
+
+
+# 20:19:33 >  
+# 20:19:33 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=35817" "--set" 
"mapi_usock=/var/tmp/mtest-25917/.s.monetdb.35817" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 

MonetDB: mtest - move prepare-smallint.Bug-3297

2020-12-04 Thread svetlin
Changeset: e3412e3d97f8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e3412e3d97f8
Modified Files:
sql/test/BugTracker-2013/Tests/All
sql/test/prepare/Tests/All
Branch: mtest
Log Message:

move prepare-smallint.Bug-3297


diffs (18 lines):

diff --git a/sql/test/BugTracker-2013/Tests/All 
b/sql/test/BugTracker-2013/Tests/All
--- a/sql/test/BugTracker-2013/Tests/All
+++ b/sql/test/BugTracker-2013/Tests/All
@@ -23,7 +23,6 @@ corrupt-after-restart.Bug-3282
 db_users.Bug-3287
 create_table_with_func.Bug-3286
 add_boolean.Bug-3289
-prepare-smallint.Bug-3297
 HAVE_PYMONETDB?psm_functions_and_accessrights.Bug-3300
 decimal-cast.Bug-3310
 hashed_exp.Bug-3313
diff --git a/sql/test/prepare/Tests/All b/sql/test/prepare/Tests/All
--- a/sql/test/prepare/Tests/All
+++ b/sql/test/prepare/Tests/All
@@ -1,2 +1,3 @@
 fixed_limit_for_prepare.Bug-3208
 prepare-complex
+prepare-smallint.Bug-3297
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - moved fixed_limit_for_prepare.Bug-3208 to prepare

2020-12-04 Thread svetlin
Changeset: c974c3bc350f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c974c3bc350f
Added Files:
sql/test/prepare/Tests/All
sql/test/prepare/Tests/SingleServer
sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py
sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.sql
sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.stable.out
sql/test/prepare/Tests/prepare-complex.SQL.py
sql/test/prepare/Tests/prepare-complex.stable.out
Modified Files:
sql/test/BugTracker-2012/Tests/All
Branch: mtest
Log Message:

moved fixed_limit_for_prepare.Bug-3208 to prepare


diffs (truncated from 387 to 300 lines):

diff --git a/sql/test/BugTracker-2012/Tests/All 
b/sql/test/BugTracker-2012/Tests/All
--- a/sql/test/BugTracker-2012/Tests/All
+++ b/sql/test/BugTracker-2012/Tests/All
@@ -79,7 +79,6 @@ update_crash.Bug-2655
 tuples_INTERSECT_vs_count_intersect_differs.Bug-2659
 large-number-operation-strange-results.Bug-2929
 inet-casts.Bug-3205
-fixed_limit_for_prepare.Bug-3208
 exp_bin_assertion.Bug-3209
 #querycache.Bug-3212
 url_script_test.Bug-2972
diff --git a/sql/test/prepare/Tests/All b/sql/test/prepare/Tests/All
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/All
@@ -0,0 +1,2 @@
+fixed_limit_for_prepare.Bug-3208
+prepare-complex
diff --git a/sql/test/prepare/Tests/SingleServer 
b/sql/test/prepare/Tests/SingleServer
new file mode 100644
diff --git a/sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py 
b/sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py
@@ -0,0 +1,11 @@
+import sys
+from MonetDBtesting.sqltest import SQLTestCase
+
+with SQLTestCase() as tc:
+# optional or default connection
+tc.connect()
+with open('fixed_limit_for_prepare.Bug-3208.sql') as f:
+tr = tc.execute(query=None, client='mclient', stdin=f)\
+.assertSucceeded()\
+
.assertMatchStableOut('fixed_limit_for_prepare.Bug-3208.stable.out')
+
diff --git a/sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.sql 
b/sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/fixed_limit_for_prepare.Bug-3208.sql
@@ -0,0 +1,69 @@
+CREATE TABLE wide("1" VARCHAR(255), "2" VARCHAR(255), "3" VARCHAR(255), "4"
+   VARCHAR(255), "5" VARCHAR(255), "6" VARCHAR(255), "7" VARCHAR(255), "8"
+   VARCHAR(255), "9" VARCHAR(255), "10" VARCHAR(255), "11" VARCHAR(255), 
"12"
+   VARCHAR(255), "13" VARCHAR(255), "14" VARCHAR(255), "15" VARCHAR(255), 
"16"
+   VARCHAR(255), "17" VARCHAR(255), "18" VARCHAR(255), "19" VARCHAR(255), 
"20"
+   VARCHAR(255), "21" VARCHAR(255), "22" VARCHAR(255), "23" VARCHAR(255), 
"24"
+   VARCHAR(255), "25" VARCHAR(255), "26" VARCHAR(255), "27" VARCHAR(255), 
"28"
+   VARCHAR(255), "29" VARCHAR(255), "30" VARCHAR(255), "31" VARCHAR(255), 
"32"
+   VARCHAR(255), "33" VARCHAR(255), "34" VARCHAR(255), "35" VARCHAR(255), 
"36"
+   VARCHAR(255), "37" VARCHAR(255), "38" VARCHAR(255), "39" VARCHAR(255), 
"40"
+   VARCHAR(255), "41" VARCHAR(255), "42" VARCHAR(255), "43" VARCHAR(255), 
"44"
+   VARCHAR(255), "45" VARCHAR(255), "46" VARCHAR(255), "47" VARCHAR(255), 
"48"
+   VARCHAR(255), "49" VARCHAR(255), "50" VARCHAR(255), "51" VARCHAR(255), 
"52"
+   VARCHAR(255), "53" VARCHAR(255), "54" VARCHAR(255), "55" VARCHAR(255), 
"56"
+   VARCHAR(255), "57" VARCHAR(255), "58" VARCHAR(255), "59" VARCHAR(255), 
"60"
+   VARCHAR(255), "61" VARCHAR(255), "62" VARCHAR(255), "63" VARCHAR(255), 
"64"
+   VARCHAR(255), "65" VARCHAR(255), "66" VARCHAR(255), "67" VARCHAR(255), 
"68"
+   VARCHAR(255), "69" VARCHAR(255), "70" VARCHAR(255), "71" VARCHAR(255), 
"72"
+   VARCHAR(255), "73" VARCHAR(255), "74" VARCHAR(255), "75" VARCHAR(255), 
"76"
+   VARCHAR(255), "77" VARCHAR(255), "78" VARCHAR(255), "79" VARCHAR(255), 
"80"
+   VARCHAR(255), "81" VARCHAR(255), "82" VARCHAR(255), "83" VARCHAR(255), 
"84"
+   VARCHAR(255), "85" VARCHAR(255), "86" VARCHAR(255), "87" VARCHAR(255), 
"88"
+   VARCHAR(255), "89" VARCHAR(255), "90" VARCHAR(255), "91" VARCHAR(255), 
"92"
+   VARCHAR(255), "93" VARCHAR(255), "94" VARCHAR(255), "95" VARCHAR(255), 
"96"
+   VARCHAR(255), "97" VARCHAR(255), "98" VARCHAR(255), "99" VARCHAR(255), 
"100"
+   VARCHAR(255), "101" VARCHAR(255), "102" VARCHAR(255), "103" 
VARCHAR(255), "104"
+   VARCHAR(255), "105" VARCHAR(255), "106" VARCHAR(255), "107" 
VARCHAR(255), "108"
+   VARCHAR(255), "109" VARCHAR(255), "110" VARCHAR(255), "111" 
VARCHAR(255), "112"
+   VARCHAR(255), "113" VARCHAR(255), "114" VARCHAR(255), "115" 
VARCHAR(255), "116"
+   VARCHAR(255), "117" VARCHAR(255), "118" VARCHAR(255), "119" 
VARCHAR(255), "120"
+   VARCHAR(255), "121" VARCHAR(255), "122" VARCHAR(255), 

MonetDB: Jun2020 - More testing

2020-12-04 Thread Pedro Ferreira
Changeset: a817478f956a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a817478f956a
Modified Files:
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
Branch: Jun2020
Log Message:

More testing


diffs (127 lines):

diff --git a/sql/test/merge-partitions/Tests/mergepart30.sql 
b/sql/test/merge-partitions/Tests/mergepart30.sql
--- a/sql/test/merge-partitions/Tests/mergepart30.sql
+++ b/sql/test/merge-partitions/Tests/mergepart30.sql
@@ -12,6 +12,9 @@ DROP TABLE table2;
 CREATE MERGE TABLE table1 (a int) PARTITION BY RANGE ON (a);
 CREATE TABLE another1 (a int);
 CREATE TABLE another2 (a int);
+CREATE TABLE another3 (a int);
+CREATE TABLE another4 (a int);
+CREATE TABLE another5 (a int);
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM RANGE MINVALUE TO 
RANGE MAXVALUE WITH NULL VALUES; --holds all
 INSERT INTO table1 VALUES (1), (NULL);
@@ -74,6 +77,8 @@ ALTER TABLE table1 DROP TABLE another2; 
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM RANGE MINVALUE TO 
RANGE MAXVALUE;
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 to 5; --error, 
conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE to 2; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 2 to RANGE MAXVALUE; 
--error, conflicts with another1
 SELECT a FROM table1;
 SELECT a FROM another1;
 SELECT a FROM another2;
@@ -85,14 +90,35 @@ TRUNCATE another2;
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM RANGE MINVALUE TO 2;
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE TO 1; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 TO 1; --error, 
conflicts with another1
 ALTER TABLE table1 DROP TABLE another1;
 ALTER TABLE table1 DROP TABLE another2; --error, not there
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM 2 TO RANGE MAXVALUE;
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 10 TO RANGE MAXVALUE; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 1 TO 3; --error, 
conflicts with another1
 ALTER TABLE table1 DROP TABLE another1;
 ALTER TABLE table1 DROP TABLE another2; --error, not there
 
+ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM RANGE MINVALUE TO 0;
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 10 TO RANGE MAXVALUE;
+ALTER TABLE table1 ADD TABLE another3 AS PARTITION FROM 0 TO 10;
+ALTER TABLE table1 ADD TABLE another4 AS PARTITION FOR NULL VALUES;
+
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM -100 TO -1; --error, 
conflicts with another1
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 10 TO 11; --error, 
conflicts with another2
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FROM 9 TO 10; --error, 
conflicts with another3
+ALTER TABLE table1 ADD TABLE another5 AS PARTITION FOR NULL VALUES; --error, 
conflicts with another4
+
+ALTER TABLE table1 DROP TABLE another1;
+ALTER TABLE table1 DROP TABLE another2;
+ALTER TABLE table1 DROP TABLE another3;
+ALTER TABLE table1 DROP TABLE another4;
+ALTER TABLE table1 DROP TABLE another5; --error, not there
+
 DROP TABLE another1;
 DROP TABLE another2;
+DROP TABLE another3;
+DROP TABLE another4;
+DROP TABLE another5;
 DROP TABLE table1;
diff --git a/sql/test/merge-partitions/Tests/mergepart30.stable.err 
b/sql/test/merge-partitions/Tests/mergepart30.stable.err
--- a/sql/test/merge-partitions/Tests/mergepart30.stable.err
+++ b/sql/test/merge-partitions/Tests/mergepart30.stable.err
@@ -69,7 +69,15 @@ MAPI  = (monetdb) /var/tmp/mtest-84239/.
 QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 to 5; 
--error, conflicts with another1
 ERROR = !ALTER TABLE: conflicting partitions: 0 to 5 and absolute min value to 
absolute max value from table sys.another1
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-84239/.s.monetdb.31974
+MAPI  = (monetdb) /var/tmp/mtest-99796/.s.monetdb.30680
+QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE 
to 2; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: absolute min value to 2 and 
absolute min value to absolute max value from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-99796/.s.monetdb.30680
+QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 2 to RANGE 
MAXVALUE; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: 2 to absolute max value and 
absolute min value to absolute max value from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-99796/.s.monetdb.30680
 QUERY = ALTER TABLE table1 DROP TABLE another2; --error, not there
 ERROR = !ALTER TABLE: table 'sys.another2' isn't part of RANGE PARTITION TABLE 
'sys.table1'
 CODE  = 42S02
@@ -77,7 +85,11 @@ MAPI  = (monetdb) /var/tmp/mtest-86521/.
 QUERY = ALTER TABLE table1 ADD TABLE 

MonetDB: mtest - fix remaining sql/test/BugTracker-2012

2020-12-04 Thread svetlin
Changeset: d604d30a8992 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d604d30a8992
Added Files:
sql/test/BugTracker-2012/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py
Branch: mtest
Log Message:

fix remaining sql/test/BugTracker-2012


diffs (18 lines):

diff --git 
a/sql/test/BugTracker-2012/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py 
b/sql/test/BugTracker-2012/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2012/Tests/fixed_limit_for_prepare.Bug-3208.SQL.py
@@ -0,0 +1,13 @@
+import sys
+from MonetDBtesting.sqltest import SQLTestCase
+
+with SQLTestCase() as tc:
+# optional or default connection
+tc.connect()
+with open('fixed_limit_for_prepare.Bug-3208.sql') as f:
+tr = tc.execute(query=None, client='mclient', stdin=f)\
+.assertSucceeded()\
+
.assertMatchStableOut('fixed_limit_for_prepare.Bug-3208.stable.out')
+# make it pass the old way with Mtest as well
+print(tr.data)
+
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - merged

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

merged


diffs (truncated from 854 to 300 lines):

diff --git a/sql/test/wlcr/Tests/All b/sql/test/wlcr/Tests/All
--- a/sql/test/wlcr/Tests/All
+++ b/sql/test/wlcr/Tests/All
@@ -1,41 +1,41 @@
 # This  is a scenario for continual replication
 # first create a master with some sample data
-wlcr00
-wlc01
-
-# check the log records without replication
-wlr01
-
-# create the first replica synchronized with the master
-wlr10
-
-# add two sets of tuples to the master
-wlc20
-wlc21
-
-# and automatically roll forward the clone in 2 steps
-wlr20
-
-# prepare an update to the master
-wlc30
+#wlcr00
+#wlc01
+#
+### check the log records without replication
+#wlr01
+#
+### create the first replica synchronized with the master
+#wlr10
+#
+### add two sets of tuples to the master
+#wlc20
+#wlc21
+#
+### and automatically roll forward the clone in 2 steps
+#wlr20
+#
+### prepare an update to the master
+#wlc30
+#
+### roll forward to clone
+#wlr30
+#
+### delete some tupples
+#wlc40
+#wlr35
+#wlr40
+#
+### clear the complete table
+#wlc50
+#wlr50
 
-# roll forward to clone
-wlr30
-
-# delete some tupples
-wlc40
-wlr35
-wlr40
+## restart for timing based roll forward
+#wlc70
+#wlr70
 
-# clear the complete table
-wlc50
-wlr50
-
-# restart for timing based roll forward
-wlc70
-wlr70
-
-# stop the master
-wlc100
-wlr100
-wlr110
+## stop the master
+#wlc100
+#wlr100
+#wlr110
diff --git a/sql/test/wlcr/Tests/wlc01.py b/sql/test/wlcr/Tests/wlc01.py
--- a/sql/test/wlcr/Tests/wlc01.py
+++ b/sql/test/wlcr/Tests/wlc01.py
@@ -1,40 +1,61 @@
+from MonetDBtesting.sqltest import SQLTestCase
 try:
 from MonetDBtesting import process
 except ImportError:
 import process
 import os, sys
 
-dbfarm = os.getenv('GDK_DBFARM')
-tstdb = os.getenv('TSTDB')
+DBFARM = os.getenv('GDK_DBFARM')
+TSTDB = os.getenv('TSTDB')
+MAPIPORT = os.getenv('MAPIPORT')
 
-if not tstdb or not dbfarm:
+if not TSTDB or not DBFARM:
 print('No TSTDB or GDK_DBFARM in environment')
 sys.exit(1)
 
-#clean up first
-dbname = tstdb
-
-with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as s, \
- process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as c:
-
-cout, cerr = c.communicate('''\
-call wlc.beat(0);
-call wlc.master();
-
-create table tmp0(i int, s string);
-insert into tmp0 values(1,'gaap'), (2,'sleep');
-drop table tmp0;
-create table tmp(i int, s string);
-insert into tmp values(1,'hello'), (2,'world');
-select * from tmp;
-''')
+with process.server(mapiport=MAPIPORT, dbname=TSTDB, stdout=process.PIPE, 
stderr=process.PIPE) as s:
+with SQLTestCase() as tc:
+tc.connect(database=TSTDB, port=MAPIPORT)
+tc.execute("""
+call wlc.beat(0);
+call wlc.master();""").assertSucceeded()
+tc.execute("create table tmp0(i int, s 
string);""").assertSucceeded()
+tc.execute("insert into tmp0 values(1,'gaap'), (2,'sleep');")\
+.assertSucceeded()\
+.assertRowCount(2)
+tc.execute("drop table tmp0;").assertSucceeded()
+tc.execute("create table tmp(i int, s string);").assertSucceeded()
+tc.execute("insert into tmp values(1,'hello'), (2,'world');")\
+.assertSucceeded()\
+.assertRowCount(2)
+tc.execute("select * from tmp;")\
+.assertSucceeded()\
+.assertRowCount(2)\
+.assertDataResultMatch(data=[(1, 'hello'), (2, 'world')])
 
 sout, serr = s.communicate()
 
-sys.stdout.write(sout)
-sys.stdout.write(cout)
-sys.stderr.write(serr)
-sys.stderr.write(cerr)
+#with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as s, \
+# process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as c:
+#
+#cout, cerr = c.communicate('''\
+#call wlc.beat(0);
+#call wlc.master();
+#
+#create table tmp0(i int, s string);
+#insert into tmp0 values(1,'gaap'), (2,'sleep');
+#drop table tmp0;
+#create table tmp(i int, s string);
+#insert into tmp values(1,'hello'), (2,'world');
+#select * from tmp;
+#''')
+#
+#sout, serr = s.communicate()
+#
+#sys.stdout.write(sout)
+#sys.stdout.write(cout)
+#sys.stderr.write(serr)
+#sys.stderr.write(cerr)
 
 def listfiles(path):
 sys.stdout.write("#LISTING OF THE LOG FILES\n")
@@ -52,6 +73,6 @@ def listfiles(path):
 except IOError:
 sys.stderr.write('Failure to read file ' + file + '\n')
 
-listfiles(os.path.join(dbfarm, tstdb))
-listfiles(os.path.join(dbfarm, tstdb, 'wlc_logs'))
+listfiles(os.path.join(DBFARM, TSTDB))
+listfiles(os.path.join(DBFARM, TSTDB, 'wlc_logs'))
 
diff --git a/sql/test/wlcr/Tests/wlc20.py 

MonetDB: mtest - add first test (moved from sqlancer07)

2020-12-04 Thread Niels Nes
Changeset: 713cba7ff571 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=713cba7ff571
Added Files:
sql/test/prepare/Tests/prepare-complex.sql
Branch: mtest
Log Message:

add first test (moved from sqlancer07)


diffs (12 lines):

diff --git a/sql/test/prepare/Tests/prepare-complex.sql 
b/sql/test/prepare/Tests/prepare-complex.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/prepare/Tests/prepare-complex.sql
@@ -0,0 +1,7 @@
+START TRANSACTION;
+CREATE TABLE "t0" ("c0" DATE,"c2" INTEGER);
+CREATE TABLE "t1" ("c1" TIMESTAMP,"c2" INTEGER);
+CREATE TABLE "t2" ("c0" DATE,"c1" TIMESTAMP,"c2" INTEGER);
+PREPARE (SELECT ?, t1.c2 FROM t1, t0 WHERE (SELECT DISTINCT (t1.c2) BETWEEN 
ASYMMETRIC (?) AND (t1.c2) FROM t1 CROSS JOIN 
+((SELECT DISTINCT 6.9089063E7, TRUE FROM t2 WHERE TRUE) EXCEPT (SELECT ALL 
0.4, FALSE FROM t2, t1 INNER JOIN t0 ON FALSE)) AS sub0 WHERE FALSE)) INTERSECT 
DISTINCT (SELECT DISTINCT 0.2, ? FROM t0, t2 WHERE ?);
+ROLLBACK;
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merged with Oct2020

2020-12-04 Thread Pedro Ferreira
Changeset: 03ef2f1eac20 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=03ef2f1eac20
Modified Files:
clients/mapilib/mapi.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_result.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: default
Log Message:

Merged with Oct2020


diffs (truncated from 1057 to 300 lines):

diff --git a/clients/mapilib/.editorconfig b/clients/mapilib/.editorconfig
new file mode 100644
--- /dev/null
+++ b/clients/mapilib/.editorconfig
@@ -0,0 +1,3 @@
+[*.{c,h}]
+tab_width = 8
+max_line_length = 72
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1524,8 +1524,7 @@ close_result(MapiHdl hdl)
   (hdl->npending_close > 0 && hdl->pending_close != NULL));
if (mid->active &&
(mid->active->active != result ||
-result->cache.tuplecount < result->row_count))
-   {
+result->cache.tuplecount < result->row_count)) {
/* results for which we got all tuples at the initial
 * response, need not to be closed as the server already
 * did that immediately */
@@ -1689,9 +1688,9 @@ mapi_next_result(MapiHdl hdl)
return MERROR;
if (hdl->result &&
(hdl->result->querytype == -1 ||
-/* basically exclude Q_PARSE and Q_BLOCK */
-(hdl->result->querytype >= Q_TABLE &&
- hdl->result->querytype <= Q_PREPARE) ||
+/* basically exclude Q_PARSE and Q_BLOCK */
+(hdl->result->querytype >= Q_TABLE &&
+ hdl->result->querytype <= Q_PREPARE) ||
 hdl->result->errorstr != NULL))
return 1;
}
@@ -1727,9 +1726,9 @@ mapi_more_results(MapiHdl hdl)
while (result->next) {
result = result->next;
if (result->querytype == -1 ||
-   /* basically exclude Q_PARSE and Q_BLOCK */
-   (hdl->result->querytype >= Q_TABLE &&
-hdl->result->querytype <= Q_PREPARE) ||
+   /* basically exclude Q_PARSE and Q_BLOCK */
+   (hdl->result->querytype >= Q_TABLE &&
+hdl->result->querytype <= Q_PREPARE) ||
result->errorstr != NULL)
return true;
}
@@ -2286,7 +2285,7 @@ mapi_reconnect(Mapi mid)
/* see comment above for why
 * we don't stat */
snprintf(buf, sizeof(buf),
-"%s/.s.monetdb.%d", 
host, MAPI_PORT);
+"%s/.s.monetdb.%d", host, 
MAPI_PORT);
host = buf;
}
 #endif
@@ -2479,12 +2478,12 @@ mapi_reconnect(Mapi mid)
closesocket(s);
}
snprintf(errbuf, sizeof(errbuf),
-"could not connect to %s:%s: %s",
-mid->hostname, port,
+"could not connect to %s:%s: %s",
+mid->hostname, port,
 #ifdef _MSC_VER
-wsaerror(WSAGetLastError())
+wsaerror(WSAGetLastError())
 #else
-strerror(errno)
+strerror(errno)
 #endif
);
}
@@ -2510,15 +2509,15 @@ mapi_reconnect(Mapi mid)
praddrlen = (socklen_t) sizeof(praddr.ss);
if (getsockname(s, (struct sockaddr *) , ) 
== 0 &&
getpeername(s, (struct sockaddr *) , ) 
== 0 &&
-   myaddr.ss.ss_family == praddr.ss.ss_family &&
-   (myaddr.ss.ss_family == AF_INET
-? myaddr.i4.sin_port == praddr.i4.sin_port
-: myaddr.i6.sin6_port == praddr.i6.sin6_port) &&
-   (myaddr.ss.ss_family == AF_INET
-? myaddr.i4.sin_addr.s_addr == 
praddr.i4.sin_addr.s_addr
-: memcmp(myaddr.i6.sin6_addr.s6_addr,
- praddr.i6.sin6_addr.s6_addr,
- sizeof(praddr.i6.sin6_addr.s6_addr)) 
== 0)) {
+   myaddr.ss.ss_family == praddr.ss.ss_family &&
+   (myaddr.ss.ss_family == AF_INET
+? myaddr.i4.sin_port == praddr.i4.sin_port
+: myaddr.i6.sin6_port == 

MonetDB: Oct2020 - More testing

2020-12-04 Thread Pedro Ferreira
Changeset: 1679a72b87dc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1679a72b87dc
Modified Files:
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
Branch: Oct2020
Log Message:

More testing


diffs (72 lines):

diff --git a/sql/test/merge-partitions/Tests/mergepart30.sql 
b/sql/test/merge-partitions/Tests/mergepart30.sql
--- a/sql/test/merge-partitions/Tests/mergepart30.sql
+++ b/sql/test/merge-partitions/Tests/mergepart30.sql
@@ -74,6 +74,8 @@ ALTER TABLE table1 DROP TABLE another2; 
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM RANGE MINVALUE TO 
RANGE MAXVALUE;
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 to 5; --error, 
conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE to 2; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 2 to RANGE MAXVALUE; 
--error, conflicts with another1
 SELECT a FROM table1;
 SELECT a FROM another1;
 SELECT a FROM another2;
@@ -85,11 +87,13 @@ TRUNCATE another2;
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM RANGE MINVALUE TO 2;
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE TO 1; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 TO 1; --error, 
conflicts with another1
 ALTER TABLE table1 DROP TABLE another1;
 ALTER TABLE table1 DROP TABLE another2; --error, not there
 
 ALTER TABLE table1 ADD TABLE another1 AS PARTITION FROM 2 TO RANGE MAXVALUE;
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 10 TO RANGE MAXVALUE; 
--error, conflicts with another1
+ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 1 TO 3; --error, 
conflicts with another1
 ALTER TABLE table1 DROP TABLE another1;
 ALTER TABLE table1 DROP TABLE another2; --error, not there
 
diff --git a/sql/test/merge-partitions/Tests/mergepart30.stable.err 
b/sql/test/merge-partitions/Tests/mergepart30.stable.err
--- a/sql/test/merge-partitions/Tests/mergepart30.stable.err
+++ b/sql/test/merge-partitions/Tests/mergepart30.stable.err
@@ -69,7 +69,15 @@ MAPI  = (monetdb) /var/tmp/mtest-84239/.
 QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 to 5; 
--error, conflicts with another1
 ERROR = !ALTER TABLE: conflicting partitions: 0 to 5 and absolute min value to 
absolute max value from table sys.another1
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-84239/.s.monetdb.31974
+MAPI  = (monetdb) /var/tmp/mtest-89788/.s.monetdb.36023
+QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE 
to 2; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: absolute min value to 2 and 
absolute min value to absolute max value from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-89788/.s.monetdb.36023
+QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 2 to RANGE 
MAXVALUE; --error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: 2 to absolute max value and 
absolute min value to absolute max value from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-89788/.s.monetdb.36023
 QUERY = ALTER TABLE table1 DROP TABLE another2; --error, not there
 ERROR = !ALTER TABLE: table 'sys.another2' isn't part of RANGE PARTITION TABLE 
'sys.table1'
 CODE  = 42S02
@@ -77,7 +85,11 @@ MAPI  = (monetdb) /var/tmp/mtest-86521/.
 QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM RANGE MINVALUE 
TO 1; --error, conflicts with another1
 ERROR = !ALTER TABLE: conflicting partitions: absolute min value to 1 and 
absolute min value to 2 from table sys.another1
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-86671/.s.monetdb.39443
+MAPI  = (monetdb) /var/tmp/mtest-89557/.s.monetdb.34879
+QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 0 TO 1; 
--error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: 0 to 1 and absolute min value to 
2 from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) /var/tmp/mtest-89557/.s.monetdb.34879
 QUERY = ALTER TABLE table1 DROP TABLE another2; --error, not there
 ERROR = !ALTER TABLE: table 'sys.another2' isn't part of RANGE PARTITION TABLE 
'sys.table1'
 CODE  = 42S02
@@ -85,7 +97,11 @@ MAPI  = (monetdb) /var/tmp/mtest-86671/.
 QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 10 TO RANGE 
MAXVALUE; --error, conflicts with another1
 ERROR = !ALTER TABLE: conflicting partitions: 10 to absolute max value and 2 
to absolute max value from table sys.another1
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-86671/.s.monetdb.39443
+MAPI  = (monetdb) /var/tmp/mtest-89557/.s.monetdb.34879
+QUERY = ALTER TABLE table1 ADD TABLE another2 AS PARTITION FROM 1 TO 3; 
--error, conflicts with another1
+ERROR = !ALTER TABLE: conflicting partitions: 1 to 3 and 2 to absolute max 
value from table sys.another1
+CODE  = 42000
+MAPI  = (monetdb) 

MonetDB: Oct2020 - Merged with Jun2020

2020-12-04 Thread Pedro Ferreira
Changeset: 253ebf64f0f3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=253ebf64f0f3
Modified Files:
sql/storage/sql_catalog.c
Branch: Oct2020
Log Message:

Merged with Jun2020


diffs (269 lines):

diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c
--- a/sql/storage/sql_catalog.c
+++ b/sql/storage/sql_catalog.c
@@ -453,44 +453,54 @@ sql_range_part_validate_and_insert(void 
sql_part* pt = (sql_part*) v1, *newp = (sql_part*) v2;
int res1, res2, tpe = pt->tpe.type->localtype;
const void *nil = ATOMnilptr(tpe);
-   bool pt_down_all = false, pt_upper_all = false;
+   bool pt_down_all = false, pt_upper_all = false, newp_down_all = false, 
newp_upper_all = false;
 
if (pt == newp) /* same pointer, skip (used in updates) */
return NULL;
 
assert(tpe == newp->tpe.type->localtype);
-   if (is_bit_nil(pt->with_nills)) //if one partition holds all including 
nills, then conflicts
+   if (is_bit_nil(pt->with_nills) || is_bit_nil(newp->with_nills)) /* if 
one partition holds all including nills, then conflicts */
return pt;
-   if (newp->with_nills && pt->with_nills) //only one partition at most 
has null values
+   if (newp->with_nills && pt->with_nills) /* only one partition at most 
has null values */
return pt;
 
pt_down_all = !ATOMcmp(tpe, nil, pt->part.range.minvalue);
pt_upper_all = !ATOMcmp(tpe, nil, pt->part.range.maxvalue);
+   newp_down_all = !ATOMcmp(tpe, nil, newp->part.range.minvalue);
+   newp_upper_all = !ATOMcmp(tpe, nil, newp->part.range.maxvalue);
 
-   if (pt_down_all || pt_upper_all) {
-   if (pt_down_all) {
-   if (pt->with_nills == true) /* only holds nils, allowed 
*/
-   return NULL;
-   if (pt_upper_all)  /* holds all range, conflicts if 
newp holds more than nills */
-   return newp->with_nills ? NULL : pt;
-   if (!ATOMcmp(tpe, nil, newp->part.range.minvalue) || 
ATOMcmp(tpe, pt->part.range.maxvalue, newp->part.range.minvalue) > 0)
-   return pt;
-   }
-   if (pt_upper_all) {
-   if (pt->with_nills == true) /* only holds nils, allowed 
*/
-   return NULL;
-   if (pt_down_all) /* holds all range, conflicts if newp 
holds more than nills */
-   return newp->with_nills ? NULL : pt;
-   if (!ATOMcmp(tpe, nil, newp->part.range.maxvalue) || 
ATOMcmp(tpe, newp->part.range.maxvalue, pt->part.range.minvalue) > 0)
-   return pt;
-   }
+   /* if one partition just holds NULL values, then there's no conflict */
+   if ((newp_down_all && newp_upper_all && newp->with_nills) || 
(pt_down_all && pt_upper_all && pt->with_nills))
+   return NULL;
+/* holds all range, will always conflict */
+   if ((pt_down_all && pt_upper_all && !pt->with_nills) || (newp_down_all 
&& newp_upper_all && !newp->with_nills))
+   return pt;
+
+   if (pt_down_all) { /* from range min value until a value */
+   if (newp_down_all || ATOMcmp(tpe, pt->part.range.maxvalue, 
newp->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (pt_upper_all) { /* from value until range max value */
+   if (newp_upper_all || ATOMcmp(tpe, newp->part.range.maxvalue, 
pt->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (newp_down_all) { /* from range min value until a value */
+   if (pt_down_all || ATOMcmp(tpe, newp->part.range.maxvalue, 
pt->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (newp_upper_all) { /* from value until range max value */
+   if (pt_upper_all || ATOMcmp(tpe, pt->part.range.maxvalue, 
newp->part.range.minvalue) > 0)
+   return pt;
return NULL;
}
 
/* Fallback into normal cases */
res1 = ATOMcmp(tpe, pt->part.range.minvalue, newp->part.range.maxvalue);
res2 = ATOMcmp(tpe, newp->part.range.minvalue, pt->part.range.maxvalue);
-   if (res1 < 0 && res2 < 0) //overlap: x1 < y2 && y1 < x2
+   if (res1 < 0 && res2 < 0) /* overlap: x1 < y2 && y1 < x2 */
return pt;
return NULL;
 }
diff --git a/sql/test/merge-partitions/Tests/mergepart30.sql 
b/sql/test/merge-partitions/Tests/mergepart30.sql
--- a/sql/test/merge-partitions/Tests/mergepart30.sql
+++ b/sql/test/merge-partitions/Tests/mergepart30.sql
@@ -42,7 +42,7 @@ ALTER TABLE table1 ADD TABLE another2 AS
 ALTER TABLE table1 ADD TABLE another2 AS PARTITION FOR NULL VALUES;
 
 TRUNCATE table1;
-INSERT 

MonetDB: Jun2020 - More missing range validation cases

2020-12-04 Thread Pedro Ferreira
Changeset: 3d326d9191b6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d326d9191b6
Modified Files:
sql/storage/sql_catalog.c
sql/test/merge-partitions/Tests/mergepart30.sql
sql/test/merge-partitions/Tests/mergepart30.stable.err
sql/test/merge-partitions/Tests/mergepart30.stable.out
Branch: Jun2020
Log Message:

More missing range validation cases


diffs (269 lines):

diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c
--- a/sql/storage/sql_catalog.c
+++ b/sql/storage/sql_catalog.c
@@ -464,44 +464,54 @@ sql_range_part_validate_and_insert(void 
sql_part* pt = (sql_part*) v1, *newp = (sql_part*) v2;
int res1, res2, tpe = pt->tpe.type->localtype;
const void *nil = ATOMnilptr(tpe);
-   bool pt_down_all = false, pt_upper_all = false;
+   bool pt_down_all = false, pt_upper_all = false, newp_down_all = false, 
newp_upper_all = false;
 
if (pt == newp) /* same pointer, skip (used in updates) */
return NULL;
 
assert(tpe == newp->tpe.type->localtype);
-   if (is_bit_nil(pt->with_nills)) //if one partition holds all including 
nills, then conflicts
+   if (is_bit_nil(pt->with_nills) || is_bit_nil(newp->with_nills)) /* if 
one partition holds all including nills, then conflicts */
return pt;
-   if (newp->with_nills && pt->with_nills) //only one partition at most 
has null values
+   if (newp->with_nills && pt->with_nills) /* only one partition at most 
has null values */
return pt;
 
pt_down_all = !ATOMcmp(tpe, nil, pt->part.range.minvalue);
pt_upper_all = !ATOMcmp(tpe, nil, pt->part.range.maxvalue);
+   newp_down_all = !ATOMcmp(tpe, nil, newp->part.range.minvalue);
+   newp_upper_all = !ATOMcmp(tpe, nil, newp->part.range.maxvalue);
 
-   if (pt_down_all || pt_upper_all) {
-   if (pt_down_all) {
-   if (pt->with_nills == true) /* only holds nils, allowed 
*/
-   return NULL;
-   if (pt_upper_all)  /* holds all range, conflicts if 
newp holds more than nills */
-   return newp->with_nills ? NULL : pt;
-   if (!ATOMcmp(tpe, nil, newp->part.range.minvalue) || 
ATOMcmp(tpe, pt->part.range.maxvalue, newp->part.range.minvalue) > 0)
-   return pt;
-   }
-   if (pt_upper_all) {
-   if (pt->with_nills == true) /* only holds nils, allowed 
*/
-   return NULL;
-   if (pt_down_all) /* holds all range, conflicts if newp 
holds more than nills */
-   return newp->with_nills ? NULL : pt;
-   if (!ATOMcmp(tpe, nil, newp->part.range.maxvalue) || 
ATOMcmp(tpe, newp->part.range.maxvalue, pt->part.range.minvalue) > 0)
-   return pt;
-   }
+   /* if one partition just holds NULL values, then there's no conflict */
+   if ((newp_down_all && newp_upper_all && newp->with_nills) || 
(pt_down_all && pt_upper_all && pt->with_nills))
+   return NULL;
+/* holds all range, will always conflict */
+   if ((pt_down_all && pt_upper_all && !pt->with_nills) || (newp_down_all 
&& newp_upper_all && !newp->with_nills))
+   return pt;
+
+   if (pt_down_all) { /* from range min value until a value */
+   if (newp_down_all || ATOMcmp(tpe, pt->part.range.maxvalue, 
newp->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (pt_upper_all) { /* from value until range max value */
+   if (newp_upper_all || ATOMcmp(tpe, newp->part.range.maxvalue, 
pt->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (newp_down_all) { /* from range min value until a value */
+   if (pt_down_all || ATOMcmp(tpe, newp->part.range.maxvalue, 
pt->part.range.minvalue) > 0)
+   return pt;
+   return NULL;
+   }
+   if (newp_upper_all) { /* from value until range max value */
+   if (pt_upper_all || ATOMcmp(tpe, pt->part.range.maxvalue, 
newp->part.range.minvalue) > 0)
+   return pt;
return NULL;
}
 
/* Fallback into normal cases */
res1 = ATOMcmp(tpe, pt->part.range.minvalue, newp->part.range.maxvalue);
res2 = ATOMcmp(tpe, newp->part.range.minvalue, pt->part.range.maxvalue);
-   if (res1 < 0 && res2 < 0) //overlap: x1 < y2 && y1 < x2
+   if (res1 < 0 && res2 < 0) /* overlap: x1 < y2 && y1 < x2 */
return pt;
return NULL;
 }
diff --git a/sql/test/merge-partitions/Tests/mergepart30.sql 
b/sql/test/merge-partitions/Tests/mergepart30.sql
--- a/sql/test/merge-partitions/Tests/mergepart30.sql
+++ 

MonetDB: mtest - sql/test/wlcr/ convert progress

2020-12-04 Thread svetlin
Changeset: a5c107747a47 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a5c107747a47
Modified Files:
sql/test/wlcr/Tests/All
sql/test/wlcr/Tests/wlc01.py
sql/test/wlcr/Tests/wlc20.py
sql/test/wlcr/Tests/wlc21.py
sql/test/wlcr/Tests/wlc30.py
sql/test/wlcr/Tests/wlc40.py
sql/test/wlcr/Tests/wlc50.py
sql/test/wlcr/Tests/wlr01.py
sql/test/wlcr/Tests/wlr20.py
sql/test/wlcr/Tests/wlr30.py
sql/test/wlcr/Tests/wlr35.py
sql/test/wlcr/Tests/wlr40.py
sql/test/wlcr/Tests/wlr50.py
Branch: mtest
Log Message:

sql/test/wlcr/ convert progress


diffs (truncated from 854 to 300 lines):

diff --git a/sql/test/wlcr/Tests/All b/sql/test/wlcr/Tests/All
--- a/sql/test/wlcr/Tests/All
+++ b/sql/test/wlcr/Tests/All
@@ -1,41 +1,41 @@
 # This  is a scenario for continual replication
 # first create a master with some sample data
-wlcr00
-wlc01
-
-# check the log records without replication
-wlr01
-
-# create the first replica synchronized with the master
-wlr10
-
-# add two sets of tuples to the master
-wlc20
-wlc21
-
-# and automatically roll forward the clone in 2 steps
-wlr20
-
-# prepare an update to the master
-wlc30
+#wlcr00
+#wlc01
+#
+### check the log records without replication
+#wlr01
+#
+### create the first replica synchronized with the master
+#wlr10
+#
+### add two sets of tuples to the master
+#wlc20
+#wlc21
+#
+### and automatically roll forward the clone in 2 steps
+#wlr20
+#
+### prepare an update to the master
+#wlc30
+#
+### roll forward to clone
+#wlr30
+#
+### delete some tupples
+#wlc40
+#wlr35
+#wlr40
+#
+### clear the complete table
+#wlc50
+#wlr50
 
-# roll forward to clone
-wlr30
-
-# delete some tupples
-wlc40
-wlr35
-wlr40
+## restart for timing based roll forward
+#wlc70
+#wlr70
 
-# clear the complete table
-wlc50
-wlr50
-
-# restart for timing based roll forward
-wlc70
-wlr70
-
-# stop the master
-wlc100
-wlr100
-wlr110
+## stop the master
+#wlc100
+#wlr100
+#wlr110
diff --git a/sql/test/wlcr/Tests/wlc01.py b/sql/test/wlcr/Tests/wlc01.py
--- a/sql/test/wlcr/Tests/wlc01.py
+++ b/sql/test/wlcr/Tests/wlc01.py
@@ -1,40 +1,61 @@
+from MonetDBtesting.sqltest import SQLTestCase
 try:
 from MonetDBtesting import process
 except ImportError:
 import process
 import os, sys
 
-dbfarm = os.getenv('GDK_DBFARM')
-tstdb = os.getenv('TSTDB')
+DBFARM = os.getenv('GDK_DBFARM')
+TSTDB = os.getenv('TSTDB')
+MAPIPORT = os.getenv('MAPIPORT')
 
-if not tstdb or not dbfarm:
+if not TSTDB or not DBFARM:
 print('No TSTDB or GDK_DBFARM in environment')
 sys.exit(1)
 
-#clean up first
-dbname = tstdb
-
-with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as s, \
- process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as c:
-
-cout, cerr = c.communicate('''\
-call wlc.beat(0);
-call wlc.master();
-
-create table tmp0(i int, s string);
-insert into tmp0 values(1,'gaap'), (2,'sleep');
-drop table tmp0;
-create table tmp(i int, s string);
-insert into tmp values(1,'hello'), (2,'world');
-select * from tmp;
-''')
+with process.server(mapiport=MAPIPORT, dbname=TSTDB, stdout=process.PIPE, 
stderr=process.PIPE) as s:
+with SQLTestCase() as tc:
+tc.connect(database=TSTDB, port=MAPIPORT)
+tc.execute("""
+call wlc.beat(0);
+call wlc.master();""").assertSucceeded()
+tc.execute("create table tmp0(i int, s 
string);""").assertSucceeded()
+tc.execute("insert into tmp0 values(1,'gaap'), (2,'sleep');")\
+.assertSucceeded()\
+.assertRowCount(2)
+tc.execute("drop table tmp0;").assertSucceeded()
+tc.execute("create table tmp(i int, s string);").assertSucceeded()
+tc.execute("insert into tmp values(1,'hello'), (2,'world');")\
+.assertSucceeded()\
+.assertRowCount(2)
+tc.execute("select * from tmp;")\
+.assertSucceeded()\
+.assertRowCount(2)\
+.assertDataResultMatch(data=[(1, 'hello'), (2, 'world')])
 
 sout, serr = s.communicate()
 
-sys.stdout.write(sout)
-sys.stdout.write(cout)
-sys.stderr.write(serr)
-sys.stderr.write(cerr)
+#with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as s, \
+# process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, 
stderr=process.PIPE) as c:
+#
+#cout, cerr = c.communicate('''\
+#call wlc.beat(0);
+#call wlc.master();
+#
+#create table tmp0(i int, s string);
+#insert into tmp0 values(1,'gaap'), (2,'sleep');
+#drop table tmp0;
+#create table tmp(i int, s string);
+#insert into tmp values(1,'hello'), (2,'world');
+#select * from tmp;
+#''')
+#
+#sout, serr = s.communicate()
+#
+#sys.stdout.write(sout)
+#

MonetDB: properties - Cleanup, properties should be orthogonal t...

2020-12-04 Thread Pedro Ferreira
Changeset: e9534d1efdbe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e9534d1efdbe
Added Files:
sql/server/rel_statistics.c
sql/server/rel_statistics.h
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_execute.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_upgrades.c
sql/server/CMakeLists.txt
sql/server/rel_dump.c
sql/server/rel_exp.c
sql/server/rel_exp.h
sql/server/rel_optimizer.c
sql/server/rel_optimizer.h
sql/server/rel_psm.c
sql/server/rel_rel.c
sql/server/rel_rel.h
sql/server/rel_schema.c
sql/server/rel_select.c
sql/server/rel_updates.c
sql/server/sql_mvc.c
sql/server/sql_mvc.h
sql/server/sql_partition.c
tools/monetdbe/monetdbe.c
Branch: properties
Log Message:

Cleanup, properties should be orthogonal to the SQL layer, so propagate them at 
rel_statistics


diffs (truncated from 1203 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
@@ -3579,7 +3579,7 @@ sql_parse(backend *be, const char *query
sql_rel *rel = rel_parse(be->mvc, be->mvc->session->schema, 
(char*)query, mode);
stmt *sq = NULL;
 
-   if ((rel = sql_processrelation(be->mvc, rel, 1)))
+   if ((rel = sql_processrelation(be->mvc, rel, 1, 1)))
sq = rel_bin(be, rel);
return sq;
 }
@@ -3815,15 +3815,8 @@ sql_stack_add_inserted( mvc *sql, const 
sql_exp *ne;
sql_column *c = n->data;
bool has_nils = c->null;
-   ValPtr min = NULL, max = NULL;
-
-   if (sql->storage_opt_allowed) {
-   if (has_nils && mvc_has_no_nil(sql, c))
-   has_nils = false;
-   min = mvc_has_min_value(sql, c);
-   max = mvc_has_max_value(sql, c);
-   }
-   ne = exp_column(sql->sa, name, c->base.name, >type, 
CARD_MULTI, has_nils, 0, min, max);
+
+   ne = exp_column(sql->sa, name, c->base.name, >type, 
CARD_MULTI, has_nils, 0);
append(exps, ne);
}
r = rel_table_func(sql->sa, NULL, NULL, exps, TRIGGER_WRAPPER);
@@ -4739,23 +4732,16 @@ sql_stack_add_updated(mvc *sql, const ch
for (n = t->columns.set->h; n; n = n->next) {
sql_column *c = n->data;
bool has_nils = c->null;
-   ValPtr min = NULL, max = NULL;
-
-   if (sql->storage_opt_allowed) {
-   if (has_nils && mvc_has_no_nil(sql, c))
-   has_nils = false;
-   min = mvc_has_min_value(sql, c);
-   max = mvc_has_max_value(sql, c);
-   }
+
if (updates[c->colnr]) {
-   sql_exp *oe = exp_column(sql->sa, on, c->base.name, 
>type, CARD_MULTI, has_nils, 0, min, max);
-   sql_exp *ne = exp_column(sql->sa, nn, c->base.name, 
>type, CARD_MULTI, has_nils, 0, min, max);
+   sql_exp *oe = exp_column(sql->sa, on, c->base.name, 
>type, CARD_MULTI, has_nils, 0);
+   sql_exp *ne = exp_column(sql->sa, nn, c->base.name, 
>type, CARD_MULTI, has_nils, 0);
 
append(exps, oe);
append(exps, ne);
} else {
-   sql_exp *oe = exp_column(sql->sa, on, c->base.name, 
>type, CARD_MULTI, has_nils, 0, min, max);
-   sql_exp *ne = exp_column(sql->sa, nn, c->base.name, 
>type, CARD_MULTI, has_nils, 0, min, max);
+   sql_exp *oe = exp_column(sql->sa, on, c->base.name, 
>type, CARD_MULTI, has_nils, 0);
+   sql_exp *ne = exp_column(sql->sa, nn, c->base.name, 
>type, CARD_MULTI, has_nils, 0);
 
append(exps, oe);
append(exps, ne);
@@ -5044,17 +5030,8 @@ sql_stack_add_deleted(mvc *sql, const ch
for (n = t->columns.set->h; n; n = n->next) {
sql_column *c = n->data;
bool has_nils = c->null;
-   ValPtr min = NULL, max = NULL;
-
-   if (sql->storage_opt_allowed) {
-   if (has_nils && mvc_has_no_nil(sql, c))
-   has_nils = false;
-   min = mvc_has_min_value(sql, c);
-   max = mvc_has_max_value(sql, c);
-   }
-   sql_exp *ne = exp_column(sql->sa, name, c->base.name, >type, 
CARD_MULTI, has_nils, 0, min, max);
-
-   append(exps, ne);
+
+   append(exps, exp_column(sql->sa, name, c->base.name, >type, 
CARD_MULTI, 

MonetDB: Oct2020 - merged with jun2020

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

merged with jun2020


diffs (141 lines):

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
@@ -541,6 +541,7 @@ mvc_bind(mvc *m, const char *sname, cons
return NULL;
 
b = store_funcs.bind_col(tr, c, access);
+   assert(b);
return b;
 }
 
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
@@ -2688,8 +2688,9 @@ static int
 update_table(sql_trans *tr, sql_table *ft, sql_table *tt)
 {
sql_trans *oldest = oldest_active_transaction();
+   sql_table *ot = NULL;
int ok = LOG_OK;
-   node *n, *m;
+   node *n, *m, *o = NULL;
 
if (ATOMIC_GET(_nr_active) == 1 || ft->base.allocated) {
if (ATOMIC_GET(_nr_active) > 1 && ft->data) { /* move 
delta */
@@ -2706,12 +2707,16 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
-   while (b && b->wtime >= oldest->stime)
-   b = b->next;
-   if (b && b->next) {
+   /* find table t->base.stime */
+ot = tr_find_table(oldest, tt);
+   if (b && ot && b->wtime < ot->base.stime) {
+   while (b && b->wtime >= ot->base.stime)
+   b = b->next;
/* anything older can go */
-   delayed_destroy_dbat(b->next);
-   b->next = NULL;
+   if (b && b->next && b->wtime < ot->base.stime) {
+   delayed_destroy_dbat(b->next);
+   b->next = NULL;
+   }
}
} else if (tt->data && ft->base.allocated) {
if (tr_update_dbat(tr, tt->data, ft->data) != LOG_OK)
@@ -2733,7 +2738,9 @@ update_table(sql_trans *tr, sql_table *f
ft->data = NULL;
}
}
-   for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n 
&& m; n = n->next, m = m->next) {
+   if (ot)
+   o = ot->columns.set->h;
+   for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n 
&& m; n = n->next, m = m->next, o=(o?o->next:NULL)) {
sql_column *cc = n->data; // TODO: either stick to to/from 
terminology or old/current terminology
sql_column *oc = m->data;
 
@@ -2741,6 +2748,7 @@ update_table(sql_trans *tr, sql_table *f
assert(!cc->base.wtime || oc->base.wtime < 
cc->base.wtime || (oc->base.wtime == cc->base.wtime && oc->base.allocated /* 
alter */));
if (ATOMIC_GET(_nr_active) > 1 && cc->data) { /* 
move delta */
sql_delta *b = cc->data;
+   sql_column *oldc = NULL;
 
if (!oc->data)
oc->base.allocated = cc->base.allocated;
@@ -2754,12 +2762,17 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
-   while (b && b->wtime >= oldest->stime)
-   b = b->next;
-   if (b && b->next) {
+   /* find column c->base.stime */
+if (o)
+   oldc = o->data;
+   if (oldc && b && oldc->base.id == cc->base.id 
&& b->wtime < oldc->base.stime) {
+   while (b && b->wtime >= 
oldc->base.stime)
+   b = b->next;
/* anything older can go */
-   delayed_destroy_bat(b->next);
-   b->next = NULL;
+   if (b && b->next && b->wtime < 
oldc->base.stime) {
+   delayed_destroy_bat(b->next);
+   b->next = NULL;
+   }
}
} else if (oc->data && cc->base.allocated) {
if (tr_update_delta(tr, oc->data, cc->data, 
cc->unique == 1) 

MonetDB: mtest - convert tests test_privs2_p1

2020-12-04 Thread Mitchell Weggemans
Changeset: 0e4012b4259f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0e4012b4259f
Modified Files:
sql/test/Users/Tests/test_privs2_p1.SQL.py
Branch: mtest
Log Message:

convert tests test_privs2_p1


diffs (142 lines):

diff --git a/sql/test/Users/Tests/test_privs2_p1.SQL.py 
b/sql/test/Users/Tests/test_privs2_p1.SQL.py
--- a/sql/test/Users/Tests/test_privs2_p1.SQL.py
+++ b/sql/test/Users/Tests/test_privs2_p1.SQL.py
@@ -3,70 +3,82 @@
 # on a table for which the USER has GRANTs (possible).
 ###
 
-import os, sys
-import pymonetdb
+from MonetDBtesting.sqltest import SQLTestCase
 
-db=os.getenv("TSTDB")
-port=int(os.getenv("MAPIPORT"))
-client = pymonetdb.connect(database=db, port=port, autocommit=True, 
user='my_user', password='p1')
-cursor = client.cursor()
+with SQLTestCase() as tc:
+tc.connect(username="my_user", password="p1")
+tc.execute("SELECT * FROM version").assertRowCount(1)
+tc.execute("insert into version (name, i) values ('test2', 
2)").assertSucceeded()
+tc.execute("SELECT insertversion('test3', 3)").assertSucceeded()
+tc.execute("SELECT updateversion('test1', 4)").assertSucceeded()
+tc.execute("SELECT * FROM version").assertRowCount(3)
+tc.execute("SELECT deleteversion('test1')").assertSucceeded()
+tc.execute("SELECT * FROM version").assertRowCount(2)
 
-def error(msg):
-print(msg)
-sys.exit(-1)
+# import os, sys
+# import pymonetdb
 
-nr=cursor.execute("SELECT * FROM version")
-if nr != 1:
-error("expected single row result from version")
-rows=cursor.fetchall()
-if rows[0][0] != 'test1':
-error("expected first row with 'test1'")
+# db=os.getenv("TSTDB")
+# port=int(os.getenv("MAPIPORT"))
+# client = pymonetdb.connect(database=db, port=port, autocommit=True, 
user='my_user', password='p1')
+# cursor = client.cursor()
+
+# def error(msg):
+# print(msg)
+# sys.exit(-1)
 
-rowaffected=cursor.execute("insert into version (name, i) values ('test2', 2)")
-if rowaffected != 1:
-error("expected single insert")
+# nr=cursor.execute("SELECT * FROM version")
+# if nr != 1:
+# error("expected single row result from version")
+# rows=cursor.fetchall()
+# if rows[0][0] != 'test1':
+# error("expected first row with 'test1'")
 
-nr=cursor.execute("SELECT insertversion('test3', 3)")
-if nr != 1:
-error("expected single row result from insertversion")
-rows=cursor.fetchall()
-if rows[0][0] != 1:
-error("expected first row with '1' not '%d'" % rows[0][0])
+# rowaffected=cursor.execute("insert into version (name, i) values ('test2', 
2)")
+# if rowaffected != 1:
+# error("expected single insert")
 
-nr=cursor.execute("SELECT * FROM version")
-if nr != 3:
-error("expected 3 rows")
-rows=cursor.fetchall()
-if rows[2][0] != 'test3':
-error("expected last row with 'test3'")
+# nr=cursor.execute("SELECT insertversion('test3', 3)")
+# if nr != 1:
+# error("expected single row result from insertversion")
+# rows=cursor.fetchall()
+# if rows[0][0] != 1:
+# error("expected first row with '1' not '%d'" % rows[0][0])
 
-nr=cursor.execute("SELECT updateversion('test1', 4)")
-if nr != 1:
-error("expected single row result from updateversion")
-rows=cursor.fetchall()
-if rows[0][0] != 1:
-error("expected first row with '1' not '%d'" % rows[0][0])
+# nr=cursor.execute("SELECT * FROM version")
+# if nr != 3:
+# error("expected 3 rows")
+# rows=cursor.fetchall()
+# if rows[2][0] != 'test3':
+# error("expected last row with 'test3'")
+
+# nr=cursor.execute("assertRowCount(1)")
+# if nr != 1:
+# error("expected single row result from updateversion")
+# rows=cursor.fetchall()
+# if rows[0][0] != 1:
+# error("expected first row with '1' not '%d'" % rows[0][0])
 
-nr=cursor.execute("SELECT * FROM version")
-if nr != 3:
-error("expected 3 rows")
-rows=cursor.fetchall()
-if rows[0][1] != 4:
-error("expected first row with updated value '4', not '%d'" % row[0][1])
+# nr=cursor.execute("SELECT * FROM version")
+# if nr != 3:
+# error("expected 3 rows")
+# rows=cursor.fetchall()
+# if rows[0][1] != 4:
+# error("expected first row with updated value '4', not '%d'" % row[0][1])
 
-nr=cursor.execute("SELECT deleteversion('test1')")
-if nr != 1:
-error("expected single row result from deleteversion")
-rows=cursor.fetchall()
-if rows[0][0] != 1:
-error("expected first row with '1' not '%d'" % rows[0][0])
+# nr=cursor.execute("SELECT deleteversion('test1')")
+# if nr != 1:
+# error("expected single row result from deleteversion")
+# rows=cursor.fetchall()
+# if rows[0][0] != 1:
+# error("expected first row with '1' not '%d'" % rows[0][0])
 
-nr=cursor.execute("SELECT * FROM version")
-if nr != 2:
-error("expected 2 rows")
-rows=cursor.fetchall()
-if rows[0][0] != 'test2':
-error("expected first row after delete to be 'test2'")
+# nr=cursor.execute("SELECT * FROM version")
+# if nr != 2:
+# error("expected 2 rows")
+# rows=cursor.fetchall()
+# if 

MonetDB: mtest - convert tests for test_privs2_p2

2020-12-04 Thread Mitchell Weggemans
Changeset: 603f37dc61f5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=603f37dc61f5
Modified Files:
sql/test/Users/Tests/test_privs2_p2.SQL.py
Branch: mtest
Log Message:

convert tests for test_privs2_p2


diffs (119 lines):

diff --git a/sql/test/Users/Tests/test_privs2_p2.SQL.py 
b/sql/test/Users/Tests/test_privs2_p2.SQL.py
--- a/sql/test/Users/Tests/test_privs2_p2.SQL.py
+++ b/sql/test/Users/Tests/test_privs2_p2.SQL.py
@@ -3,62 +3,71 @@
 # table for which the USER does *not* have GRANTs (not possible).
 ###
 
+from MonetDBtesting.sqltest import SQLTestCase
 
-import os, sys
-import pymonetdb
+with SQLTestCase() as tc:
+tc.connect(username="my_user2", password="p2")
+tc.execute("SELECT * FROM version").assertFailed()
+tc.execute("insert into version (name ,i) values ('test2' 
,2)").assertFailed()
+tc.execute("SELECT insertversion('test3', 3)").assertFailed()
+tc.execute("SELECT updateversion('test1', 4)").assertFailed()
+tc.execute("SELECT deleteversion('test1')").assertFailed()
+
+# import os, sys
+# import pymonetdb
 
 
-db=os.getenv("TSTDB")
-port=int(os.getenv("MAPIPORT"))
-client = pymonetdb.connect(database=db, port=port, autocommit=True, 
user='my_user2', password='p2')
-cursor = client.cursor()
+# db=os.getenv("TSTDB")
+# port=int(os.getenv("MAPIPORT"))
+# client = pymonetdb.connect(database=db, port=port, autocommit=True, 
user='my_user2', password='p2')
+# cursor = client.cursor()
 
-def sel1():
-err=0
-try:
-cursor.execute("SELECT * FROM version")
-except:
-err=1
-pass
-return err
+# def sel1():
+# err=0
+# try:
+# cursor.execute("SELECT * FROM version")
+# except:
+# err=1
+# pass
+# return err
 
-err = sel1()
+# err = sel1()
 
-try:
-cursor.execute("insert into version (name ,i) values ('test2' ,2)")
-except:
-err=err+2
-pass
+# try:
+# cursor.execute("insert into version (name ,i) values ('test2' ,2)")
+# except:
+# err=err+2
+# pass
 
-sel1()
+# sel1()
 
-try:
-cursor.execute("SELECT insertversion('test3', 3)")
-except:
-err=err+4
-pass
+# try:
+# cursor.execute("SELECT insertversion('test3', 3)")
+# except:
+# err=err+4
+# pass
 
-sel1()
+# sel1()
 
-try:
-cursor.execute("SELECT updateversion('test1', 4)")
-except:
-err=err+8
-pass
+# try:
+# cursor.execute("SELECT updateversion('test1', 4)")
+# except:
+# err=err+8
+# pass
 
-sel1()
+# sel1()
 
-try:
-cursor.execute("SELECT deleteversion('test1')")
-except:
-err=err+16
-pass
+# try:
+# cursor.execute("SELECT deleteversion('test1')")
+# except:
+# err=err+16
+# pass
 
-sel1()
+# sel1()
 
-if err != 31:
-print("User should have no access too this table\n")
-sys.exit(-1)
+# if err != 31:
+# print("User should have no access too this table\n")
+# sys.exit(-1)
 
-cursor.close()
-client.close()
+# cursor.close()
+# client.close()
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: mtest - convert tests for unknown_user

2020-12-04 Thread Mitchell Weggemans
Changeset: 7130f85de65b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7130f85de65b
Modified Files:
sql/test/Users/Tests/unknown_user.SQL.py
Branch: mtest
Log Message:

convert tests for unknown_user


diffs (52 lines):

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
@@ -2,23 +2,32 @@
 # Authenticate unknown USER (not possible).
 ###
 
-import sys,os
-import pymonetdb
+from MonetDBtesting.sqltest import SQLTestCase
+
+err_msg = "InvalidCredentialsException:checkCredentials:invalid credentials 
for user 'this_user_does_not_exist'".strip()
 
-import logging
+with SQLTestCase() as tc:
+tc.connect(username="this_user_does_not_exist", 
password="this_password_does_not_exist")
+tc.execute("SELECT * FROM sys;").assertFailed(err_message=err_msg)
+
 
-logging.basicConfig(level=logging.FATAL)
+# import sys,os
+# import pymonetdb
+
+# import logging
 
-error = False
-db=os.getenv("TSTDB")
-port=int(os.getenv("MAPIPORT"))
-try:
-client = pymonetdb.connect(database=db, port=port, autocommit=True,
-user='this_user_does_not_exist', 
password='this_password_does_not_exist')
-except pymonetdb.exceptions.DatabaseError:
-error = True
-pass
+# logging.basicConfig(level=logging.FATAL)
 
-if not error:
-print("Logged in with invalid credentials")
-sys.exit(-1)
+# error = False
+# db=os.getenv("TSTDB")
+# port=int(os.getenv("MAPIPORT"))
+# try:
+# client = pymonetdb.connect(database=db, port=port, autocommit=True,
+# user='this_user_does_not_exist', 
password='this_password_does_not_exist')
+# except pymonetdb.exceptions.DatabaseError:
+# error = True
+# pass
+
+# if not error:
+# print("Logged in with invalid credentials")
+# sys.exit(-1)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - only free sql objects when oldest reference o...

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

only free sql objects when oldest reference object is younger


diffs (119 lines):

diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -2689,8 +2689,9 @@ static int
 update_table(sql_trans *tr, sql_table *ft, sql_table *tt)
 {
sql_trans *oldest = oldest_active_transaction();
+   sql_table *ot = NULL;
int ok = LOG_OK;
-   node *n, *m;
+   node *n, *m, *o = NULL;
 
if (ATOMIC_GET(_nr_active) == 1 || ft->base.allocated) {
if (ATOMIC_GET(_nr_active) > 1 && ft->data) { /* move 
delta */
@@ -2707,12 +2708,16 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
-   while (b && b->wtime >= oldest->stime)
-   b = b->next;
-   if (b && b->next) {
+   /* find table t->base.stime */
+ot = tr_find_table(oldest, tt);
+   if (b && ot && b->wtime < ot->base.stime) {
+   while (b && b->wtime >= ot->base.stime)
+   b = b->next;
/* anything older can go */
-   delayed_destroy_dbat(b->next);
-   b->next = NULL;
+   if (b && b->next && b->wtime < ot->base.stime) {
+   delayed_destroy_dbat(b->next);
+   b->next = NULL;
+   }
}
} else if (tt->data && ft->base.allocated) {
if (tr_update_dbat(tr, tt->data, ft->data) != LOG_OK)
@@ -2734,7 +2739,9 @@ update_table(sql_trans *tr, sql_table *f
ft->data = NULL;
}
}
-   for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n 
&& m; n = n->next, m = m->next) {
+   if (ot)
+   o = ot->columns.set->h;
+   for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n 
&& m; n = n->next, m = m->next, o=(o?o->next:NULL)) {
sql_column *cc = n->data; // TODO: either stick to to/from 
terminology or old/current terminology
sql_column *oc = m->data;
 
@@ -2742,6 +2749,7 @@ update_table(sql_trans *tr, sql_table *f
assert(!cc->base.wtime || oc->base.wtime < 
cc->base.wtime || (oc->base.wtime == cc->base.wtime && oc->base.allocated /* 
alter */));
if (ATOMIC_GET(_nr_active) > 1 && cc->data) { /* 
move delta */
sql_delta *b = cc->data;
+   sql_column *oldc = NULL;
 
if (!oc->data)
oc->base.allocated = cc->base.allocated;
@@ -2755,12 +2763,17 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
-   while (b && b->wtime >= oldest->stime)
-   b = b->next;
-   if (b && b->next) {
+   /* find column c->base.stime */
+if (o)
+   oldc = o->data;
+   if (oldc && b && oldc->base.id == cc->base.id 
&& b->wtime < oldc->base.stime) {
+   while (b && b->wtime >= 
oldc->base.stime)
+   b = b->next;
/* anything older can go */
-   delayed_destroy_bat(b->next);
-   b->next = NULL;
+   if (b && b->next && b->wtime < 
oldc->base.stime) {
+   delayed_destroy_bat(b->next);
+   b->next = NULL;
+   }
}
} else if (oc->data && cc->base.allocated) {
if (tr_update_delta(tr, oc->data, cc->data, 
cc->unique == 1) != LOG_OK)
@@ -2813,7 +2826,9 @@ update_table(sql_trans *tr, sql_table *f
cc->base.allocated = 0;
}
if (ok == LOG_OK && tt->idxs.set) {
-   for (n = ft->idxs.set->h, m = tt->idxs.set->h; ok == LOG_OK && 
n && m; n = n->next, m = m->next) {
+   if (ot)
+   o = 

MonetDB: mtest - small fix

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

small fix


diffs (25 lines):

diff --git a/testing/sqltest.py b/testing/sqltest.py
--- a/testing/sqltest.py
+++ b/testing/sqltest.py
@@ -248,7 +248,7 @@ class TestCaseResult(object):
 index = i
 break
 if not sequence_match(data, self.data, index):
-msg = '{}\nexpected to match query result starting at index={}, 
but it didn\'t'.format(piped_representation(data), index)
+msg = '{}\nexpected to match query result starting at index={}, 
but it didn\'t'.format(piped_representation(data), index or 0)
 self.fail(msg, data=self.data)
 return self
 
@@ -380,9 +380,11 @@ class PyMonetDBTestResult(TestCaseResult
 if crs.description:
 self.data = crs.fetchall()
 self.description = crs.description
-except (pymonetdb.Error, ValueError) as e:
+except pymonetdb.Error as e:
 self.test_run_error = e
 self.err_code, self.err_message = 
self._parse_error(e.args[0])
+except (OSError, ValueError) as e:
+self.test_run_error = e
 self.did_run = True
 return self
 
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Jun2020 - make sure we initialize the parts

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

make sure we initialize the parts


diffs (11 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1858,6 +1858,7 @@ bootstrap_create_schema(sql_trans *tr, c
cs_new(>types, tr->sa, (fdestroy) NULL);
cs_new(>funcs, tr->sa, (fdestroy) NULL);
cs_new(>seqs, tr->sa, (fdestroy) NULL);
+   cs_new(>parts, tr->sa, (fdestroy) _destroy);
s->keys = list_new(tr->sa, (fdestroy) NULL);
s->idxs = list_new(tr->sa, (fdestroy) NULL);
s->triggers = list_new(tr->sa, (fdestroy) NULL);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: properties - Read and cache min/max values when type an...

2020-12-04 Thread Sjoerd Mullender
Changeset: c3e306ad455c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c3e306ad455c
Modified Files:
gdk/gdk_bbp.c
Branch: properties
Log Message:

Read and cache min/max values when type and position is known during startup.


diffs (32 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -991,6 +991,28 @@ BBPreadEntries(FILE *fp, unsigned bbpver
BBP_lrefs(bid) = 1; /* any BAT we encounter here is 
persistent, so has a logical reference */
BBP_desc(bid) = bn;
BBP_status(bid) = BBPEXISTING;  /* do we need other status 
bits? */
+   bool loaded = false;
+   PROPrec *p;
+   if (bn->ttype >= 0 && (p = BATgetprop(bn, GDK_MIN_POS)) != 
NULL) {
+   /* for known types cache the value corresponding to the
+* position */
+   if ((bn = BATdescriptor(bn->batCacheid)) != NULL) {
+   loaded = true;
+   BATiter bi = bat_iterator(bn);
+   BATsetprop(bn, GDK_MIN_VALUE, bn->ttype, 
BUNtail(bi, p->v.val.oval));
+   }
+   }
+   if (bn->ttype >= 0 && (p = BATgetprop(bn, GDK_MAX_POS)) != 
NULL) {
+   /* for known types cache the value corresponding to the
+* position */
+   if (loaded || (bn = BATdescriptor(bn->batCacheid)) != 
NULL) {
+   loaded = true;
+   BATiter bi = bat_iterator(bn);
+   BATsetprop(bn, GDK_MAX_VALUE, bn->ttype, 
BUNtail(bi, p->v.val.oval));
+   }
+   }
+   if (loaded)
+   BBPunfix(bn->batCacheid);
}
return GDK_SUCCEED;
 }
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list