MonetDB: Oct2020 - Added test and expected stable.{out,err} for ...
Changeset: 2624f6098f4f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2624f6098f4f Added Files: sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out Modified Files: sql/test/BugTracker-2020/Tests/All Branch: Oct2020 Log Message: Added test and expected stable.{out,err} for Bug-7020 diffs (114 lines): diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -33,3 +33,4 @@ drop-stream-table.Bug-7005 deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 +release_old_savepoint.Bug-7020 diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql @@ -0,0 +1,18 @@ +start transaction; + +create table savepointtest (id int, primary key(id)); +savepoint name1; + +insert into savepointtest values(1), (2), (3); +select * from savepointtest; +savepoint name2; + +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +select * from savepointtest; +savepoint name3; + +release savepoint name1; +select * from savepointtest; +commit; + diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err @@ -0,0 +1,12 @@ +stderr of test 'release_old_savepoint.Bug-7020` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:05:47 > +# 09:05:47 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-141551" "--port=39186" +# 09:05:47 > + + +# 09:05:47 > +# 09:05:47 > "Done." +# 09:05:47 > + diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out @@ -0,0 +1,61 @@ +stdout of test 'release_old_savepoint.Bug-7020` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:05:47 > +# 09:05:47 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-141551" "--port=39186" +# 09:05:47 > + +#start transaction; +#create table savepointtest (id int, primary key(id)); +#savepoint name1; +#insert into savepointtest values(1), (2), (3); +[ 3] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +#savepoint name2; +#insert into savepointtest values(4), (5), (6); +[ 3] +#insert into savepointtest values(7), (8), (9); +[ 3] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +[ 4] +[ 5] +[ 6] +[ 7] +[ 8] +[ 9] +#savepoint name3; +#release savepoint name1; +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +[ 4] +[ 5] +[ 6] +[ 7] +[ 8] +[ 9] +#commit; + +# 09:05:47 > +# 09:05:47 > "Done." +# 09:05:47 > + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - removed assert, we could have not 'bat' stora...
Changeset: c78dc8d4a66a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c78dc8d4a66a Modified Files: sql/backends/monet5/sql.c Branch: Jun2020 Log Message: removed assert, we could have not 'bat' storage in case of empty merge-tables diffs (11 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 @@ -619,7 +619,6 @@ mvc_bind(mvc *m, const char *sname, cons return NULL; b = store_funcs.bind_col(tr, c, access); - assert(b); return b; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - compilation fix
Changeset: 3e04c3c83306 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3e04c3c83306 Modified Files: sql/backends/monet5/sql_subquery.c Branch: Jun2020 Log Message: compilation fix diffs (12 lines): diff --git a/sql/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -121,7 +121,7 @@ SQLall(ptr ret, const bat *bid) { BAT *b; BUN c, _s; - const void *p; + const void *p = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(SQL, "sql.all", SQLSTATE(HY005) "Cannot access column descriptor"); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - merged
Changeset: 3165455501ef for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3165455501ef Branch: Jun2020 Log Message: merged diffs (truncated from 666 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, &tpe, NULL, e1, type_equal))) return NULL; - e2 = exp_copy(sql, pmax); - if (!(e2 = exp_check_type(sql, &tpe, 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, &tpe, 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 = new_exp_list(sql->sa); for (node *n = spt->part.values->h ; n ; n = n->next) { @@ -364,7 +370,12 @@ rel_alter_table_add_partition_range(sql_ rel_psm->nrcols = 0; if (!is_bit_nil(with_nills)) { - res = create_range_partition_anti_rel(query, mt, pt, with_nills, (min && max) ? pmin : NULL, (min && max) ? pmax : NULL, all_ranges); + bool min_max_equal = false; + if (pmin && pmax && pmin->type == e_atom && pmax->type == e_atom && pmin->l && pmax->l) { + atom *e1 = pmin->l, *e2 = pmax->l; +
MonetDB: Oct2020 - small test changes
Changeset: 1ccf8e6243aa for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1ccf8e6243aa Modified Files: sql/test/Skyserver/run.all sql/test/Skyserver/runv6.all Branch: Oct2020 Log Message: small test changes diffs (94 lines): diff --git a/sql/test/Skyserver/run.all b/sql/test/Skyserver/run.all --- a/sql/test/Skyserver/run.all +++ b/sql/test/Skyserver/run.all @@ -32,9 +32,19 @@ EOF echo tables $SQL < Skyserver_tables.sql +cat << EOF > .monetdb +user=monetdb +password=monetdb +EOF + echo loading cat Skyserver_import.sql | sed -e "s|DATA|$PWD/microsky|g" | $SQL +cat << EOF > .monetdb +user=skyserver +password=skyserver +EOF + echo Constraints $SQL < Skyserver_constraints.sql @@ -46,8 +56,6 @@ echo functions echo Cleanup $SQL < Skyserver_dropFunctions.sql -$SQL < Skyserver_dropMs_functions.sql -$SQL < Skyserver_dropMath.sql $SQL < Skyserver_dropViews.sql $SQL < Skyserver_dropConstraints.sql $SQL < Skyserver_dropTables.sql diff --git a/sql/test/Skyserver/runv6.all b/sql/test/Skyserver/runv6.all --- a/sql/test/Skyserver/runv6.all +++ b/sql/test/Skyserver/runv6.all @@ -17,11 +17,36 @@ fi #Bulk-Load into SQL server... +cat << EOF > .monetdb +user=monetdb +password=monetdb +EOF + echo Create User $SQL < create_user.sql +cat << EOF > .monetdb +user=skyserver +password=skyserver +EOF + echo tables $SQL1 < Skyserver_tables_v6.sql + +cat << EOF > .monetdb +user=monetdb +password=monetdb +EOF + +echo loading +cat Skyserver_import_v6.sql | sed -e "s|DATA_DIR|$PWD/microsky_v6|g" | $SQL + +cat << EOF > .monetdb +user=skyserver +password=skyserver +EOF + +echo Constraints $SQL1 < Skyserver_constraints_v6.sql echo views @@ -30,14 +55,18 @@ echo views echo functions $SQL1 < Skyserver_functions_v6.sql -exit echo Cleanup $SQL1 < Skyserver_dropFunctions_v6.sql -$SQL1 < Skyserver_dropMs_functions.sql -$SQL1 < Skyserver_dropMath.sql $SQL1 < Skyserver_dropViews_v6.sql $SQL1 < Skyserver_dropConstraints_v6.sql $SQL1 < Skyserver_dropTables_v6.sql +cat << EOF > .monetdb +user=monetdb +password=monetdb +EOF + echo Remove User $SQL < drop_user.sql + +rm -f .monetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - add assert, checking leaks
Changeset: b8e33c7b15f6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b8e33c7b15f6 Modified Files: gdk/gdk_logger.c Branch: Oct2020 Log Message: add assert, checking leaks diffs (11 lines): diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -3182,6 +3182,7 @@ bm_commit(logger *lg, lng save_id) return GDK_FAIL; } BBPrelease(bid); + assert(BBP_lrefs(bid)<=0 && BBP_refs(bid)==0); } if (leftover) { nfreed = logbat_new(TYPE_int, leftover, TRANSIENT); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - merged
Changeset: f8e4a7e23e4b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f8e4a7e23e4b Branch: Oct2020 Log Message: merged diffs (167 lines): diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -1682,46 +1682,20 @@ rel_find_exp_and_corresponding_rel(sql_r case op_right: case op_full: case op_join: + case op_semi: + case op_anti: ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (!ne) + if (!ne && is_join(rel->op)) ne = rel_find_exp_and_corresponding_rel(rel->r, e, res, under_join); if (ne && under_join) *under_join = true; break; case op_table: - if (rel->exps && e->type == e_column && e->l && exps_bind_column2(rel->exps, e->l, e->r, NULL)) - ne = e; - if (ne && res) - *res = rel; - break; - case op_union: - case op_except: - case op_inter: - { - if (rel->l) - ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - else if (rel->exps && e->l) { - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; - } else if (rel->exps) { - ne = exps_bind_column(rel->exps, e->r, NULL, NULL, 1); - if (ne && res) - *res = rel; - } - } - break; case op_basetable: - if (rel->exps && e->type == e_column && e->l) - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; break; default: if (!is_project(rel->op) && rel->l) ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (ne && (rel->op == op_semi || rel->op == op_anti) && under_join) - *under_join = true; } } return ne; diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -33,3 +33,4 @@ drop-stream-table.Bug-7005 deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 +release_old_savepoint.Bug-7020 diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql @@ -0,0 +1,18 @@ +start transaction; + +create table savepointtest (id int, primary key(id)); +savepoint name1; + +insert into savepointtest values(1), (2), (3); +select * from savepointtest; +savepoint name2; + +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +select * from savepointtest; +savepoint name3; + +release savepoint name1; +select * from savepointtest; +commit; + diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err @@ -0,0 +1,12 @@ +stderr of test 'release_old_savepoint.Bug-7020` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:05:47 > +# 09:05:47 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-141551" "--port=39186" +# 09:05:47 > + + +# 09:05:47 > +# 09:05:47 > "Done." +# 09:05:47 > + diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.out @@ -0,0 +1,61 @@ +stdout of test 'release_old_savepoint.Bug-7020` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:05:47 > +# 09:05:47 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-141551" "--port=39186" +# 09:05:47 > + +#start transaction; +#create table savepointtest (id int, primary key(id)); +#savepoint name1; +#insert into savepointtest values(1), (2), (3); +[ 3] +#s
MonetDB: Oct2020 - merged
Changeset: 7ad5ffe26663 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ad5ffe26663 Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/sql_subquery.c Branch: Oct2020 Log Message: merged diffs (11 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,7 +541,6 @@ mvc_bind(mvc *m, const char *sname, cons return NULL; b = store_funcs.bind_col(tr, c, access); - assert(b); return b; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - initialize variable
Changeset: 7e0cc0376183 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7e0cc0376183 Modified Files: sql/backends/monet5/sql_subquery.c Branch: Oct2020 Log Message: initialize variable diffs (12 lines): diff --git a/sql/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -16,7 +16,7 @@ zero_or_one_error(ptr ret, const bat *bi BAT *b; BUN c; size_t _s; - const void *p; + const void *p = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot access column descriptor"); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merged with Oct2020
Changeset: 04a7c778a7e3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=04a7c778a7e3 Modified Files: gdk/gdk_logger.c sql/backends/monet5/sql.c sql/server/rel_exp.c sql/test/BugTracker-2020/Tests/All Branch: default Log Message: merged with Oct2020 diffs (295 lines): diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -3182,6 +3182,7 @@ bm_commit(logger *lg, lng save_id) return GDK_FAIL; } BBPrelease(bid); + assert(BBP_lrefs(bid)<=0 && BBP_refs(bid)==0); } if (leftover) { nfreed = logbat_new(TYPE_int, leftover, TRANSIENT); 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 @@ -563,7 +563,6 @@ 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/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -16,7 +16,7 @@ zero_or_one_error(ptr ret, const bat *bi BAT *b; BUN c; size_t _s; - const void *p; + const void *p = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot access column descriptor"); diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -1695,46 +1695,20 @@ rel_find_exp_and_corresponding_rel(sql_r case op_right: case op_full: case op_join: + case op_semi: + case op_anti: ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (!ne) + if (!ne && is_join(rel->op)) ne = rel_find_exp_and_corresponding_rel(rel->r, e, res, under_join); if (ne && under_join) *under_join = true; break; case op_table: - if (rel->exps && e->type == e_column && e->l && exps_bind_column2(rel->exps, e->l, e->r, NULL)) - ne = e; - if (ne && res) - *res = rel; - break; - case op_union: - case op_except: - case op_inter: - { - if (rel->l) - ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - else if (rel->exps && e->l) { - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; - } else if (rel->exps) { - ne = exps_bind_column(rel->exps, e->r, NULL, NULL, 1); - if (ne && res) - *res = rel; - } - } - break; case op_basetable: - if (rel->exps && e->type == e_column && e->l) - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; break; default: if (!is_project(rel->op) && rel->l) ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (ne && (rel->op == op_semi || rel->op == op_anti) && under_join) - *under_join = true; } } return ne; diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -34,3 +34,4 @@ drop-stream-table.Bug-7005 deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 +release_old_savepoint.Bug-7020 diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql @@ -0,0 +1,18 @@ +start transaction; + +create table savepointtest (id int, primary key(id)); +savepoint name1; + +insert into savepointtest values(1), (2), (3); +select * from savepointtest; +savepoint name2; + +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +select * from savepointtest; +savepoint name3; + +release savepoin
MonetDB: mtest - merged
Changeset: 065f2c6860a9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=065f2c6860a9 Modified Files: sql/test/BugTracker-2020/Tests/All Branch: mtest Log Message: merged diffs (295 lines): diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -3182,6 +3182,7 @@ bm_commit(logger *lg, lng save_id) return GDK_FAIL; } BBPrelease(bid); + assert(BBP_lrefs(bid)<=0 && BBP_refs(bid)==0); } if (leftover) { nfreed = logbat_new(TYPE_int, leftover, TRANSIENT); 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 @@ -563,7 +563,6 @@ 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/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -16,7 +16,7 @@ zero_or_one_error(ptr ret, const bat *bi BAT *b; BUN c; size_t _s; - const void *p; + const void *p = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot access column descriptor"); diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -1695,46 +1695,20 @@ rel_find_exp_and_corresponding_rel(sql_r case op_right: case op_full: case op_join: + case op_semi: + case op_anti: ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (!ne) + if (!ne && is_join(rel->op)) ne = rel_find_exp_and_corresponding_rel(rel->r, e, res, under_join); if (ne && under_join) *under_join = true; break; case op_table: - if (rel->exps && e->type == e_column && e->l && exps_bind_column2(rel->exps, e->l, e->r, NULL)) - ne = e; - if (ne && res) - *res = rel; - break; - case op_union: - case op_except: - case op_inter: - { - if (rel->l) - ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - else if (rel->exps && e->l) { - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; - } else if (rel->exps) { - ne = exps_bind_column(rel->exps, e->r, NULL, NULL, 1); - if (ne && res) - *res = rel; - } - } - break; case op_basetable: - if (rel->exps && e->type == e_column && e->l) - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; break; default: if (!is_project(rel->op) && rel->l) ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (ne && (rel->op == op_semi || rel->op == op_anti) && under_join) - *under_join = true; } } return ne; diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -34,3 +34,4 @@ drop-stream-table.Bug-7005 deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 +release_old_savepoint.Bug-7020 diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql @@ -0,0 +1,18 @@ +start transaction; + +create table savepointtest (id int, primary key(id)); +savepoint name1; + +insert into savepointtest values(1), (2), (3); +select * from savepointtest; +savepoint name2; + +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +select * from savepointtest; +savepoint name3; + +release savepoint name1; +select * from savepointtest; +commit; + diff --git a/sql/test/BugTracker-2020/Tests/release_
MonetDB: mtest - dont close connection aftre each execute
Changeset: 2e89a604eec3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2e89a604eec3 Modified Files: testing/sqltest.py Branch: mtest Log Message: dont close connection aftre each execute diffs (156 lines): diff --git a/testing/sqltest.py b/testing/sqltest.py --- a/testing/sqltest.py +++ b/testing/sqltest.py @@ -110,34 +110,41 @@ class PyMonetDBConnectionContext(object) self.dbh = None self.language = language +def connect(self): +if self.dbh is None: +if self.language == 'sql': +self.dbh = pymonetdb.connect( + username=self.username, + password=self.password, + hostname=self.hostname, + port=self.port, + database=self.database, + autocommit=True) +else: +self.dbh = malmapi.Connection() +self.dbh.connect( + username=self.username, + password=self.password, + hostname=self.hostname, + port=self.port, + database=self.database, + language=self.language) +return self.dbh + def __enter__(self): -if self.language == 'sql': -self.dbh = pymonetdb.connect( - username=self.username, - password=self.password, - hostname=self.hostname, - port=self.port, - database=self.database, - autocommit=True) -else: -self.dbh = malmapi.Connection() -self.dbh.connect( - username=self.username, - password=self.password, - hostname=self.hostname, - port=self.port, - database=self.database, - language=self.language) +self.connect() return self def __exit__(self, exc_type, exc_value, traceback): self.close() def cursor(self): -if self.language == 'sql': -return self.dbh.cursor() -else: -return MapiCursor(self.dbh) +if self.dbh: +if self.language == 'sql': +return self.dbh.cursor() +else: +return MapiCursor(self.dbh) +return None def close(self): if self.dbh: @@ -174,6 +181,7 @@ class TestCaseResult(object): """ logs errors to test case err file""" err_file = self.test_case.err_file if len(self.assertion_errors) == 0: +print('', file=err_file) if self.query: print(self.query, file=err_file) elif self.id: @@ -220,7 +228,7 @@ class TestCaseResult(object): def assertSucceeded(self): """assert on query succeeded""" if self.test_run_error is not None: -msg = "expected to succeed but didn't\n{}".format(str(self.test_run_error)) +msg = "expected to succeed but didn't\n{}".format(str(self.test_run_error).rstrip('\n')) self.fail(msg) return self @@ -415,14 +423,14 @@ class PyMonetDBTestResult(TestCaseResult if query: self.query = query try: -with self.test_case.conn_ctx as ctx: -crs = ctx.cursor() -crs.execute(query) -self.rowcount = crs.rowcount -self.rows = crs._rows -if crs.description: -self.data = crs.fetchall() -self.description = crs.description +conn = self.test_case.conn_ctx.connect() +crs = conn.cursor() +crs.execute(query) +self.rowcount = crs.rowcount +self.rows = crs._rows +if crs.description: +self.data = crs.fetchall() +self.description = crs.description except pymonetdb.Error as e: self.test_run_error = e self.err_code, self.err_message = self._parse_error(e.args[0]) @@ -462,7 +470,6 @@ class SQLDump(): def __init__(self, test_case, data=None): self.test_case = test_case self.data = data -conn_ctx = test_case.conn_ctx self.assertion_errors = [] # holds assertion errors def assertMatchStableOut(self, fout
MonetDB: mtest - more users tests
Changeset: 260f3e9db10b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=260f3e9db10b Modified Files: sql/test/Users/Tests/privs.test sql/test/Users/Tests/table.SQL.py sql/test/Users/Tests/test_privs_p1.SQL.py Branch: mtest Log Message: more users tests diffs (40 lines): diff --git a/sql/test/Users/Tests/privs.test b/sql/test/Users/Tests/privs.test --- a/sql/test/Users/Tests/privs.test +++ b/sql/test/Users/Tests/privs.test @@ -18,4 +18,3 @@ GRANT UPDATE on table test to my_user statement ok GRANT DELETE on table test to my_user - diff --git a/sql/test/Users/Tests/table.SQL.py b/sql/test/Users/Tests/table.SQL.py --- a/sql/test/Users/Tests/table.SQL.py +++ b/sql/test/Users/Tests/table.SQL.py @@ -14,7 +14,9 @@ with SQLTestCase() as tc: time_e BIGINT NULL, PRIMARY KEY (obsid) ) """).assertSucceeded() -tc.execute("INSERT INTO my_schema.my_table (time_s) values (300)").assertRowCount(1) +tc.execute("INSERT INTO my_schema.my_table (time_s) values (300)")\ +.assertSucceeded()\ +.assertRowCount(1) # import os, sys # import pymonetdb diff --git a/sql/test/Users/Tests/test_privs_p1.SQL.py b/sql/test/Users/Tests/test_privs_p1.SQL.py --- a/sql/test/Users/Tests/test_privs_p1.SQL.py +++ b/sql/test/Users/Tests/test_privs_p1.SQL.py @@ -6,10 +6,10 @@ from MonetDBtesting.sqltest import SQLTe with SQLTestCase() as tc: tc.connect(username="my_user", password="p1") -tc.execute("select * from test").assertRowCount(0) -tc.execute("insert into test values(1,1)").assertRowCount(1) -tc.execute("update test set b = 2").assertRowCount(1) -tc.execute("delete from test").assertRowCount(1) +tc.execute("select * from test").assertSucceeded().assertRowCount(0) +tc.execute("insert into test values(1,1)").assertSucceeded().assertRowCount(1) +tc.execute("update test set b = 2").assertSucceeded().assertRowCount(1) +tc.execute("delete from test").assertSucceeded().assertRowCount(1) # import os, sys # import pymonetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - first check if data exists
Changeset: 57e0605af576 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=57e0605af576 Modified Files: sql/storage/sql_catalog.c Branch: Jun2020 Log Message: first check if data exists diffs (12 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 @@ -119,7 +119,7 @@ cs_find_id(changeset * cs, sqlid id) sql_base *b = n->data; /* check if names match */ - if (b->id == id) { + if (b && b->id == id) { return n; } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - small fixes
Changeset: 2a7689634de9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2a7689634de9 Modified Files: sql/test/Users/Tests/changePasswordUser.SQL.py sql/test/Users/Tests/privs.test sql/test/Users/Tests/test_privs_p1.reqtests sql/test/Users/Tests/test_privs_p2.reqtests Branch: mtest Log Message: small fixes diffs (35 lines): diff --git a/sql/test/Users/Tests/changePasswordUser.SQL.py b/sql/test/Users/Tests/changePasswordUser.SQL.py --- a/sql/test/Users/Tests/changePasswordUser.SQL.py +++ b/sql/test/Users/Tests/changePasswordUser.SQL.py @@ -14,6 +14,7 @@ with SQLTestCase() as tc: tc.execute("select 'password april2';").assertSucceeded().assertRowCount(1).assertDataResultMatch([("password april2",)]) tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3';").assertFailed(err_message='ALTER USER: Access denied') tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 'april2';").assertSucceeded() +tc.connect(username="april", password="april2") tc.execute("select 'password april2 (wrong!!!)';").assertFailed() tc.connect(username="april", password="april") tc.execute("select 'password change successfully';").assertSucceeded().assertRowCount(1).assertDataResultMatch([("password change successfully",)]) diff --git a/sql/test/Users/Tests/privs.test b/sql/test/Users/Tests/privs.test --- a/sql/test/Users/Tests/privs.test +++ b/sql/test/Users/Tests/privs.test @@ -7,8 +7,6 @@ CREATE table test (i int, b bigint) statement ok GRANT SELECT on table test to my_user -# TODO: add tests for GRANT ON TO PUBLIC - statement ok GRANT INSERT on table test to my_user diff --git a/sql/test/Users/Tests/test_privs_p1.reqtests b/sql/test/Users/Tests/test_privs_p1.reqtests --- a/sql/test/Users/Tests/test_privs_p1.reqtests +++ b/sql/test/Users/Tests/test_privs_p1.reqtests @@ -1,1 +1,2 @@ schema +privs diff --git a/sql/test/Users/Tests/test_privs_p2.reqtests b/sql/test/Users/Tests/test_privs_p2.reqtests --- a/sql/test/Users/Tests/test_privs_p2.reqtests +++ b/sql/test/Users/Tests/test_privs_p2.reqtests @@ -1,1 +1,2 @@ schema +privs ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: properties - Move function statistics propagation to a ...
Changeset: 3d50efb8bee1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d50efb8bee1 Added Files: sql/server/rel_statistics_functions.c Modified Files: sql/server/CMakeLists.txt sql/server/rel_statistics.c sql/server/rel_statistics.h Branch: properties Log Message: Move function statistics propagation to a different translation unit. Limit types for min/max propagation to numeric and temporal types diffs (truncated from 542 to 300 lines): diff --git a/sql/server/CMakeLists.txt b/sql/server/CMakeLists.txt --- a/sql/server/CMakeLists.txt +++ b/sql/server/CMakeLists.txt @@ -45,7 +45,7 @@ target_sources(sqlserver rel_rewriter.c rel_unnest.c rel_optimizer.c - rel_statistics.c + rel_statistics.c rel_statistics_functions.c rel_partition.c rel_planner.c rel_planner.h rel_distribute.c diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c --- a/sql/server/rel_statistics.c +++ b/sql/server/rel_statistics.c @@ -10,95 +10,7 @@ #include "monetdb_config.h" #include "rel_statistics.h" #include "rel_optimizer.h" -#include "rel_rel.h" -#include "rel_exp.h" -#include "rel_prop.h" #include "rel_rewriter.h" -#include "sql_mvc.h" - -static inline void -set_max_of_values(mvc *sql, sql_exp *e, rel_prop kind, ValPtr lval, ValPtr rval) -{ - prop *p; - ValRecord res; - - VARcalcgt(&res, lval, rval); - p = e->p = prop_create(sql->sa, kind, e->p); - p->value = res.val.btval == 1 ? lval : rval; -} - -static inline void -set_min_of_values(mvc *sql, sql_exp *e, rel_prop kind, ValPtr lval, ValPtr rval) -{ - prop *p; - ValRecord res; - - VARcalcgt(&res, lval, rval); - p = e->p = prop_create(sql->sa, kind, e->p); - p->value = res.val.btval == 1 ? rval : lval; -} - -static inline void -copy_property(mvc *sql, sql_exp *e, rel_prop kind, ValPtr val) -{ - prop *p = e->p = prop_create(sql->sa, kind, e->p); - p->value = val; -} - -static sql_hash *sql_functions_lookup = NULL; - -static void -sql_add_propagate_statistics(mvc *sql, sql_exp *e) -{ - list *l = e->l; - sql_exp *first = l->h->data, *second = l->h->next->data; - ValPtr lval, rval; - - if ((lval = find_prop_and_get(first->p, PROP_MAX)) && (rval = find_prop_and_get(second->p, PROP_MAX))) { - ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); - res->vtype = lval->vtype; - if (VARcalcadd(res, lval, rval, true) == GDK_SUCCEED) { - copy_property(sql, e, PROP_MAX, res); - } else { - GDKclrerr(); - atom *a = atom_max_value(sql->sa, exp_subtype(first)); - copy_property(sql, e, PROP_MAX, &a->data); - } - } - if ((lval = find_prop_and_get(first->p, PROP_MIN)) && (rval = find_prop_and_get(second->p, PROP_MIN))) { - ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); - res->vtype = lval->vtype; - if (VARcalcadd(res, lval, rval, true) == GDK_SUCCEED) { - copy_property(sql, e, PROP_MIN, res); - } else { - GDKclrerr(); - atom *a = atom_max_value(sql->sa, exp_subtype(first)); - copy_property(sql, e, PROP_MIN, &a->data); - } - } -} - -typedef void (*lookup_function) (mvc*, sql_exp*); - -static struct function_properties { - const char *name; - lookup_function func; -} functions_list[1] = { - {"sql_add", &sql_add_propagate_statistics} -}; - -void -initialize_sql_functions_lookup(sql_allocator *sa) -{ - int nentries = sizeof(functions_list) / sizeof(functions_list[0]); - - sql_functions_lookup = hash_new(sa, nentries, (fkeyvalue)&hash_key); - for (int i = 0; i < nentries ; i++) { - int key = hash_key(functions_list[i].name); - - hash_add(sql_functions_lookup, key, &(functions_list[i])); - } -} static bool exps_have_or(list *exps) @@ -153,9 +65,9 @@ rel_propagate_column_ref_statistics(mvc if ((ne = comparison_find_column(le, e)) || (rne = comparison_find_column(re, e))) { if (is_outerjoin(rel->op)) { - if ((lval = find_prop_and_get(ne ? ne->p : rne->p, PROP_MAX))) + if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MAX))) copy_property(sql, e, PROP_MAX, lval); - if ((lval = find_prop_and_get(ne ? ne->p : rne->p, PROP_MIN))) + if ((lval = find_prop_and_get(le ?
MonetDB: Oct2020 - merged
Changeset: da8a53851f30 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da8a53851f30 Modified Files: sql/storage/sql_catalog.c Branch: Oct2020 Log Message: merged ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merged
Changeset: 0a2e7203150b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0a2e7203150b Branch: default Log Message: merged ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - merged
Changeset: d106e3ddbbbc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d106e3ddbbbc Branch: mtest Log Message: merged ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: unlock - merged
Changeset: e248e00b80de for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e248e00b80de Modified Files: gdk/gdk_logger.c sql/backends/monet5/sql.c Branch: unlock Log Message: merged diffs (284 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 @@ -588,7 +588,6 @@ 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/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -16,7 +16,7 @@ zero_or_one_error(ptr ret, const bat *bi BAT *b; BUN c; size_t _s; - const void *p; + const void *p = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot access column descriptor"); diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -1695,46 +1695,20 @@ rel_find_exp_and_corresponding_rel(sql_r case op_right: case op_full: case op_join: + case op_semi: + case op_anti: ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (!ne) + if (!ne && is_join(rel->op)) ne = rel_find_exp_and_corresponding_rel(rel->r, e, res, under_join); if (ne && under_join) *under_join = true; break; case op_table: - if (rel->exps && e->type == e_column && e->l && exps_bind_column2(rel->exps, e->l, e->r, NULL)) - ne = e; - if (ne && res) - *res = rel; - break; - case op_union: - case op_except: - case op_inter: - { - if (rel->l) - ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - else if (rel->exps && e->l) { - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; - } else if (rel->exps) { - ne = exps_bind_column(rel->exps, e->r, NULL, NULL, 1); - if (ne && res) - *res = rel; - } - } - break; case op_basetable: - if (rel->exps && e->type == e_column && e->l) - ne = exps_bind_column2(rel->exps, e->l, e->r, NULL); - if (ne && res) - *res = rel; break; default: if (!is_project(rel->op) && rel->l) ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (ne && (rel->op == op_semi || rel->op == op_anti) && under_join) - *under_join = true; } } return ne; diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -34,3 +34,4 @@ drop-stream-table.Bug-7005 deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 +release_old_savepoint.Bug-7020 diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.sql @@ -0,0 +1,18 @@ +start transaction; + +create table savepointtest (id int, primary key(id)); +savepoint name1; + +insert into savepointtest values(1), (2), (3); +select * from savepointtest; +savepoint name2; + +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +select * from savepointtest; +savepoint name3; + +release savepoint name1; +select * from savepointtest; +commit; + diff --git a/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/release_old_savepoint.Bug-7020.stable.err @@ -0,0 +1,12 @@ +stderr of test 'release_old_savepoint.Bug-7020` in directory 'sql/test/BugTracker-2020` itself: + + +# 09:05:47 > +# 09:05:47 > "mclient" "-lsql"
MonetDB: properties - The statistics of multiplication function ...
Changeset: 162a3868f573 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=162a3868f573 Modified Files: sql/server/rel_statistics_functions.c Branch: properties Log Message: The statistics of multiplication function are not that easy to propagate diffs (101 lines): diff --git a/sql/server/rel_statistics_functions.c b/sql/server/rel_statistics_functions.c --- a/sql/server/rel_statistics_functions.c +++ b/sql/server/rel_statistics_functions.c @@ -18,39 +18,66 @@ sql_hash *sql_functions_lookup = NULL; -#define sql_binop_propagate_trivial(FUNC) \ -static void \ -sql_##FUNC##_propagate_statistics(mvc *sql, sql_exp *e) \ -{ \ - list *l = e->l; \ - sql_exp *first = l->h->data, *second = l->h->next->data; \ - ValPtr lval, rval; \ - if ((lval = find_prop_and_get(first->p, PROP_MAX)) && (rval = find_prop_and_get(second->p, PROP_MAX))) { \ - ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); \ - res->vtype = lval->vtype; \ - if (VARcalc##FUNC(res, lval, rval, true) == GDK_SUCCEED) { \ - copy_property(sql, e, PROP_MAX, res); \ - } else { \ - GDKclrerr(); \ - atom *a = atom_max_value(sql->sa, exp_subtype(first)); \ - copy_property(sql, e, PROP_MAX, &a->data); \ - } \ - } \ - if ((lval = find_prop_and_get(first->p, PROP_MIN)) && (rval = find_prop_and_get(second->p, PROP_MIN))) { \ - ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); \ - res->vtype = lval->vtype; \ - if (VARcalc##FUNC(res, lval, rval, true) == GDK_SUCCEED) { \ - copy_property(sql, e, PROP_MIN, res); \ - } else { \ - GDKclrerr(); \ - atom *a = atom_max_value(sql->sa, exp_subtype(first)); \ - copy_property(sql, e, PROP_MIN, &a->data); \ - } \ - } \ +static void +sql_add_propagate_statistics(mvc *sql, sql_exp *e) +{ + list *l = e->l; + sql_exp *first = l->h->data, *second = l->h->next->data; + ValPtr lval, rval; + + if ((lval = find_prop_and_get(first->p, PROP_MAX)) && (rval = find_prop_and_get(second->p, PROP_MAX))) { + ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + res->vtype = lval->vtype; + if (VARcalcadd(res, lval, rval, true) == GDK_SUCCEED) { + copy_property(sql, e, PROP_MAX, res); + } else { + GDKclrerr(); /* if the min/max pair overflows, then disable */ + } + } + if ((lval = find_prop_and_get(first->p, PROP_MIN)) && (rval = find_prop_and_get(second->p, PROP_MIN))) { + ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + res->vtype = lval->vtype; + if (VARcalcadd(res, lval, rval, true) == GDK_SUCCEED) { + copy_property(sql, e, PROP_MIN, res); + } else { + GDKclrerr(); + } + } } -sql_binop_propagate_trivial(add) -sql_binop_propagate_trivial(mul) +static void +sql_mul_propagate_statistics(mvc *sql, sql_exp *e) +{ + list *l = e->l; + sql_exp *first = l->h->data, *second = l->h->next->data; + ValPtr lval, rval; + ValRecord zero, verify; + + if ((lval = find_prop_and_get(first->p, PROP_MAX)) && (rval = find_prop_and_get(second->p, PROP_MAX))) { + ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + res->vtype = lval->vtype; + if (VARcalcmul(res, lval, rval, true) == GDK_SUCCEED) { /* only propagate '*' min/max when both sides have the same sign ie a * b >= 0 */ + VALinit(&zero, res->vtype, &(int){0}); + VARcalcge(&verify, res, &zero); + if (verify.val.btval == 1) + copy_property(sql, e, PROP_MAX, res); + } else { + GDKclrerr(); /* if the min/max pair overflows, then disable */ + } + } + if ((lval = find_prop_and_get(first->p, PROP_MIN)) && (rval = find_prop_and_get(second->p, PROP_MIN))) { + ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + res->vtype = lval->vtype; + if (VARcalcmul(res, lval, rval, true) == GDK_SUCCEED) { + VALinit(&zero, res->vtype, &(int){0}); + VARcalcge(&verify, res, &zero); + if (verify.val.btval == 1) + copy_property(sql, e, PROP_MIN, res); + } else { + GDKclrerr(); + } + } +} static struct function_properties functions_list[2] = { {"sql_add", &sql_add_propagate_statisti
MonetDB: Oct2020 - Either our code or the compiler has improved:...
Changeset: 38823291a044 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38823291a044 Modified Files: MonetDB.spec Branch: Oct2020 Log Message: Either our code or the compiler has improved: in any case, it doesn't crash anymore. diffs (15 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -786,11 +786,6 @@ fi %setup -q %build -%if (0%{?fedora} >= 33) -# on Fedora 33 we get a crash of the compiler when using -flto, so disable it -CFLAGS="${CFLAGS:-%optflags} -fno-lto" -export CFLAGS -%endif %cmake3 \ -DRELEASE_VERSION=ON \ -DASSERT=OFF \ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Get actual listening port from server.
Changeset: 14e383b79e81 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=14e383b79e81 Modified Files: testing/process.py Branch: Oct2020 Log Message: Get actual listening port from server. If server started with mapi_port=0, we should retrieve the actual port from the .conn file and make it available to the client. diffs (30 lines): diff --git a/testing/process.py b/testing/process.py --- a/testing/process.py +++ b/testing/process.py @@ -464,5 +464,26 @@ class server(Popen): break if os.path.exists(started): # server is ready +try: +conn = open(os.path.join(dbpath, '.conn')).read() +except: +if verbose: +print('failed to open {}'.format(os.path.join(dbpath, '.conn'))) +pass +else: +# retrieve mapi port if available +for c in conn.splitlines(): +c = c.rstrip('/') +c = c.rsplit(':', maxsplit=1) +if len(c) == 2: +try: +port = int(c[1]) +except ValueError: +pass +else: +if verbose: +print('mapi port: {}'.format(c[1])) +self.dbport = c[1] +break break time.sleep(0.001) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - fix users test
Changeset: 75924a38c3e4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75924a38c3e4 Modified Files: sql/test/Users/Tests/changePasswordUser.SQL.py Branch: mtest Log Message: fix users test diffs (22 lines): diff --git a/sql/test/Users/Tests/changePasswordUser.SQL.py b/sql/test/Users/Tests/changePasswordUser.SQL.py --- a/sql/test/Users/Tests/changePasswordUser.SQL.py +++ b/sql/test/Users/Tests/changePasswordUser.SQL.py @@ -7,12 +7,15 @@ from MonetDBtesting.sqltest import SQLTe with SQLTestCase() as tc: tc.connect(username="monetdb", password="monetdb") -tc.execute("ALTER USER april WITH UNENCRYPTED PASSWORD 'april2';").assertSucceeded() +tc.execute("ALTER USER april WITH UNENCRYPTED PASSWORD 'april2';").assertSucceeded() tc.connect(username="april", password="april") tc.execute("select 'password april';").assertFailed() tc.connect(username="april", password="april2") -tc.execute("select 'password april2';").assertSucceeded().assertRowCount(1).assertDataResultMatch([("password april2",)]) -tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3';").assertFailed(err_message='ALTER USER: Access denied') +tc.execute("select 'password april2';")\ +.assertSucceeded()\ +.assertRowCount(1).assertDataResultMatch([("password april2",)]) +tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april5' USING OLD PASSWORD 'april3';")\ +.assertFailed(err_message='ALTER USER: Access denied') tc.execute("ALTER USER SET UNENCRYPTED PASSWORD 'april' USING OLD PASSWORD 'april2';").assertSucceeded() tc.connect(username="april", password="april2") tc.execute("select 'password april2 (wrong!!!)';").assertFailed() ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with Oct2020 branch.
Changeset: 456a6defc91f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=456a6defc91f Modified Files: MonetDB.spec Branch: default Log Message: Merge with Oct2020 branch. diffs (45 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -786,11 +786,6 @@ fi %setup -q %build -%if (0%{?fedora} >= 33) -# on Fedora 33 we get a crash of the compiler when using -flto, so disable it -CFLAGS="${CFLAGS:-%optflags} -fno-lto" -export CFLAGS -%endif %cmake3 \ -DRELEASE_VERSION=ON \ -DASSERT=OFF \ diff --git a/testing/process.py b/testing/process.py --- a/testing/process.py +++ b/testing/process.py @@ -464,5 +464,26 @@ class server(Popen): break if os.path.exists(started): # server is ready +try: +conn = open(os.path.join(dbpath, '.conn')).read() +except: +if verbose: +print('failed to open {}'.format(os.path.join(dbpath, '.conn'))) +pass +else: +# retrieve mapi port if available +for c in conn.splitlines(): +c = c.rstrip('/') +c = c.rsplit(':', maxsplit=1) +if len(c) == 2: +try: +port = int(c[1]) +except ValueError: +pass +else: +if verbose: +print('mapi port: {}'.format(c[1])) +self.dbport = c[1] +break break time.sleep(0.001) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Merge with default branch.
Changeset: 5041322e96c4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5041322e96c4 Modified Files: MonetDB.spec Branch: mtest Log Message: Merge with default branch. diffs (45 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -785,11 +785,6 @@ fi %setup -q %build -%if (0%{?fedora} >= 33) -# on Fedora 33 we get a crash of the compiler when using -flto, so disable it -CFLAGS="${CFLAGS:-%optflags} -fno-lto" -export CFLAGS -%endif %cmake3 \ -DRELEASE_VERSION=ON \ -DASSERT=OFF \ diff --git a/testing/process.py b/testing/process.py --- a/testing/process.py +++ b/testing/process.py @@ -464,5 +464,26 @@ class server(Popen): break if os.path.exists(started): # server is ready +try: +conn = open(os.path.join(dbpath, '.conn')).read() +except: +if verbose: +print('failed to open {}'.format(os.path.join(dbpath, '.conn'))) +pass +else: +# retrieve mapi port if available +for c in conn.splitlines(): +c = c.rstrip('/') +c = c.rsplit(':', maxsplit=1) +if len(c) == 2: +try: +port = int(c[1]) +except ValueError: +pass +else: +if verbose: +print('mapi port: {}'.format(c[1])) +self.dbport = c[1] +break break time.sleep(0.001) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - convert tests for copyinto
Changeset: 2f117460182e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2f117460182e Modified Files: sql/test/Users/Tests/copyinto.SQL.py Branch: mtest Log Message: convert tests for copyinto diffs (116 lines): diff --git a/sql/test/Users/Tests/copyinto.SQL.py b/sql/test/Users/Tests/copyinto.SQL.py --- a/sql/test/Users/Tests/copyinto.SQL.py +++ b/sql/test/Users/Tests/copyinto.SQL.py @@ -1,45 +1,77 @@ import os, sys -try: -from MonetDBtesting import process -except ImportError: -import process TSTSRCBASE = os.environ['TSTSRCBASE'] SRCDIR = os.path.join(TSTSRCBASE, "sql", "benchmarks", "tpch") DATADIR = os.path.join(SRCDIR,"SF-0.01") -with process.client('sql', stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) as c: -c.stdin.write("CREATE TABLE REGION ( R_REGIONKEY INTEGER NOT NULL, R_NAME CHAR(25) NOT NULL, R_COMMENT VARCHAR(152));\n") -c.stdin.write("COPY 5 RECORDS INTO region from r'%s' USING DELIMITERS '|', E'|\\n';\n" % os.path.join(DATADIR, 'region.tbl')) -c.stdin.write("select count(*) from region;\n") -c.stdin.write("CREATE USER copyuser WITH PASSWORD 'copyuser' name 'copyuser' schema sys;\n") -c.stdin.write("GRANT INSERT, SELECT on region to copyuser;\n") -out, err = c.communicate() -sys.stdout.write(out) -sys.stderr.write(err.replace(DATADIR, '$DATADIR').replace(DATADIR.replace('\\', r'\\'), '$DATADIR').replace(r'DIR\\', 'DIR/').replace('DIR\\', 'DIR/')) +from MonetDBtesting.sqltest import SQLTestCase + +with SQLTestCase() as tc: +tc.connect(username="monetdb", password="monetdb") +tc.execute("CREATE TABLE REGION ( R_REGIONKEY INTEGER NOT NULL, R_NAME CHAR(25) NOT NULL, R_COMMENT VARCHAR(152));\n").assertSucceeded() +tc.execute("COPY 5 RECORDS INTO region from r'%s' USING DELIMITERS '|', E'|\\n';\n" % os.path.join(DATADIR, 'region.tbl')) +tc.execute("select count(*) from region;\n") +tc.execute("CREATE USER copyuser WITH PASSWORD 'copyuser' name 'copyuser' schema sys;\n") +tc.execute("GRANT INSERT, SELECT on region to copyuser;\n") + +tc.connect(username="copyuser", password="copyuser") +tc.execute("COPY 5 RECORDS INTO region from r'%s' USING DELIMITERS '|', E'|\\n';\n" % os.path.join(DATADIR, 'region.tbl')).assertFailed() +tc.execute("select count(*) from region;\n").assertSucceeded() + +tc.connect(username="monetdb", password="monetdb") +tc.execute("GRANT COPY FROM, COPY INTO to copyuser;\n").assertSucceeded() -with process.client('sql', user = 'copyuser', passwd = 'copyuser', stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) as c: -c.stdin.write("COPY 5 RECORDS INTO region from r'%s' USING DELIMITERS '|', E'|\\n';\n" % os.path.join(DATADIR, 'region.tbl')) -c.stdin.write("select count(*) from region;\n") -out, err = c.communicate() -sys.stdout.write(out) -sys.stderr.write(err.replace(DATADIR, '$DATADIR').replace(DATADIR.replace('\\', r'\\'), '$DATADIR').replace(r'DIR\\', 'DIR/').replace('DIR\\', 'DIR/')) +tc.connect(username="copyuser", password="copyuser") +tc.execute("COPY 5 RECORDS INTO region from r'%s' USING DELIMITERS '|', E'|\\n';\n" % os.path.join(DATADIR, 'region.tbl')).assertSucceeded() +tc.execute("select count(*) from region;\n").assertSucceeded() + +tc.connect(username="monetdb", password="monetdb") +tc.execute("REVOKE COPY FROM, COPY INTO from copyuser;\n").assertSucceeded() + + + +# import os, sys +# try: +# from MonetDBtesting import process +# except ImportError: +# import process + +# TSTSRCBASE = os.environ['TSTSRCBASE'] +# SRCDIR = os.path.join(TSTSRCBASE, "sql", "benchmarks", "tpch") +# DATADIR = os.path.join(SRCDIR,"SF-0.01") -with process.client('sql', stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) as c: -c.stdin.write("GRANT COPY FROM, COPY INTO to copyuser;\n") -out, err = c.communicate() -sys.stdout.write(out) -sys.stderr.write(err.replace(DATADIR, '$DATADIR').replace(DATADIR.replace('\\', r'\\'), '$DATADIR').replace(r'DIR\\', 'DIR/').replace('DIR\\', 'DIR/')) +# with process.client('sql', stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) as c: +# c.stdin.write("CREATE TABLE REGION ( R_REGIONKEY INTEGER NOT NULL, R_NAME CHAR(25) NOT NULL, R_COMMENT VARCHAR(152));\n") +# c.stdin.write("COPY 5 RECORDS INTO region from r'%s' USING DELIMITERS '|', E'|\\n';\n" % os.path.join(DATADIR, 'region.tbl')) +# c.stdin.write("select count(*) from region;\n") +# c.stdin.write("CREATE USER copyuser WITH PASSWORD 'copyuser' name 'copyuser' schema sys;\n") +# c.stdin.write("GRANT INSERT, SELECT on region to copyuser;\n") +# out, err = c.communicate() +# sys.stdout.write(out) +# sys.stderr.write(err.replace(DATADIR, '$DATADIR').replace(DATADIR.replace('\\', r'\\'), '$DATADIR').replace(r'DIR\\', 'DIR/').replace('DIR\\', 'DIR/')) + +# with process.client('sql', user = 'c
MonetDB: Oct2020 - Added tests and expected output for Bug-7021
Changeset: 6d4ab6a88f2b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6d4ab6a88f2b Added Files: sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.sql sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.stable.err sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.stable.out Modified Files: sql/test/BugTracker-2020/Tests/All Branch: Oct2020 Log Message: Added tests and expected output for Bug-7021 diffs (207 lines): diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -34,3 +34,5 @@ deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 release_old_savepoint.Bug-7020 +savepoints_crash_mserver5_1.Bug-7021 +savepoints_crash_mserver5_2.Bug-7021 diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql @@ -0,0 +1,15 @@ +-- triggers a SIGSEGV in sql/storage/store.c:185: if (--(i->base.refcnt) > 0) +start transaction; +create table savepointtest (id int, primary key(id)); +savepoint name1; +insert into savepointtest values(1), (2), (3); +savepoint name2; +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +--savepoint name3; +select * from savepointtest; +commit; + +select 42; +select * from savepointtest; + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err @@ -0,0 +1,12 @@ +stderr of test 'savepoints_crash_mserver5_1.Bug-7021` in directory 'sql/test/BugTracker-2020` itself: + + +# 11:57:43 > +# 11:57:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-153790" "--port=36420" +# 11:57:43 > + + +# 11:57:44 > +# 11:57:44 > "Done." +# 11:57:44 > + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out @@ -0,0 +1,57 @@ +stdout of test 'savepoints_crash_mserver5_1.Bug-7021` in directory 'sql/test/BugTracker-2020` itself: + + +# 11:57:43 > +# 11:57:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-153790" "--port=36420" +# 11:57:43 > + +#start transaction; +#create table savepointtest (id int, primary key(id)); +#savepoint name1; +#insert into savepointtest values(1), (2), (3); +[ 3] +#savepoint name2; +#insert into savepointtest values(4), (5), (6); +[ 3] +#insert into savepointtest values(7), (8), (9); +[ 3] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +[ 4] +[ 5] +[ 6] +[ 7] +[ 8] +[ 9] +#commit; +#select 42; +% .%2 # table_name +% %2 # name +% tinyint # type +% 2 # length +[ 42 ] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +[ 4] +[ 5] +[ 6] +[ 7] +[ 8] +[ 9] + +# 11:57:44 > +# 11:57:44 > "Done." +# 11:57:44 > + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.sql b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.sql @@ -0,0 +1,15 @@ +-- triggers: sql/storage/store.c:3940: trans_init: Assertion `istmp || !c->base.allocated' failed. +start transaction; +create table savepointtest (id int, primary key(id)); +savepoint name1; +insert into savepointtest values(1), (2), (3); +--savepoint name2; +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +savepoint name3; +select * from savepointtest; +commit; + +select 42; +select * from savepointtest; + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.stable.err b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_2.Bug-7021.stable.err @@ -0,0 +1,12 @
MonetDB: mtest - fix assertFailed output
Changeset: 3a17eeb55c9b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3a17eeb55c9b Modified Files: testing/sqltest.py Branch: mtest Log Message: fix assertFailed output diffs (33 lines): diff --git a/testing/sqltest.py b/testing/sqltest.py --- a/testing/sqltest.py +++ b/testing/sqltest.py @@ -211,18 +211,18 @@ class TestCaseResult(object): msg = "expected to fail but didn't" self.fail(msg) else: -if err_code and err_message: -if err_code != self.err_code or err_message.lower() != self.err_message.lower(): -msg = "expected to fail with error code {} and error message {} but failed with error code {} and error message {}".format(err_code, err_message, self.err_code, self.err_message) -self.fail(msg) -elif err_code and not err_message: +msgs = [] +if err_code: if self.err_code != err_code: -msg = "expected to fail with error code {} but failed with error code {}".format(err_code, self.err_code) -self.fail(msg) -elif err_message and not err_code: -if err_message.lower() != self.err_message.lower(): -msg = "expected to fail with error message {} but failed with error message {}".format(err_message, self.err_message) -self.fail(msg) +msgs.append( "expected to fail with error code {} but failed with error code {}".format(err_code, self.err_code)) +if err_message: +if self.err_message: +if err_message.lower() != self.err_message.lower(): +msgs.append("expected to fail with error message {} but failed with error message {}".format(err_message, self.err_message)) +else: +msgs.append("expected to fail with error message {} but got {}".format(err_message, self.err_message)) +if len(msgs) > 0: +self.fail('\n'.join(msgs)) return self def assertSucceeded(self): ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: properties - The multiplication function propagation wa...
Changeset: 2eef71653a40 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2eef71653a40 Modified Files: sql/server/rel_statistics_functions.c Branch: properties Log Message: The multiplication function propagation was not correct. For now, propagate only if min and max from both sides have the same sign diffs (142 lines): diff --git a/sql/server/rel_statistics_functions.c b/sql/server/rel_statistics_functions.c --- a/sql/server/rel_statistics_functions.c +++ b/sql/server/rel_statistics_functions.c @@ -19,6 +19,55 @@ sql_hash *sql_functions_lookup = NULL; static void +VALzero_value(ValPtr input, int localtype) +{ + void *ret = NULL; + + bte bval = 0; + sht sval = 0; + int ival = 0; + lng lval = 0; +#ifdef HAVE_HGE + hge hval = 0; +#endif + flt fval = 0; + dbl dval = 0; + + if (ATOMlinear(localtype)) { + switch (ATOMstorage(localtype)) { + case TYPE_bte: + ret = &bval; + break; + case TYPE_sht: + ret = &sval; + break; + case TYPE_int: + ret = &ival; + break; + case TYPE_lng: + ret = &lval; + break; +#ifdef HAVE_HGE + case TYPE_hge: + ret = &hval; + break; +#endif + case TYPE_flt: + ret = &fval; + break; + case TYPE_dbl: + ret = &dval; + break; + default: + break; + } + } + + VALset(input, localtype, ret); +} + + +static void sql_add_propagate_statistics(mvc *sql, sql_exp *e) { list *l = e->l; @@ -27,16 +76,16 @@ sql_add_propagate_statistics(mvc *sql, s if ((lval = find_prop_and_get(first->p, PROP_MAX)) && (rval = find_prop_and_get(second->p, PROP_MAX))) { ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); - res->vtype = lval->vtype; + res->vtype = lval->vtype > rval->vtype ? lval->vtype : rval->vtype; if (VARcalcadd(res, lval, rval, true) == GDK_SUCCEED) { copy_property(sql, e, PROP_MAX, res); } else { - GDKclrerr(); /* if the min/max pair overflows, then disable */ + GDKclrerr(); /* if the min/max pair overflows, then don't propagate */ } } if ((lval = find_prop_and_get(first->p, PROP_MIN)) && (rval = find_prop_and_get(second->p, PROP_MIN))) { ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); - res->vtype = lval->vtype; + res->vtype = lval->vtype > rval->vtype ? lval->vtype : rval->vtype; if (VARcalcadd(res, lval, rval, true) == GDK_SUCCEED) { copy_property(sql, e, PROP_MIN, res); } else { @@ -50,31 +99,38 @@ sql_mul_propagate_statistics(mvc *sql, s { list *l = e->l; sql_exp *first = l->h->data, *second = l->h->next->data; - ValPtr lval, rval; - ValRecord zero, verify; + ValPtr lmax, rmax, lmin, rmin; + + if ((lmax = find_prop_and_get(first->p, PROP_MAX)) && (rmax = find_prop_and_get(second->p, PROP_MAX)) && + (lmin = find_prop_and_get(first->p, PROP_MIN)) && (rmin = find_prop_and_get(second->p, PROP_MIN))) { + ValPtr res1 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)), res2 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + gdk_return code1, code2; + + res1->vtype = res2->vtype = lmax->vtype > rmax->vtype ? lmax->vtype : rmax->vtype; + code1 = VARcalcmul(res1, lmax, rmax, true); + GDKclrerr(); + code2 = VARcalcmul(res2, lmin, rmin, true); + GDKclrerr(); + + if (code1 == GDK_SUCCEED && code2 == GDK_SUCCEED) { /* if the min/max pair overflows, then don't propagate */ + ValRecord zero1, zero2, zero3, zero4, verify1, verify2, verify3, verify4; - if ((lval = find_prop_and_get(first->p, PROP_MAX)) && (rval = find_prop_and_get(second->p, PROP_MAX))) { - ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); - res->vtype = lval->vtype; - if (VARcalcmul(res, lval, rval, true) == GDK_SUCCEED) { /* only propagate '*' min/max when both sides have the same sign ie a * b >= 0 */ - VALinit(&zero, res->vtype, &(int){0}); - VARcalcge(&verify, res, &zero); - if (verify.val.btval == 1) - copy_property(sql, e, PROP_MAX, res); - } else { - GDKclrerr(); /* if the min/
MonetDB: mtest - fix more prepare tests
Changeset: b5b7439391c1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b5b7439391c1 Added Files: sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.SQL.py sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.SQL.py Removed Files: sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.test sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.test Branch: mtest Log Message: fix more prepare tests diffs (75 lines): diff --git a/sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.SQL.py b/sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.SQL.py new file mode 100644 --- /dev/null +++ b/sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.SQL.py @@ -0,0 +1,11 @@ +from MonetDBtesting.sqltest import SQLTestCase + +with SQLTestCase() as tc: +# optional or default connection +tc.connect() +with open('prepare-where.SF-1238867.1238959.1238965.1240124.sql') as f: +tc.execute(query=None, client='mclient', stdin=f)\ + .assertMatchStableOut(fout='prepare-where.SF-1238867.1238959.1238965.1240124.stable.out')\ + .assertMatchStableError(ferr='prepare-where.SF-1238867.1238959.1238965.1240124.stable.err') + + diff --git a/sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.test b/sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.test deleted file mode 100644 --- a/sql/test/prepare/Tests/prepare-where.SF-1238867.1238959.1238965.1240124.test +++ /dev/null @@ -1,13 +0,0 @@ -statement ok -prepare select * from env() as env where 1 = ? - -statement error -prepare select * from env() as env where ? = ? - -statement error -prepare select ? from env() as env - -statement ok -prepare select * from env() as env where name in (?) - - diff --git a/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.SQL.py b/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.SQL.py new file mode 100644 --- /dev/null +++ b/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.SQL.py @@ -0,0 +1,12 @@ +from MonetDBtesting.sqltest import SQLTestCase + +with SQLTestCase() as tc: +# optional or default connection +tc.connect() +with open('prepare_doesnot_like_LIKE.SF-1234205.sql') as f: +tc.execute(query=None, client='mclient', stdin=f)\ +.assertSucceeded()\ + .assertMatchStableOut(fout='prepare_doesnot_like_LIKE.SF-1234205.stable.out')\ + + + diff --git a/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.test b/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.test deleted file mode 100644 --- a/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.test +++ /dev/null @@ -1,19 +0,0 @@ -statement ok -create table t1234205 (name varchar(1024)) - -statement ok -insert into t1234205 values ('niels'),('fabian'),('martin') - -statement ok -prepare select name from t1234205 where name like ? - -statement ok -exec ** ('%') - -statement ok -prepare select name from t1234205 where name like 'n%' - -statement ok -exec ** () - - ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jun2020 - Print current query when using CALL logging.s...
Changeset: ebde5dae3008 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ebde5dae3008 Modified Files: sql/backends/monet5/sql_execute.c Branch: Jun2020 Log Message: Print current query when using CALL logging.setcomplevel('SQL_EXECUTION', 'INFO'); diffs (11 lines): diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -298,6 +298,7 @@ SQLrun(Client c, backend *be, mvc *m) } if (m->emode == m_execute && be->q->paramlen != m->argc) throw(SQL, "sql.prepare", SQLSTATE(42000) "EXEC called with wrong number of arguments: expected %d, got %d", be->q->paramlen, m->argc); + TRC_INFO(SQL_EXECUTION, "Executing: %s", m->query); MT_thread_setworking(m->query); // locate and inline the query template instruction mb = copyMalBlk(c->curprg->def); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Merge with Jun2020 branch.
Changeset: 5d72c236661b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5d72c236661b Modified Files: sql/backends/monet5/sql_execute.c Branch: Oct2020 Log Message: Merge with Jun2020 branch. diffs (11 lines): diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -206,6 +206,7 @@ SQLrun(Client c, mvc *m) *m->errstr=0; return msg; } + TRC_INFO(SQL_EXECUTION, "Executing: %s", c->query); MT_thread_setworking(c->query); // locate and inline the query template instruction mb = copyMalBlk(c->curprg->def); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Converted emptydb* tests.
Changeset: fab5fca26290 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fab5fca26290 Added Files: sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.py sql/test/emptydb-upgrade-chain/Tests/upgrade.py sql/test/emptydb-upgrade-hge/Tests/upgrade.py sql/test/emptydb-upgrade/Tests/upgrade.py Removed Files: sql/test/emptydb-upgrade-chain-hge/Tests/dump.SQL.py.src sql/test/emptydb-upgrade-chain-hge/Tests/dump.reqtests sql/test/emptydb-upgrade-chain-hge/Tests/dump.sql sql/test/emptydb-upgrade-chain-hge/Tests/dump.stable.err-noapprove sql/test/emptydb-upgrade-chain-hge/Tests/dump.stable.err.int128 sql/test/emptydb-upgrade-chain-hge/Tests/dump.stable.out-noapprove sql/test/emptydb-upgrade-chain-hge/Tests/dump.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.py sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.stable.err.int128 sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.reqtests sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.sql sql/test/emptydb-upgrade-chain/Tests/dump.SQL.py.src sql/test/emptydb-upgrade-chain/Tests/dump.reqtests sql/test/emptydb-upgrade-chain/Tests/dump.sql sql/test/emptydb-upgrade-chain/Tests/dump.stable.err sql/test/emptydb-upgrade-chain/Tests/dump.stable.err-noapprove sql/test/emptydb-upgrade-chain/Tests/dump.stable.out sql/test/emptydb-upgrade-chain/Tests/dump.stable.out-noapprove sql/test/emptydb-upgrade-chain/Tests/unpackage.py sql/test/emptydb-upgrade-chain/Tests/unpackage.stable.err sql/test/emptydb-upgrade-chain/Tests/unpackage.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.reqtests sql/test/emptydb-upgrade-chain/Tests/upgrade.sql sql/test/emptydb-upgrade-hge/Tests/dump.SQL.py.src sql/test/emptydb-upgrade-hge/Tests/dump.reqtests sql/test/emptydb-upgrade-hge/Tests/dump.sql sql/test/emptydb-upgrade-hge/Tests/dump.stable.err-noapprove sql/test/emptydb-upgrade-hge/Tests/dump.stable.err.int128 sql/test/emptydb-upgrade-hge/Tests/dump.stable.out-noapprove sql/test/emptydb-upgrade-hge/Tests/dump.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/unpackage.py sql/test/emptydb-upgrade-hge/Tests/unpackage.stable.err.int128 sql/test/emptydb-upgrade-hge/Tests/unpackage.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.reqtests sql/test/emptydb-upgrade-hge/Tests/upgrade.sql sql/test/emptydb-upgrade/Tests/dump.SQL.py.src sql/test/emptydb-upgrade/Tests/dump.reqtests sql/test/emptydb-upgrade/Tests/dump.sql sql/test/emptydb-upgrade/Tests/dump.stable.err sql/test/emptydb-upgrade/Tests/dump.stable.err-noapprove sql/test/emptydb-upgrade/Tests/dump.stable.out sql/test/emptydb-upgrade/Tests/dump.stable.out-noapprove sql/test/emptydb-upgrade/Tests/unpackage.py sql/test/emptydb-upgrade/Tests/unpackage.stable.err sql/test/emptydb-upgrade/Tests/unpackage.stable.out sql/test/emptydb-upgrade/Tests/upgrade.reqtests sql/test/emptydb-upgrade/Tests/upgrade.sql sql/test/emptydb/Tests/load.sql sql/test/emptydb/Tests/load.stable.err sql/test/emptydb/Tests/load.stable.out Modified Files: sql/test/emptydb-upgrade-chain-hge/Tests/All sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-chain/Tests/All sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-hge/Tests/All sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/All sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.SQL.py sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 testing/Mtest.py.in testing/Mz.py.in Branch: mtest Log Message: Converted emptydb* tests. diffs (truncated from 2458 to 300 lines): diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/All b/sql/test/emptydb-upgrade-chain-hge/Tests/All --- a/sql/test/emptydb-upgrade-chain-hge/Tests/All +++ b/sql/test/emptydb-upgrade-
MonetDB: properties - Propagation for div and sub functions
Changeset: bd50c650a7fd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bd50c650a7fd Modified Files: sql/server/rel_statistics_functions.c Branch: properties Log Message: Propagation for div and sub functions diffs (84 lines): diff --git a/sql/server/rel_statistics_functions.c b/sql/server/rel_statistics_functions.c --- a/sql/server/rel_statistics_functions.c +++ b/sql/server/rel_statistics_functions.c @@ -94,8 +94,53 @@ sql_add_propagate_statistics(mvc *sql, s } } +#define mul_and_sub_propagate(FUNC) \ +static void \ +sql_##FUNC##_propagate_statistics(mvc *sql, sql_exp *e) \ +{ \ + list *l = e->l; \ + sql_exp *first = l->h->data, *second = l->h->next->data; \ + ValPtr lmax, rmax, lmin, rmin; \ + \ + if ((lmax = find_prop_and_get(first->p, PROP_MAX)) && (rmax = find_prop_and_get(second->p, PROP_MAX)) && \ + (lmin = find_prop_and_get(first->p, PROP_MIN)) && (rmin = find_prop_and_get(second->p, PROP_MIN))) { \ + ValPtr res1 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)), res2 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); \ + gdk_return code1, code2; \ + \ + res1->vtype = res2->vtype = lmax->vtype > rmax->vtype ? lmax->vtype : rmax->vtype; \ + code1 = VARcalc##FUNC(res1, lmax, rmax, true); \ + GDKclrerr(); \ + code2 = VARcalc##FUNC(res2, lmin, rmin, true); \ + GDKclrerr(); \ + \ + if (code1 == GDK_SUCCEED && code2 == GDK_SUCCEED) { /* if the min/max pair overflows, then don't propagate */ \ + ValRecord zero1, zero2, zero3, zero4, verify1, verify2, verify3, verify4; \ + \ + VALzero_value(&zero1, lmax->vtype); \ + VARcalcge(&verify1, lmax, &zero1); \ + VALzero_value(&zero2, rmax->vtype); \ + VARcalcge(&verify2, rmax, &zero2); \ + VALzero_value(&zero3, lmin->vtype); \ + VARcalcge(&verify3, lmin, &zero3); \ + VALzero_value(&zero4, rmin->vtype); \ + VARcalcge(&verify4, rmin, &zero4); \ + \ + if (verify1.val.btval == 1 && verify2.val.btval == 1 && verify3.val.btval == 1 && verify4.val.btval == 1) { /* if all positive then propagate */ \ + copy_property(sql, e, PROP_MAX, res1); \ + copy_property(sql, e, PROP_MIN, res2); \ + } else if (verify1.val.btval == 0 && verify2.val.btval == 0 && verify3.val.btval == 0 && verify4.val.btval == 0) { /* if all negative propagate by swapping min and max */ \ + copy_property(sql, e, PROP_MIN, res1); \ + copy_property(sql, e, PROP_MAX, res2); \ + } \ + } \ + } \ +} + +mul_and_sub_propagate(sub) +mul_and_sub_propagate(mul) + static void -sql_mul_propagate_statistics(mvc *sql, sql_exp *e) +sql_div_propagate_statistics(mvc *sql, sql_exp *e) { list *l = e->l; sql_exp *first = l->h->data, *second = l->h->next->data; @@ -107,9 +152,9 @@ sql_mul_propagate_statistics(mvc *sql, s gdk_return code1, code2; res1->vtype = res2->vtype = lmax->vtype > rmax->vtype ? lmax->vtype : rmax->vtype; - code1 = VARcalcmul(res1, lmax, rmax, true); + code1 = VARcalcdiv(res1, lmax, rmin, true); GDKclrerr(); - code2 = VARcalcmul(res2, lmin, rmin, true); + code2 = VARcalcdiv(res2, lmin, rmax, true); GDKclrerr(); if (code1 == GDK_SUCCEED && code2 == GDK_SUCCEED) { /* if the min/max pair overflows, then don't propagate */ @@ -135,9 +180,11 @@ sql_mul_propagate_statistics(mvc *sql, s } } -static struct function_properties functions_list[2] = { +static struct function_properties functions_list[4] = { {"sql_add", &sql_add_propagate_statistics}, - {"sql_mul", &sql_mul_propagate_statistics} + {"sql_sub", &sql_sub_propagate_statistics}, + {"sql_mul", &sql_mul_propagate_statistics}, + {"sql_div", &sql_div_propagate_statistics} }; void ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Added test and expected out,err for Bug-7022
Changeset: d1c774305959 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d1c774305959 Added Files: sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.sql sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.err sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.out Modified Files: sql/test/BugTracker-2020/Tests/All Branch: Oct2020 Log Message: Added test and expected out,err for Bug-7022 diffs (167 lines): diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -36,3 +36,4 @@ txtsim-parallel.Bug-7016 release_old_savepoint.Bug-7020 savepoints_crash_mserver5_1.Bug-7021 savepoints_crash_mserver5_2.Bug-7021 +transaction_with_unreleased_savepoint.Bug-7022 diff --git a/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.sql b/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.sql @@ -0,0 +1,33 @@ +-- this works +start transaction; +create table savepointtest (id int, primary key(id)); +savepoint name1; +insert into savepointtest values(24); +release savepoint name1; +commit; +select * from tables where name = 'savepointtest'; +select * from savepointtest; + +create table savepointtest (id int, primary key(id)); +insert into savepointtest values(42); +select * from tables where name = 'savepointtest'; +select * from savepointtest; +drop table savepointtest; +select * from tables where name = 'savepointtest'; + +-- this shows errors +start transaction; +create table savepointtest (id int, primary key(id)); +savepoint name1; +insert into savepointtest values(24); +commit; +select * from tables where name = 'savepointtest'; +select * from savepointtest; + +create table savepointtest (id int, primary key(id)); +insert into savepointtest values(42); +select * from tables where name = 'savepointtest'; +-- the 2nd 'savepointtest` is used by SELECT and DROP +select * from savepointtest; +drop table savepointtest; +select * from tables where name = 'savepointtest'; diff --git a/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.err b/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.err @@ -0,0 +1,20 @@ +stderr of test 'transaction_with_unreleased_savepoint.Bug-7022` in directory 'sql/test/BugTracker-2020` itself: + + +# 14:14:39 > +# 14:14:39 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-162442" "--port=32313" +# 14:14:39 > + +MAPI = (monetdb) /var/tmp/mtest-162442/.s.monetdb.32313 +QUERY = create table savepointtest (id int, primary key(id)); +ERROR = !CREATE TABLE: name 'savepointtest' already in use +CODE = 42S01 +MAPI = (monetdb) /var/tmp/mtest-162442/.s.monetdb.32313 +QUERY = create table savepointtest (id int, primary key(id)); +ERROR = !CREATE TABLE: name 'savepointtest' already in use +CODE = 42S01 + +# 14:14:40 > +# 14:14:40 > "Done." +# 14:14:40 > + diff --git a/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.out b/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/transaction_with_unreleased_savepoint.Bug-7022.stable.out @@ -0,0 +1,91 @@ +stdout of test 'transaction_with_unreleased_savepoint.Bug-7022` in directory 'sql/test/BugTracker-2020` itself: + + +# 14:14:39 > +# 14:14:39 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-162442" "--port=32313" +# 14:14:39 > + +#start transaction; +#create table savepointtest (id int, primary key(id)); +#savepoint name1; +#insert into savepointtest values(24); +[ 1] +#release savepoint name1; +#commit; +#select * from tables where name = 'savepointtest'; +% .tables, .tables,.tables,.tables,.tables, .tables,.tables,.tables,.tables # table_name +% id, name, schema_id, query, type, system, commit_action, access, temporary # name +% int, varchar,int,varchar,smallint, boolean, smallint, smallint, tinyint # type +% 4, 13, 4, 0, 1, 5, 1, 1, 1 # length +[ 7399,"savepointtest",2000, NULL, 0, false, 0, 0, 0 ] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 2 # length +[ 24 ] +#insert into savepointtest values(42); +[ 1] +#select * from tables where name
MonetDB: mtest - Approve special output.
Changeset: d9bfd4a5c433 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d9bfd4a5c433 Modified Files: sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit Branch: mtest Log Message: Approve special output. diffs (24 lines): diff --git a/sql/test/emptydb/Tests/check.stable.out b/sql/test/emptydb/Tests/check.stable.out --- a/sql/test/emptydb/Tests/check.stable.out +++ b/sql/test/emptydb/Tests/check.stable.out @@ -2179,7 +2179,7 @@ drop function pcre_replace(string, strin % .%1, .s, .f, ., ., .f, .fl,., .f, .f, .f, .f, ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., . # table_name % %1, name, name, system, query, mod,language_name, func_type, side_effect,varres, vararg, semantics, name0, type0, type_digits0, type_scale0,inout0, name1, type1, type_digits1, type_scale1,inout1, name2, type2, type_digits2, type_scale2,inout2, name3, type3, type_digits3, type_scale3,inout3, name4, type4, type_digits4, type_scale4,inout4, name5, type5, type_digits5, type_scale5,inout5, name6, type6, type_digits6, type_scale6,inout6, name7, type7, type_digits7, type_scale7,inout7, name8, type8, type_digits8, type_scale8,inout8, name9, type9, type_digits9, type_scale9,inout9, name10, type10, type_digits10, type_scale10, inout10,name11, type11, type_digits11, type_scale11, inout11,name12, type12, type_digits12, type_scale12, inout12,name13, type13, type_digits13, type_scale13, inout13,name14, type14, type_digits14, type_scale14, inout14, name15, type15, type_digits15, type_scale15, inout15 # name % char,varchar,varchar,char, varchar, varchar,varchar,varchar,boolean,boolean, boolean,boolean,varchar,varchar,int,int, char, varchar,varchar,int,int,char, varchar, varchar,int,int,char, varchar,varchar,int, int,char, varchar,varchar,int,int,char, varchar,varchar,int,int,char, varchar, varchar,int,int,char, varchar,varchar,int, int,char, varchar,varchar,int,int,char, varchar,varchar,int,int,char, varchar, varchar,int,int,char, varchar,varchar,int, int,char, varchar,varchar,int,int,char, varchar,varchar,int,int,char, varchar, varchar,int,int,char, varchar,varchar,int, int,char # type -% 13, 8, 24, 6, 3404, 9, 10, 26, 5, 5, 5, 5, 11, 14, 4, 1, 3, 16, 14, 4, 1, 3, 16, 14, 4, 1, 3, 27, 12, 4, 1, 3, 9, 9, 2, 1, 3, 14, 14, 4, 1, 3, 12, 14, 3, 1, 3, 11, 7, 2, 1, 3, 11, 7, 2, 1, 3, 10, 6, 2, 1, 3, 9, 6, 2, 1, 3, 6, 7, 2, 1, 3, 8, 7, 2, 1, 3, 6, 7, 2, 1, 3, 9, 7, 1, 1, 3, 6, 7, 1, 1, 3 # length +% 13, 8, 24, 6, 3404, 9, 10, 26, 5, 5, 5, 5, 11, 14, 4, 1, 3, 16, 14, 4, 1, 3, 16, 14, 4, 1, 3, 27, 12, 4, 1, 3, 9, 9, 2, 1, 3, 14, 14, 4, 1, 3, 12, 14, 2, 1, 3, 11, 7, 2, 1, 3, 11, 7, 2, 1, 3, 10, 6, 2, 1, 3, 9, 6, 2, 1, 3, 6, 7, 2, 1, 3, 8, 7, 2, 1, 3, 6, 7, 2, 1, 3, 9, 7, 1, 1, 3, 6, 7, 1, 1, 3 # length [ "sys.functions",
MonetDB: properties - Propagate statistics of trivial functions ...
Changeset: 94cc1d6f4f27 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94cc1d6f4f27 Modified Files: sql/server/rel_statistics.c sql/server/rel_statistics.h sql/server/rel_statistics_functions.c Branch: properties Log Message: Propagate statistics of trivial functions and cleanup diffs (truncated from 416 to 300 lines): diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c --- a/sql/server/rel_statistics.c +++ b/sql/server/rel_statistics.c @@ -66,9 +66,9 @@ rel_propagate_column_ref_statistics(mvc if ((ne = comparison_find_column(le, e)) || (rne = comparison_find_column(re, e))) { if (is_outerjoin(rel->op)) { if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MAX))) - copy_property(sql, e, PROP_MAX, lval); + set_property(sql, e, PROP_MAX, lval); if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MIN))) - copy_property(sql, e, PROP_MIN, lval); + set_property(sql, e, PROP_MIN, lval); } else { if ((lval = find_prop_and_get(le->p, PROP_MAX)) && (rval = find_prop_and_get(re->p, PROP_MAX))) set_min_of_values(sql, e, PROP_MAX, lval, rval); /* for equality reduce */ @@ -84,9 +84,9 @@ rel_propagate_column_ref_statistics(mvc if ((ne = comparison_find_column(le, e)) || (rne = comparison_find_column(re, e))) { if (is_outerjoin(rel->op)) { if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MAX))) - copy_property(sql, e, PROP_MAX, lval); + set_property(sql, e, PROP_MAX, lval); if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MIN))) - copy_property(sql, e, PROP_MIN, lval); + set_property(sql, e, PROP_MIN, lval); } else { if ((lval = find_prop_and_get(le->p, PROP_MAX)) && (rval = find_prop_and_get(re->p, PROP_MAX))) set_max_of_values(sql, e, PROP_MAX, lval, rval); /* for inequality expand */ @@ -104,19 +104,19 @@ rel_propagate_column_ref_statistics(mvc if ((ne = comparison_find_column(le, e)) || (rne = comparison_find_column(re, e))) { if (is_outerjoin(rel->op)) { if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MAX))) - copy_property(sql, e, PROP_MAX, lval); + set_property(sql, e, PROP_MAX, lval); if ((lval = find_prop_and_get(le ? le->p : re->p, PROP_MIN))) - copy_property(sql, e, PROP_MIN, lval); + set_property(sql, e, PROP_MIN, lval); } else if (ne) { if ((lval = find_prop_and_get(le->p, PROP_MAX))) - copy_property(sql, e, PROP_MAX, lval); + set_property(sql, e, PROP_MAX, lval); if ((rval = find_prop_and_get(re->p, PROP_MAX))) - copy_property(sql, e, PROP_MIN, rval); + set_property(sql, e, PROP_MIN, rval);
MonetDB: Oct2020 - plumming some more leaks
Changeset: 1460a6e48679 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1460a6e48679 Modified Files: monetdb5/mal/mal_interpreter.c Branch: Oct2020 Log Message: plumming some more leaks diffs (20 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -764,9 +764,16 @@ str runMALsequence(Client cntxt, MalBlkP } if (ret == MAL_SUCCEED && ii == pci->argc) { ret = runMALsequence(cntxt, pci->blk, 1, pci->blk->stop, nstk, stk, pci); + //garbageCollector(cntxt, pci->blk, nstk, 0); for (ii = 0; ii < nstk->stktop; ii++) if (ATOMextern(nstk->stk[ii].vtype)) GDKfree(nstk->stk[ii].val.pval); + arg = q->retc; + for (ii = pci->retc; ii < pci->argc; ii++,arg++) { + lhs = &nstk->stk[q->argv[arg]]; + if (lhs->vtype == TYPE_bat) + BBPrelease(lhs->val.bval); + } GDKfree(nstk); } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - merged with Oct2020
Changeset: 5769ac120b14 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5769ac120b14 Modified Files: sql/backends/monet5/sql_execute.c sql/test/BugTracker-2020/Tests/All Branch: default Log Message: merged with Oct2020 diffs (truncated from 398 to 300 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -764,9 +764,16 @@ str runMALsequence(Client cntxt, MalBlkP } if (ret == MAL_SUCCEED && ii == pci->argc) { ret = runMALsequence(cntxt, pci->blk, 1, pci->blk->stop, nstk, stk, pci); + //garbageCollector(cntxt, pci->blk, nstk, 0); for (ii = 0; ii < nstk->stktop; ii++) if (ATOMextern(nstk->stk[ii].vtype)) GDKfree(nstk->stk[ii].val.pval); + arg = q->retc; + for (ii = pci->retc; ii < pci->argc; ii++,arg++) { + lhs = &nstk->stk[q->argv[arg]]; + if (lhs->vtype == TYPE_bat) + BBPrelease(lhs->val.bval); + } GDKfree(nstk); } } diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -206,6 +206,7 @@ SQLrun(Client c, mvc *m) *m->errstr=0; return msg; } + TRC_INFO(SQL_EXECUTION, "Executing: %s", c->query); MT_thread_setworking(c->query); // locate and inline the query template instruction mb = copyMalBlk(c->curprg->def); diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -35,3 +35,6 @@ deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 release_old_savepoint.Bug-7020 +savepoints_crash_mserver5_1.Bug-7021 +savepoints_crash_mserver5_2.Bug-7021 +transaction_with_unreleased_savepoint.Bug-7022 diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql @@ -0,0 +1,15 @@ +-- triggers a SIGSEGV in sql/storage/store.c:185: if (--(i->base.refcnt) > 0) +start transaction; +create table savepointtest (id int, primary key(id)); +savepoint name1; +insert into savepointtest values(1), (2), (3); +savepoint name2; +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +--savepoint name3; +select * from savepointtest; +commit; + +select 42; +select * from savepointtest; + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err @@ -0,0 +1,12 @@ +stderr of test 'savepoints_crash_mserver5_1.Bug-7021` in directory 'sql/test/BugTracker-2020` itself: + + +# 11:57:43 > +# 11:57:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-153790" "--port=36420" +# 11:57:43 > + + +# 11:57:44 > +# 11:57:44 > "Done." +# 11:57:44 > + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out @@ -0,0 +1,57 @@ +stdout of test 'savepoints_crash_mserver5_1.Bug-7021` in directory 'sql/test/BugTracker-2020` itself: + + +# 11:57:43 > +# 11:57:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-153790" "--port=36420" +# 11:57:43 > + +#start transaction; +#create table savepointtest (id int, primary key(id)); +#savepoint name1; +#insert into savepointtest values(1), (2), (3); +[ 3] +#savepoint name2; +#insert into savepointtest values(4), (5), (6); +[ 3] +#insert into savepointtest values(7), (8), (9); +[ 3] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +[ 4] +[ 5] +[ 6] +[ 7] +[ 8] +[ 9] +#commit; +#select 42; +% .%2 # table_name +% %2 # na
MonetDB: mtest - merged with default
Changeset: a8d28d9e8a4a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a8d28d9e8a4a Modified Files: sql/test/BugTracker-2020/Tests/All Branch: mtest Log Message: merged with default diffs (truncated from 398 to 300 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -764,9 +764,16 @@ str runMALsequence(Client cntxt, MalBlkP } if (ret == MAL_SUCCEED && ii == pci->argc) { ret = runMALsequence(cntxt, pci->blk, 1, pci->blk->stop, nstk, stk, pci); + //garbageCollector(cntxt, pci->blk, nstk, 0); for (ii = 0; ii < nstk->stktop; ii++) if (ATOMextern(nstk->stk[ii].vtype)) GDKfree(nstk->stk[ii].val.pval); + arg = q->retc; + for (ii = pci->retc; ii < pci->argc; ii++,arg++) { + lhs = &nstk->stk[q->argv[arg]]; + if (lhs->vtype == TYPE_bat) + BBPrelease(lhs->val.bval); + } GDKfree(nstk); } } diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -206,6 +206,7 @@ SQLrun(Client c, mvc *m) *m->errstr=0; return msg; } + TRC_INFO(SQL_EXECUTION, "Executing: %s", c->query); MT_thread_setworking(c->query); // locate and inline the query template instruction mb = copyMalBlk(c->curprg->def); diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -35,3 +35,6 @@ deallocate-id.Bug-7010 values-groupby.Bug-7013 txtsim-parallel.Bug-7016 release_old_savepoint.Bug-7020 +savepoints_crash_mserver5_1.Bug-7021 +savepoints_crash_mserver5_2.Bug-7021 +transaction_with_unreleased_savepoint.Bug-7022 diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.sql @@ -0,0 +1,15 @@ +-- triggers a SIGSEGV in sql/storage/store.c:185: if (--(i->base.refcnt) > 0) +start transaction; +create table savepointtest (id int, primary key(id)); +savepoint name1; +insert into savepointtest values(1), (2), (3); +savepoint name2; +insert into savepointtest values(4), (5), (6); +insert into savepointtest values(7), (8), (9); +--savepoint name3; +select * from savepointtest; +commit; + +select 42; +select * from savepointtest; + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.err @@ -0,0 +1,12 @@ +stderr of test 'savepoints_crash_mserver5_1.Bug-7021` in directory 'sql/test/BugTracker-2020` itself: + + +# 11:57:43 > +# 11:57:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-153790" "--port=36420" +# 11:57:43 > + + +# 11:57:44 > +# 11:57:44 > "Done." +# 11:57:44 > + diff --git a/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/savepoints_crash_mserver5_1.Bug-7021.stable.out @@ -0,0 +1,57 @@ +stdout of test 'savepoints_crash_mserver5_1.Bug-7021` in directory 'sql/test/BugTracker-2020` itself: + + +# 11:57:43 > +# 11:57:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-153790" "--port=36420" +# 11:57:43 > + +#start transaction; +#create table savepointtest (id int, primary key(id)); +#savepoint name1; +#insert into savepointtest values(1), (2), (3); +[ 3] +#savepoint name2; +#insert into savepointtest values(4), (5), (6); +[ 3] +#insert into savepointtest values(7), (8), (9); +[ 3] +#select * from savepointtest; +% sys.savepointtest # table_name +% id # name +% int # type +% 1 # length +[ 1] +[ 2] +[ 3] +[ 4] +[ 5] +[ 6] +[ 7] +[ 8] +[ 9] +#commit; +#select 42; +% .%2 # table_name +% %2 # name +% tinyint # type +% 2 # length +[ 42 ]
MonetDB: properties - Statistics for sql_neg
Changeset: c92b3e3f75d0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c92b3e3f75d0 Modified Files: sql/server/rel_statistics_functions.c Branch: properties Log Message: Statistics for sql_neg diffs (73 lines): diff --git a/sql/server/rel_statistics_functions.c b/sql/server/rel_statistics_functions.c --- a/sql/server/rel_statistics_functions.c +++ b/sql/server/rel_statistics_functions.c @@ -77,8 +77,8 @@ sql_##FUNC##_propagate_statistics(mvc *s set_property(sql, e, PROP_MAX, res1); \ set_property(sql, e, PROP_MIN, res2); \ } else if (verify1.val.btval == 0 && verify2.val.btval == 0 && verify3.val.btval == 0 && verify4.val.btval == 0) { /* if all negative propagate by swapping min and max */ \ + set_property(sql, e, PROP_MAX, res2); \ set_property(sql, e, PROP_MIN, res1); \ - set_property(sql, e, PROP_MAX, res2); \ } \ } \ } \ @@ -118,8 +118,8 @@ sql_div_propagate_statistics(mvc *sql, s set_property(sql, e, PROP_MAX, res1); set_property(sql, e, PROP_MIN, res2); } else if (verify1.val.btval == 0 && verify2.val.btval == 0 && verify3.val.btval == 0 && verify4.val.btval == 0) { /* if all negative propagate by swapping min and max */ + set_property(sql, e, PROP_MAX, res2); set_property(sql, e, PROP_MIN, res1); - set_property(sql, e, PROP_MAX, res2); } } } @@ -181,11 +181,48 @@ sql_nullif_propagate_statistics(mvc *sql } } -static struct function_properties functions_list[10] = { +static void +sql_neg_propagate_statistics(mvc *sql, sql_exp *e) +{ + list *l = e->l; + sql_exp *first = l->h->data; + ValPtr lval; + sql_subtype *tp = ((sql_subfunc *)e->f)->res->h->data; + + if ((lval = find_prop_and_get(first->p, PROP_MIN))) { + ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + ValRecord minus1 = (ValRecord) {.vtype = TYPE_bte, .val.btval = -1}; + ptr pt = VALconvert(tp->type->localtype, &minus1); + + assert(pt); + res->vtype = lval->vtype; + if (VARcalcmul(res, lval, &minus1, true) == GDK_SUCCEED) { + set_property(sql, e, PROP_MAX, res); + } else { + GDKclrerr(); + } + } + if ((lval = find_prop_and_get(first->p, PROP_MAX))) { + ValPtr res = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + ValRecord minus1 = (ValRecord) {.vtype = TYPE_bte, .val.btval = -1}; + ptr pt = VALconvert(tp->type->localtype, &minus1); + + assert(pt); + res->vtype = lval->vtype; + if (VARcalcmul(res, lval, &minus1, true) == GDK_SUCCEED) { + set_property(sql, e, PROP_MIN, res); + } else { + GDKclrerr(); + } + } +} + +static struct function_properties functions_list[11] = { {"sql_add", &sql_add_propagate_statistics}, {"sql_sub", &sql_sub_propagate_statistics}, {"sql_mul", &sql_mul_propagate_statistics}, {"sql_div", &sql_div_propagate_statistics}, + {"sql_neg", &sql_neg_propagate_statistics}, {"sql_min", &sql_least_greatest_propagate_statistics}, {"sql_max", &sql_least_greatest_propagate_statistics}, {"least", &sql_least_greatest_propagate_statistics}, ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Added test and expected out,err for Bug-7023
Changeset: cdb5f4604dd0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cdb5f4604dd0 Added Files: sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.sql sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.err sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.out Modified Files: sql/test/BugTracker-2020/Tests/All Branch: Oct2020 Log Message: Added test and expected out,err for Bug-7023 diffs (69 lines): diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -37,3 +37,4 @@ release_old_savepoint.Bug-7020 savepoints_crash_mserver5_1.Bug-7021 savepoints_crash_mserver5_2.Bug-7021 transaction_with_unreleased_savepoint.Bug-7022 +view_with_aggr_column.Bug-7023 diff --git a/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.sql b/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.sql @@ -0,0 +1,6 @@ +create table tst (k integer not null, name char(20) not null); +-- this works +select min(k) from tst group by name; +-- but putting it in a VIEW doesn't +create view v1 as select max(k) from tst group by name; +select * from v1; diff --git a/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.err b/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.err @@ -0,0 +1,16 @@ +stderr of test 'view_with_aggr_column.Bug-7023` in directory 'sql/test/BugTracker-2020` itself: + + +# 15:22:56 > +# 15:22:56 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-177928" "--port=37553" +# 15:22:56 > + +MAPI = (monetdb) /var/tmp/mtest-177928/.s.monetdb.37553 +QUERY = select * from v1; + +CODE = 42000 + +# 15:22:56 > +# 15:22:56 > "Done." +# 15:22:56 > + diff --git a/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.out b/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/view_with_aggr_column.Bug-7023.stable.out @@ -0,0 +1,24 @@ +stdout of test 'view_with_aggr_column.Bug-7023` in directory 'sql/test/BugTracker-2020` itself: + + +# 15:22:56 > +# 15:22:56 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-177928" "--port=37553" +# 15:22:56 > + +#create table tst (k integer not null, name char(20) not null); +#select min(k) from tst group by name; +% sys.%1 # table_name +% %1 # name +% int # type +% 1 # length +#create view v1 as select max(k) from tst group by name; +#select * from v1; +% sys.%1 # table_name +% %1 # name +% int # type +% 1 # length + +# 15:22:56 > +# 15:22:56 > "Done." +# 15:22:56 > + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - set loglevel too FATAL (only log fatal messages).
Changeset: a3e4fead492d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a3e4fead492d Modified Files: sql/test/Users/Tests/changePasswordUser.SQL.py sql/test/Users/Tests/createUserRollback.SQL.py sql/test/Users/Tests/unknown_user.SQL.py Branch: mtest Log Message: set loglevel too FATAL (only log fatal messages). diffs (38 lines): diff --git a/sql/test/Users/Tests/changePasswordUser.SQL.py b/sql/test/Users/Tests/changePasswordUser.SQL.py --- a/sql/test/Users/Tests/changePasswordUser.SQL.py +++ b/sql/test/Users/Tests/changePasswordUser.SQL.py @@ -4,6 +4,9 @@ ### from MonetDBtesting.sqltest import SQLTestCase +import logging + +logging.basicConfig(level=logging.FATAL) with SQLTestCase() as tc: tc.connect(username="monetdb", password="monetdb") diff --git a/sql/test/Users/Tests/createUserRollback.SQL.py b/sql/test/Users/Tests/createUserRollback.SQL.py --- a/sql/test/Users/Tests/createUserRollback.SQL.py +++ b/sql/test/Users/Tests/createUserRollback.SQL.py @@ -1,5 +1,8 @@ from MonetDBtesting.sqltest import SQLTestCase +import logging + +logging.basicConfig(level=logging.FATAL) with SQLTestCase() as tc: tc.connect(username="monetdb", password="monetdb") 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 @@ -3,6 +3,9 @@ ### from MonetDBtesting.sqltest import SQLTestCase +import logging + +logging.basicConfig(level=logging.FATAL) err_msg = "InvalidCredentialsException:checkCredentials:invalid credentials for user 'this_user_does_not_exist'".strip() ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: properties - Statistics for sign and abs
Changeset: cf8e063d3e77 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cf8e063d3e77 Modified Files: sql/server/rel_statistics_functions.c Branch: properties Log Message: Statistics for sign and abs diffs (91 lines): diff --git a/sql/server/rel_statistics_functions.c b/sql/server/rel_statistics_functions.c --- a/sql/server/rel_statistics_functions.c +++ b/sql/server/rel_statistics_functions.c @@ -217,12 +217,86 @@ sql_neg_propagate_statistics(mvc *sql, s } } -static struct function_properties functions_list[11] = { +static void +sql_sign_propagate_statistics(mvc *sql, sql_exp *e) +{ + list *l = e->l; + sql_exp *first = l->h->data; + ValPtr omin, omax, res1 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)), res2 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + ValRecord minus1 = (ValRecord) {.vtype = TYPE_bte, .val.btval = -1}, plus1 = (ValRecord) {.vtype = TYPE_bte, .val.btval = 1}; + bool properties_set = false; + + if ((omin = find_prop_and_get(first->p, PROP_MIN)) && (omax = find_prop_and_get(first->p, PROP_MAX))) { + ValRecord zero1 = (ValRecord) {.vtype = omin->vtype,}, zero2 = (ValRecord) {.vtype = omax->vtype,}, verify1, verify2, verify3, verify4; + + VARcalcgt(&verify1, omin, &zero1); + VARcalcgt(&verify2, omax, &zero2); + VARcalclt(&verify3, omin, &zero1); + VARcalclt(&verify4, omax, &zero2); + + if (verify1.val.btval == 1 && verify2.val.btval == 1) { + VALcopy(res1, &plus1); + VALcopy(res2, &plus1); + set_property(sql, e, PROP_MAX, res1); + set_property(sql, e, PROP_MIN, res2); + properties_set = true; + } else if (verify3.val.btval == 1 && verify4.val.btval == 1) { + VALcopy(res1, &minus1); + VALcopy(res2, &minus1); + set_property(sql, e, PROP_MAX, res1); + set_property(sql, e, PROP_MIN, res2); + properties_set = true; + } + } + if (!properties_set) { + VALcopy(res1, &plus1); + VALcopy(res2, &minus1); + set_property(sql, e, PROP_MAX, res1); + set_property(sql, e, PROP_MIN, res2); + } +} + +static void +sql_abs_propagate_statistics(mvc *sql, sql_exp *e) +{ + list *l = e->l; + sql_exp *first = l->h->data; + ValPtr omin, omax, res1 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)), res2 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + + if ((omin = find_prop_and_get(first->p, PROP_MIN)) && (omax = find_prop_and_get(first->p, PROP_MAX))) { + ValRecord zero1 = (ValRecord) {.vtype = omin->vtype,}, zero2 = (ValRecord) {.vtype = omax->vtype,}, verify1, verify2, verify3, verify4; + + VARcalcge(&verify1, omin, &zero1); + VARcalcge(&verify2, omax, &zero2); + VARcalcle(&verify3, omin, &zero1); + VARcalcle(&verify4, omax, &zero2); + + if (verify1.val.btval == 1 && verify2.val.btval == 1) { + gdk_return code1 = VARcalcabsolute(res1, omax); + gdk_return code2 = VARcalcabsolute(res2, omin); + + assert(code1 && code2); + set_property(sql, e, PROP_MAX, res1); + set_property(sql, e, PROP_MIN, res2); + } else if (verify3.val.btval == 1 && verify4.val.btval == 1) { + gdk_return code1 = VARcalcabsolute(res1, omax); + gdk_return code2 = VARcalcabsolute(res2, omin); + + assert(code1 && code2); + set_property(sql, e, PROP_MAX, res2); + set_property(sql, e, PROP_MIN, res1); + } + } +} + +static struct function_properties functions_list[13] = { {"sql_add", &sql_add_propagate_statistics}, {"sql_sub", &sql_sub_propagate_statistics}, {"sql_mul", &sql_mul_propagate_statistics}, {"sql_div", &sql_div_propagate_statistics}, {"sql_neg", &sql_neg_propagate_statistics}, + {"sign", &sql_sign_propagate_statistics}, + {"abs", &sql_abs_propagate_statistics}, {"sql_min", &sql_least_greatest_propagate_statistics}, {"sql_max", &sql_least_greatest_propagate_statistics}, {"least", &sql_least_greatest_propagate_statistics}, ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Cleaned up the as3ap queries.
Changeset: aa316c2a3c58 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aa316c2a3c58 Added Files: sql/test/Tests/as3ap.sql sql/test/Tests/as3ap.test Removed Files: sql/test/as3ap-bugs.sql sql/test/as3ap.sql Modified Files: sql/test/Tests/All Branch: mtest Log Message: Cleaned up the as3ap queries. Moved the remaining ones to a proper place and test them. When Issue #7023 is fixed, the commented out queries should be enabled. diffs (truncated from 952 to 300 lines): diff --git a/sql/test/Tests/All b/sql/test/Tests/All --- a/sql/test/Tests/All +++ b/sql/test/Tests/All @@ -133,8 +133,13 @@ HAVE_PYTHON_LZ4&HAVE_PYMONETDB&HAVE_LIBL foreign_key ## IN operator in SELECT and type checking in -## Don't know what it tests. Maybe it's no longer a challenge for MDB +## Don't know what problem it used to test. Probably no longer an issue. meltdown savepoints1 savepoints2 union +## Queries from the old AS3AP benchmark. +## Since we don't have the data, let's just execute the queries here +## Commented-out queries suffer from the problem reported in Issue #7023 +as3ap + diff --git a/sql/test/as3ap.sql b/sql/test/Tests/as3ap.sql rename from sql/test/as3ap.sql rename to sql/test/Tests/as3ap.sql --- a/sql/test/as3ap.sql +++ b/sql/test/Tests/as3ap.sql @@ -1,116 +1,230 @@ -/*database as3ap; -*/ +start transaction; + create table uniques(k integer not null, i integer not null, si integer , f float not null, d double not null, decim integer not null, date date not null, code char(10) not null, name char(20) not null, address string not null, fill char(6) not null); + create table hundred(k integer not null, i integer not null, si integer , f float not null, d double not null, decim integer not null, date date not null, code char(10) not null, name char(20) not null, address string not null, fill char(6) not null); + create table tenpct(k integer not null, i integer not null, si integer , f float not null, d double not null, decim integer not null, date date not null, code char(10) not null, name char(20) not null, address string not null, fill char(6) not null); + create table updates(k integer not null, i integer not null, si integer , f float not null, d double not null, decim integer not null, date date not null, code char(10) not null, name char(20) not null, address string not null, fill char(6) not null); + create table tiny(k integer not null); -/* -copy table uniques(k=c0, i=c0, si=c0, f=c0, d=c0, decim=c0, date=c0, code=c0, name=c0, address=c0, fill=c0)from 'uniques'; -copy table hundred(k=c0, i=c0, si=c0, f=c0, d=c0, decim=c0, date=c0, code=c0, name=c0, address=c0, fill=c0)from 'hundred'; -copy table tenpct(k=c0, i=c0, si=c0, f=c0, d=c0, decim=c0, date=c0, code=c0, name=c0, address=c0, fill=c0)from 'tenpct'; -copy table updates(k=c0, i=c0, si=c0, f=c0, d=c0, decim=c0, date=c0, code=c0, name=c0, address=c0, fill=c0)from 'updates'; -insert into tiny(k)values(0); -copy table updates(k=c0, i=c0, si=c0, f=c0, d=c0, decim=c0, date=c0, code=c0, name=c0, address=c0, fill=c0)into 'updates.bu'; -*/ -create view _AS3AP_o_mode_tiny as - select * from tiny; -create view _AS3AP_sel_1_cl as - select k, i, si, code, d, name from updates where k=1000; -create view _AS3AP_o_mode_1k as - select * from updates where k<=10; -create view _AS3AP_o_mode_10k as - select * from hundred where k<=100; -create view _AS3AP_o_mode_100k as - select * from hundred where k<=1000; + +create view _AS3AP_o_mode_tiny as select * from tiny; + +select * from _AS3AP_o_mode_tiny; + +create view _AS3AP_sel_1_cl as select k, i, si, code, d, name from updates where k=1000; + +select * from _AS3AP_sel_1_cl; + +create view _AS3AP_o_mode_1k as select * from updates where k<=10; + +select * from _AS3AP_o_mode_1k; + +create view _AS3AP_o_mode_10k as select * from hundred where k<=100; + +select * from _AS3AP_o_mode_10k; + +create view _AS3AP_o_mode_100k as select * from hundred where k<=1000; + +select * from _AS3AP_o_mode_100k; + create table _AS3AP_join_3_cl(us integer , ud date , hs integer , hd date , ts integer , td date ); -insert into _AS3AP_join_3_cl - select uniques.si, uniques.date, hundred.si, - hundred.date, tenpct.si, tenpct.date - from uniques, hundred, tenpct - where uniques.k=hundred.k - and uniques.k=tenpct.k and uniques.k=1000; -create view _AS3AP_sel_100_ncl as select k, i, si, code, d, name - from updates where k<=100; -create view _AS3AP_table_scan as - select * from uniques where i=1; -create view _AS3AP_func_agg as - select min(k)from hundred group by name; -create view _AS3AP_scal_agg as - select min(k)from uniques; -create view _AS3AP_sel_100_cl as - select k, i, si, code, d, name from updates where k<=100; + +insert into _AS3AP_join_3_cl select uniques.si, uniques.date, hundred.si, hundred.date, te
MonetDB: properties - min/max for coalesce
Changeset: 73584ff38ca3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=73584ff38ca3 Modified Files: sql/server/rel_statistics_functions.c Branch: properties Log Message: min/max for coalesce diffs (64 lines): diff --git a/sql/server/rel_statistics_functions.c b/sql/server/rel_statistics_functions.c --- a/sql/server/rel_statistics_functions.c +++ b/sql/server/rel_statistics_functions.c @@ -289,7 +289,49 @@ sql_abs_propagate_statistics(mvc *sql, s } } -static struct function_properties functions_list[13] = { +static void +sql_coalesce_propagate_statistics(mvc *sql, sql_exp *e) +{ + list *l = e->l; + sql_exp *first = l->h->data; + ValPtr curmin = NULL, curmax = NULL, lval; + + if ((lval = find_prop_and_get(first->p, PROP_MAX))) + curmax = lval; + if ((lval = find_prop_and_get(first->p, PROP_MIN))) + curmin = lval; + for (node *n = l->h->next ; n && curmin && curmax ; n = n->next) { + sql_exp *next = n->data; + + if ((lval = find_prop_and_get(next->p, PROP_MAX))) { + ValRecord verify1; + + VARcalcgt(&verify1, lval, curmax); + curmax = verify1.val.btval == 1 ? lval : curmax; + } else { + curmax = NULL; + } + if ((lval = find_prop_and_get(next->p, PROP_MIN))) { + ValRecord verify1; + + VARcalcgt(&verify1, lval, curmin); + curmin = verify1.val.btval == 1 ? curmin : lval; + } else { + curmin = NULL; + } + } + + if (curmin && curmax) { + ValPtr res1 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)), res2 = (ValPtr) sa_zalloc(sql->sa, sizeof(ValRecord)); + + VALcopy(res2, curmax); + VALcopy(res1, curmin); + set_property(sql, e, PROP_MAX, res2); + set_property(sql, e, PROP_MIN, res1); + } +} + +static struct function_properties functions_list[14] = { {"sql_add", &sql_add_propagate_statistics}, {"sql_sub", &sql_sub_propagate_statistics}, {"sql_mul", &sql_mul_propagate_statistics}, @@ -302,7 +344,8 @@ static struct function_properties functi {"least", &sql_least_greatest_propagate_statistics}, {"greatest", &sql_least_greatest_propagate_statistics}, {"ifthenelse", &sql_ifthenelse_propagate_statistics}, - {"nullif", &sql_nullif_propagate_statistics} + {"nullif", &sql_nullif_propagate_statistics}, + {"coalesce", &sql_coalesce_propagate_statistics} }; void ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: properties - Merged with default
Changeset: af85cbb73bbb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af85cbb73bbb Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/sql_execute.c sql/server/rel_exp.c Branch: properties Log Message: Merged with default diffs (truncated from 731 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -786,11 +786,6 @@ fi %setup -q %build -%if (0%{?fedora} >= 33) -# on Fedora 33 we get a crash of the compiler when using -flto, so disable it -CFLAGS="${CFLAGS:-%optflags} -fno-lto" -export CFLAGS -%endif %cmake3 \ -DRELEASE_VERSION=ON \ -DASSERT=OFF \ diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -3182,6 +3182,7 @@ bm_commit(logger *lg, lng save_id) return GDK_FAIL; } BBPrelease(bid); + assert(BBP_lrefs(bid)<=0 && BBP_refs(bid)==0); } if (leftover) { nfreed = logbat_new(TYPE_int, leftover, TRANSIENT); diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -764,9 +764,16 @@ str runMALsequence(Client cntxt, MalBlkP } if (ret == MAL_SUCCEED && ii == pci->argc) { ret = runMALsequence(cntxt, pci->blk, 1, pci->blk->stop, nstk, stk, pci); + //garbageCollector(cntxt, pci->blk, nstk, 0); for (ii = 0; ii < nstk->stktop; ii++) if (ATOMextern(nstk->stk[ii].vtype)) GDKfree(nstk->stk[ii].val.pval); + arg = q->retc; + for (ii = pci->retc; ii < pci->argc; ii++,arg++) { + lhs = &nstk->stk[q->argv[arg]]; + if (lhs->vtype == TYPE_bat) + BBPrelease(lhs->val.bval); + } GDKfree(nstk); } } 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 @@ -567,7 +567,6 @@ 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/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -206,6 +206,7 @@ SQLrun(Client c, mvc *m) *m->errstr=0; return msg; } + TRC_INFO(SQL_EXECUTION, "Executing: %s", c->query); MT_thread_setworking(c->query); // locate and inline the query template instruction mb = copyMalBlk(c->curprg->def); diff --git a/sql/backends/monet5/sql_subquery.c b/sql/backends/monet5/sql_subquery.c --- a/sql/backends/monet5/sql_subquery.c +++ b/sql/backends/monet5/sql_subquery.c @@ -16,7 +16,7 @@ zero_or_one_error(ptr ret, const bat *bi BAT *b; BUN c; size_t _s; - const void *p; + const void *p = NULL; if ((b = BATdescriptor(*bid)) == NULL) { throw(SQL, "sql.zero_or_one", SQLSTATE(HY005) "Cannot access column descriptor"); diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -1697,46 +1697,20 @@ rel_find_exp_and_corresponding_rel(sql_r case op_right: case op_full: case op_join: + case op_semi: + case op_anti: ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); - if (!ne) + if (!ne && is_join(rel->op)) ne = rel_find_exp_and_corresponding_rel(rel->r, e, res, under_join); if (ne && under_join) *under_join = true; break; case op_table: - if (rel->exps && e->type == e_column && e->l && exps_bind_column2(rel->exps, e->l, e->r, NULL)) - ne = e; - if (ne && res) - *res = rel; - break; - case op_union: - case op_except: - case op_inter: - { - if (rel->l) - ne = rel_find_exp_and_corresponding_rel(rel->l, e, res, under_join); -
MonetDB: mtest - Final clean up in sql/test. No more dangling ....
Changeset: 1d5465520988 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1d5465520988 Added Files: sql/test/Tests/null-byte-hang.sql Removed Files: sql/test/null-byte-hang.sql Modified Files: sql/test/Tests/null-byte-hang.SQL.py Branch: mtest Log Message: Final clean up in sql/test. No more dangling .sql files here. diffs (15 lines): diff --git a/sql/test/Tests/null-byte-hang.SQL.py b/sql/test/Tests/null-byte-hang.SQL.py --- a/sql/test/Tests/null-byte-hang.SQL.py +++ b/sql/test/Tests/null-byte-hang.SQL.py @@ -3,7 +3,7 @@ import os, sys, pymonetdb client1 = pymonetdb.connect(port=int(os.getenv('MAPIPORT')), database=os.getenv('TSTDB')) cur1 = client1.cursor() -f = open(os.path.join(os.getenv('TSTSRCBASE'), os.getenv('TSTDIR'), 'null-byte-hang.sql'), 'r') +f = open(os.path.join(os.getenv('TSTSRCBASE'), os.getenv('TSTDIR'), 'Tests/null-byte-hang.sql'), 'r') q = f.read() f.close() try: diff --git a/sql/test/null-byte-hang.sql b/sql/test/Tests/null-byte-hang.sql rename from sql/test/null-byte-hang.sql rename to sql/test/Tests/null-byte-hang.sql ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Cleanup.
Changeset: ee1c3d53f53e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ee1c3d53f53e Removed Files: sql/test/emptydb/Tests/dump.sql Modified Files: sql/test/emptydb/Tests/dump.SQL.py Branch: mtest Log Message: Cleanup. diffs (23 lines): diff --git a/sql/test/emptydb/Tests/dump.SQL.py b/sql/test/emptydb/Tests/dump.SQL.py --- a/sql/test/emptydb/Tests/dump.SQL.py +++ b/sql/test/emptydb/Tests/dump.SQL.py @@ -1,4 +1,3 @@ -import os, sys, re try: from MonetDBtesting import process except ImportError: @@ -7,7 +6,7 @@ except ImportError: with process.client('sqldump', stdout=process.PIPE, stderr=process.PIPE) as c: out, err = c.communicate() -for line in out.split('\n'): +for line in out.splitlines(): if line.startswith('--') or not line: continue if line != 'START TRANSACTION;' and line != 'COMMIT;': diff --git a/sql/test/emptydb/Tests/dump.sql b/sql/test/emptydb/Tests/dump.sql deleted file mode 100644 --- a/sql/test/emptydb/Tests/dump.sql +++ /dev/null @@ -1,1 +0,0 @@ -\D ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Converted sql/test/testdb.
Changeset: 5475f8e38df7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5475f8e38df7 Added Files: sql/test/testdb/Tests/dump-nogeom.SQL.py.src sql/test/testdb/Tests/dump.SQL.py Removed Files: sql/test/testdb/Tests/dump-nogeom.sql sql/test/testdb/Tests/dump.sql sql/test/testdb/Tests/load-geom.sql sql/test/testdb/Tests/load.sql Modified Files: sql/test/testdb/Tests/dump-nogeom.stable.out sql/test/testdb/Tests/dump.stable.out Branch: mtest Log Message: Converted sql/test/testdb. diffs (truncated from 101493 to 300 lines): diff --git a/sql/test/testdb/Tests/dump-nogeom.SQL.py.src b/sql/test/testdb/Tests/dump-nogeom.SQL.py.src new file mode 100644 --- /dev/null +++ b/sql/test/testdb/Tests/dump-nogeom.SQL.py.src @@ -0,0 +1,1 @@ +$RELSRCDIR/dump.SQL.py diff --git a/sql/test/testdb/Tests/dump-nogeom.sql b/sql/test/testdb/Tests/dump-nogeom.sql deleted file mode 100644 --- a/sql/test/testdb/Tests/dump-nogeom.sql +++ /dev/null @@ -1,2 +0,0 @@ -SET TIME ZONE INTERVAL '+00:00' HOUR TO MINUTE; -\D diff --git a/sql/test/testdb/Tests/dump-nogeom.stable.out b/sql/test/testdb/Tests/dump-nogeom.stable.out --- a/sql/test/testdb/Tests/dump-nogeom.stable.out +++ b/sql/test/testdb/Tests/dump-nogeom.stable.out @@ -1,28 +1,3 @@ -stdout of test 'dump-nogeom` in directory 'sql/test/testdb` itself: - - -# 14:28:43 > -# 14:28:43 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=36999" "--set" "mapi_usock=/var/tmp/mtest-22828/.s.monetdb.36999" "--set" "monet_prompt=" "--forcemito" "--dbpath=/ufs/sjoerd/@Monet-candidate/var/MonetDB/mTests_sql_test_testdb" "--set" "embedded_c=true" -# 14:28:43 > - -# MonetDB 5 server v11.32.0# MonetDB5 server v11.32.0 (hg id: a7009c1117bd+) -# This is an unreleased version -# Serving database 'mTests_sql_test_testdb', using 8 threads -# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers -# Found 62.694 GiB available main-memory. -# Copyright (c) 1993 - July 2008 CWI. -# Copyright (c) August 2008 - 2018 MonetDB B.V., all rights reserved -# Visit https://www.monetdb.org/ for further information -# Listening for connection requests on mapi:monetdb://methuselah.da.cwi.nl:36999/ -# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-22828/.s.monetdb.36999 -# MonetDB/SQL module loaded - - -# 14:28:43 > -# 14:28:43 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-22828" "--port=36999" -# 14:28:43 > - -#SET TIME ZONE INTERVAL '+00:00' HOUR TO MINUTE; START TRANSACTION; CREATE USER "testuser" WITH ENCRYPTED PASSWORD 'e9e633097ab9ceb3e48ec3f70ee2beba41d05d5420efee5da85f97d97005727587fda33ef4ff2322088f4c79e8133cc9cd9f3512f4d3a303cbdb5bc585415a00' NAME 'Test User' SCHEMA "sys"; CREATE SCHEMA "testschema" AUTHORIZATION "testuser"; @@ -101445,8 +101420,3 @@ ALTER SEQUENCE "testschema"."test_seq" R GRANT EXECUTE ON FUNCTION "testschema"."keyjoin" TO "public"; SET SCHEMA "sys"; COMMIT; - -# 14:28:45 > -# 14:28:45 > "Done." -# 14:28:45 > - diff --git a/sql/test/testdb/Tests/dump.SQL.py b/sql/test/testdb/Tests/dump.SQL.py new file mode 100644 --- /dev/null +++ b/sql/test/testdb/Tests/dump.SQL.py @@ -0,0 +1,24 @@ +import sys + +try: +from MonetDBtesting import process +except ImportError: +import process + +with process.client('sqldump', +stdin=process.PIPE, +stdout=process.PIPE, +stderr=process.PIPE) as clt: +out, err = clt.communicate() + +if len(sys.argv) == 2 and sys.argv[1] in ('dump', 'dump-nogeom'): +output = ''.join(out).splitlines(keepends=True) +while len(output) > 0 and output[0].startswith('--'): +del output[0] +stableout = '{}.stable.out'.format(sys.argv[1]) +stable = open(stableout).readlines() +import difflib +for line in difflib.unified_diff(stable, output, fromfile='test', tofile=stableout): +sys.stderr.write(line) +else: +sys.stdout.writelines(out) diff --git a/sql/test/testdb/Tests/dump.sql b/sql/test/testdb/Tests/dump.sql deleted file mode 100644 --- a/sql/test/testdb/Tests/dump.sql +++ /dev/null @@ -1,2 +0,0 @@ -SET TIME ZONE INTERVAL '+00:00' HOUR TO MINUTE; -\D diff --git a/sql/test/testdb/Tests/dump.stable.out b/sql/test/testdb/Tests/dump.stable.out --- a/sql/test/testdb/Tests/dump.stable.out +++ b/sql/test/testdb/Tests/dump.stable.out @@ -1,27 +1,3 @@ -stdout of test 'dump` in directory 'sql/test/testdb` itself: - - -# 11:29:34 > -# 11:29:34 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "gdk_dbfarm=/ufs/manegold/_/Monet/HG/Apr2012/prefix/--disable-debug_--enable-assert_--enable-optimize/var/MonetDB" "--set" "mapi_open=true" "--set" "mapi_port=32118" "--set" "monet_prompt=" "--trace" "--forcemito" "--set" "mal_listing=2" "--dbname=mTests_test_testdb" "--set" "mal_listing=0" -# 11:29:34 > - -# MonetDB 5 server v11.9.8 -# Thi
MonetDB: mtest - Add a possibility to use IP port in UNIX domain...
Changeset: 45303902bb42 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=45303902bb42 Modified Files: monetdb5/modules/mal/mal_mapi.c testing/process.py tools/mserver/mserver5.1.in Branch: mtest Log Message: Add a possibility to use IP port in UNIX domain socket file name. diffs (54 lines): diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c --- a/monetdb5/modules/mal/mal_mapi.c +++ b/monetdb5/modules/mal/mal_mapi.c @@ -761,7 +761,12 @@ SERVERlisten(int port, const char *usock #endif userver.sun_family = AF_UNIX; - memcpy(userver.sun_path, usockfile, ulen + 1); + const char *p; + if ((p = strstr(usockfile, "${PORT}")) != NULL) + snprintf(userver.sun_path, sizeof(userver.sun_path), +"%.*s%d%s", (int) (p - usockfile), usockfile, port<0?0:port, p + 7); + else + memcpy(userver.sun_path, usockfile, ulen + 1); length = (SOCKLEN) sizeof(userver); if (remove(usockfile) == -1 && errno != ENOENT) { char *e = createException(IO, "mal_mapi.listen", OPERATION_FAILED ": remove UNIX socket file: %s", diff --git a/testing/process.py b/testing/process.py --- a/testing/process.py +++ b/testing/process.py @@ -363,7 +363,10 @@ class server(Popen): cmd.append('mapi_port=%s' % mapiport) if usock is not None: cmd.append('--set') -cmd.append('mapi_usock=%s.%s' % (usock, mapiport)) +if mapiport == '0': +cmd.append('mapi_usock=%s.${PORT}' % usock) +else: +cmd.append('mapi_usock=%s.%s' % (usock, mapiport)) for i in range(len(cmd)): if cmd[i].startswith('--dbpath='): dbpath = cmd[i][9:] diff --git a/tools/mserver/mserver5.1.in b/tools/mserver/mserver5.1.in --- a/tools/mserver/mserver5.1.in +++ b/tools/mserver/mserver5.1.in @@ -268,8 +268,16 @@ Default .TP .B mapi_usock The name of the UNIX domain socket file on which the server will -listen for connections. Note, there is usually a severe -system-imposed length limitation on the name of the file. +listen for connections. +If the name contains the substring +.BR ${PORT} , +that part will be replaced by the decimal representation of the TCP/IP +port (option +.BR mapi_port ). +This is especially useful if the port was specified as +.BR 0 . +Note, there is usually a severe system-imposed length limitation on +the name of the file. .TP .B mapi_port The TCP/IP port number on which the server will listen for ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Converted directory sql/test/testdb-reload.
Changeset: ba25cdda952f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba25cdda952f Added Files: sql/test/testdb-reload/Tests/reload.stable.out.src Removed Files: sql/test/testdb-reload/Tests/reload.stable.out Modified Files: sql/test/testdb-reload/Tests/reload.py Branch: mtest Log Message: Converted directory sql/test/testdb-reload. diffs (truncated from 101638 to 300 lines): diff --git a/sql/test/testdb-reload/Tests/reload.py b/sql/test/testdb-reload/Tests/reload.py --- a/sql/test/testdb-reload/Tests/reload.py +++ b/sql/test/testdb-reload/Tests/reload.py @@ -21,14 +21,6 @@ if not tstdb or not dbfarm: print('No TSTDB or GDK_DBFARM in environment') sys.exit(1) -def freeport(): -sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -sock.bind(('', 0)) -port = sock.getsockname()[1] -sock.close() -return port - -port2 = freeport() tstdb2 = tstdb + '-clone' if os.path.exists(os.path.join(dbfarm, tstdb2)): shutil.rmtree(os.path.join(dbfarm, tstdb2)) @@ -37,7 +29,7 @@ if os.path.exists(os.path.join(dbfarm, t with process.server(stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE, -mapiport=os.environ.get('MAPIPORT', '5')) as s1: +mapiport='0') as s1: # load data into the first server's database with sqllogictest.SQLLogic(out=open(os.devnull, 'w')) as sql: sql.connect(hostname='localhost', @@ -47,7 +39,7 @@ with process.server(stdin=process.PIPE, 'testdb', 'Tests', 'load.test')) # start the second server with process.server(dbname=tstdb2, -mapiport=port2, +mapiport='0', stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s2: @@ -57,24 +49,42 @@ with process.server(stdin=process.PIPE, server=s1, stdin=process.PIPE, stdout='PIPE', -stderr=process.DEVNULL) as d1, \ +stderr=process.PIPE) as d1, \ process.client(lang='sql', -server=s2, -stdin=d1.stdout, -stdout=process.DEVNULL, -stderr=process.DEVNULL) as c2: +server=s2, +stdin=d1.stdout, +stdout=process.DEVNULL, +stderr=process.PIPE) as c2: d1.stdout.close() d1.stdout = None c2out, c2err = c2.communicate() d1out, d1err = d1.communicate() +sys.stderr.write(c2err) +sys.stderr.write(d1err) s1out, s1err = s1.communicate() -sys.stdout.write(s1out) -sys.stderr.write(s1err) +sys.stdout.writelines([line for line in s1out.splitlines(keepends=True) if not line.startswith('#')]) +sys.stderr.writelines([line for line in s1err.splitlines(keepends=True) if not line.startswith('#')]) # dump the second server's database with process.client(lang='sqldump', -server=s2) as d2: +server=s2, +stdin=process.PIPE, +stdout=process.PIPE, +stderr=process.PIPE) as d2: d2out, d2err = d2.communicate() +sys.stderr.write(d2err) s2out, s2err = s2.communicate() -sys.stdout.write(s2out) -sys.stderr.write(s2err) +sys.stdout.writelines([line for line in s2out.splitlines(keepends=True) if not line.startswith('#')]) +sys.stderr.writelines([line for line in s2err.splitlines(keepends=True) if not line.startswith('#')]) + +if len(sys.argv) == 2 and sys.argv[1] == 'reload': +output = ''.join(d2out).splitlines(keepends=True) +while len(output) > 0 and output[0].startswith('--'): +del output[0] +stableout = 'reload.stable.out' +stable = open(stableout).readlines() +import difflib +for line in difflib.unified_diff(stable, output, fromfile='test', tofile=stableout): +sys.stderr.write(line) +else: +sys.stdout.writelines(d2out) diff --git a/sql/test/testdb-reload/Tests/reload.stable.out b/sql/test/testdb-reload/Tests/reload.stable.out deleted file mode 100644 --- a/sql/test/testdb-reload/Tests/reload.stable.out +++ /dev/null @@ -1,101538 +0,0 @@ -stdout of test 'reload` in directory 'sql/test/testdb-reload` itself: - - -# 17:34:32 > -# 17:34:32 > "/usr/bin/python2" "reload.py" "reload" -# 17:34:32 > - -START TRANSACTION; -CREATE USER "testuser" WITH ENCRYPTED PASSWORD 'e9e633097ab9ceb3e48ec3f70ee2beba41d05d5420efee5da85f97d97005727587fda33ef4ff2322088f4c79e8133cc9cd9f3512f4d3a303cbdb5b
MonetDB: mtest - The R tests will be merged into the unit tests ...
Changeset: b8e89ca35c55 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b8e89ca35c55 Removed Files: clients/R/Tests/All clients/R/Tests/SingleServer clients/R/Tests/copy_into_fwf.R clients/R/Tests/copy_into_fwf.reqtests clients/R/Tests/copy_into_fwf.stable.err clients/R/Tests/copy_into_fwf.stable.out clients/R/Tests/dbapply.R clients/R/Tests/dbapply.reqtests clients/R/Tests/dbapply.stable.err clients/R/Tests/dbapply.stable.out clients/R/Tests/dbi.R clients/R/Tests/dbi.reqtests clients/R/Tests/dbi.stable.err clients/R/Tests/dbi.stable.out clients/R/Tests/deps-install.R clients/R/Tests/deps-install.stable.err clients/R/Tests/deps-install.stable.out clients/R/Tests/deps-install.timeout clients/R/Tests/deps-test.R clients/R/Tests/deps-test.stable.err clients/R/Tests/deps-test.stable.out clients/R/Tests/deps-test.timeout clients/R/Tests/dplyr-flights.R clients/R/Tests/dplyr-flights.reqtests clients/R/Tests/dplyr-flights.stable.err clients/R/Tests/dplyr-flights.stable.out clients/R/Tests/dplyr.R clients/R/Tests/dplyr.reqtests clients/R/Tests/dplyr.stable.err clients/R/Tests/dplyr.stable.out clients/R/Tests/dplyr.timeout clients/R/Tests/install.R clients/R/Tests/install.reqtests clients/R/Tests/install.stable.err clients/R/Tests/install.stable.out clients/R/Tests/install.timeout clients/R/Tests/testrandom.R clients/R/Tests/testrandom.reqtests clients/R/Tests/testrandom.stable.err clients/R/Tests/testrandom.stable.out Branch: mtest Log Message: The R tests will be merged into the unit tests of the MonetDB.R connector diffs (truncated from 1799 to 300 lines): diff --git a/clients/R/Tests/All b/clients/R/Tests/All deleted file mode 100644 --- a/clients/R/Tests/All +++ /dev/null @@ -1,8 +0,0 @@ -HAVE_LIBR?deps-install -HAVE_LIBR?install -HAVE_LIBR?deps-test -HAVE_LIBR?dbi -#HAVE_LIBR?dplyr too slow -#HAVE_LIBR?dplyr-flights they keep changing this -HAVE_LIBR?copy_into_fwf -HAVE_LIBR&NOT_WIN32?dbapply diff --git a/clients/R/Tests/SingleServer b/clients/R/Tests/SingleServer deleted file mode 100644 --- a/clients/R/Tests/SingleServer +++ /dev/null @@ -1,1 +0,0 @@ ---set embedded_r=yes diff --git a/clients/R/Tests/copy_into_fwf.R b/clients/R/Tests/copy_into_fwf.R deleted file mode 100644 --- a/clients/R/Tests/copy_into_fwf.R +++ /dev/null @@ -1,35 +0,0 @@ -if (Sys.getenv("TSTTRGDIR") != "") { - .libPaths(c(.libPaths(), paste0(Sys.getenv("TSTTRGDIR"),"/rlibdir"))) -} -library(DBI, quietly = T) - -args <- commandArgs(trailingOnly = TRUE) -dbport <- 5 -dbname <- "mTests_clients_R" -if (length(args) > 0) - dbport <- args[[1]] -if (length(args) > 1) - dbname <- args[[2]] - -con <- dbConnect(MonetDBLite::MonetDB(), port = dbport, dbname = dbname, wait = T) -stopifnot(dbIsValid(con)) - -tf <- tempfile() - -gdata::write.fwf(mtcars, tf, colnames = FALSE) - -if (dbExistsTable(con, "mtcars")) dbRemoveTable(con, "mtcars") - -dbBegin(con) -dbSendQuery(con, "CREATE TABLE mtcars (mpg DOUBLE PRECISION, cyl DOUBLE PRECISION, disp DOUBLE PRECISION, hp DOUBLE PRECISION, drat DOUBLE PRECISION, wt DOUBLE PRECISION, qsec DOUBLE PRECISION, vs DOUBLE PRECISION, am DOUBLE PRECISION, gear DOUBLE PRECISION, carb DOUBLE PRECISION)") - -# delimiters are ineffective for fwf import just set them to make sure they dont break stuff -res <- dbSendQuery(con, paste0("COPY OFFSET 1 INTO mtcars FROM '", tf, "' USING DELIMITERS 'a','b','c' NULL AS '' FWF (4, 2, 6, 4, 5, 6, 6, 2, 2, 2, 2)")) - -print(dbReadTable(con, "mtcars")) - -stopifnot(nrow(dbReadTable(con, "mtcars")) > 1) - -dbRollback(con) - -print("SUCCESS") diff --git a/clients/R/Tests/copy_into_fwf.reqtests b/clients/R/Tests/copy_into_fwf.reqtests deleted file mode 100644 --- a/clients/R/Tests/copy_into_fwf.reqtests +++ /dev/null @@ -1,1 +0,0 @@ -dbi diff --git a/clients/R/Tests/copy_into_fwf.stable.err b/clients/R/Tests/copy_into_fwf.stable.err deleted file mode 100644 --- a/clients/R/Tests/copy_into_fwf.stable.err +++ /dev/null @@ -1,35 +0,0 @@ -stderr of test 'copy_into_fwf` in directory 'clients/R` itself: - - -# 16:40:22 > -# 16:40:22 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=30658" "--set" "mapi_usock=/var/tmp/mtest-16034/.s.monetdb.30658" "--set" "monet_prompt=" "--forcemito" "--dbpath=/tmp/fuckit/var/MonetDB/mTests_clients_R" "--set" "embedded_r=yes" -# 16:40:22 > - -# builtin opt gdk_dbpath = /tmp/fuckit/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = f
MonetDB: mtest - run sqllogic within DoIt in Mz
Changeset: c4fdfca5a8a6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c4fdfca5a8a6 Modified Files: testing/Mz.py.in Branch: mtest Log Message: run sqllogic within DoIt in Mz diffs (93 lines): diff --git a/testing/Mz.py.in b/testing/Mz.py.in --- a/testing/Mz.py.in +++ b/testing/Mz.py.in @@ -1204,12 +1204,12 @@ def RunTest(env, test, oktests, pSrvr): TestErrFile = TST+".test.err" t0 = time.time() -if CALL == 'sqltest' or CALL == 'maltest': -# TODO make TestOutFile optional -exit_code, reason = RunSQLLogicTest(env, (TST + EXT), TestOutFile, TestErrFile, is_reqtest=is_reqtest, has_reqtests=has_reqtests, lsql= CALL == 'sqltest', username=user, password=passwd) -else: - tres = DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, STIMEOUT, CTIMEOUT, TIMEOUT, MAPIsockets, nomito, threads, user, passwd, COND, pSrvr) - exit_code = transform_str_return_code(tres) +#if CALL == 'sqltest' or CALL == 'maltest': +## TODO make TestOutFile optional +#exit_code, reason = RunSQLLogicTest(env, (TST + EXT), TestOutFile, TestErrFile, is_reqtest=is_reqtest, has_reqtests=has_reqtests, lsql= CALL == 'sqltest', username=user, password=passwd) +#else: +tres = DoIt(env, SERVER, CALL, TST, EXT, TestOutFile, TestErrFile, STIMEOUT, CTIMEOUT, TIMEOUT, MAPIsockets, nomito, threads, user, passwd, COND, pSrvr) +exit_code = transform_str_return_code(tres) t1 = time.time() TX = t1 - t0 @@ -1750,6 +1750,8 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te ClntErrFile = TST+".client.err" returncode = None pSrvr = PSRVR +issqllogictest = False +logicerror = False try: if SERVER in ["MAL", "SQL"]: SrvrOut = openutf8(SrvrOutFile,"w") @@ -1871,6 +1873,36 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te returncode = RunIt(Clnt, True, openutf8(f), ClntOut, ClntErr, TIMEOUT) if returncode: break +elif CALL == "sqltest" or CALL == "maltest": +issqllogictest = True +import MonetDBtesting.sqllogictest as sqllogictest +with sqllogictest.SQLLogic(out=ClntErr) as sql: +if CALL == 'sqltest': +lang = 'sql' +else: +lang = 'mal' +try: +sql.connect(username=user or 'monetdb', +password=passwd or 'monetdb', +hostname='localhost', +port=int(env['MAPIPORT']), +database=TSTDB, +language=lang) +except: +returncode = 'error' +else: +if not os.path.exists(TST+'.reqtests'): +try: +sql.drop() +except: +pass +try: +sql.parse(TST+EXT) +except sqllogictest.SQLLogicSyntaxError: +pass +except BrokenPipeError: +# server timeout +pass elif CALL in ["sql", "sqlXs"]: TSTs = [] if CALL == "sql": @@ -1941,9 +1973,14 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te n = q.name q.close() q = openutf8(n,'r') -TestErr.write(q.read()) +data = q.read() +TestErr.write(data) TestErr.flush() q.close() +if issqllogictest and n.endswith('.client.err') and data: +logicerror = True +else: +logicerror = False else: TestOut = try_open(TestOutFile, 'a') TestErr = try_open(TestErrFile, 'a') @@ -1970,6 +2007,8 @@ def DoIt(env, SERVER, CALL, TST, EXT, Te if CALL not in ('python', 'other', 'ruby'): # running mserver/mclient directly, so we know they didn't fail +if logicerror: +return 'logicerror' return None # Try to detect segfaults and the like ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Converted sql/test/testdb-upgrade* directories.
Changeset: 3d41bfffe156 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3d41bfffe156 Added Files: sql/test/testdb-upgrade-chain-hge/Tests/dump.SQL.py.src sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out sql/test/testdb-upgrade-chain-hge/Tests/upgrade.py sql/test/testdb-upgrade-chain/Tests/dump.SQL.py.src sql/test/testdb-upgrade-chain/Tests/upgrade.py sql/test/testdb-upgrade-hge/Tests/dump.SQL.py.src sql/test/testdb-upgrade-hge/Tests/dump.stable.out sql/test/testdb-upgrade-hge/Tests/upgrade.py sql/test/testdb-upgrade/Tests/dump.SQL.py.src sql/test/testdb-upgrade/Tests/upgrade.py Removed Files: sql/test/testdb-upgrade-chain-hge/Tests/dump.sql sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/unpackage.py sql/test/testdb-upgrade-chain-hge/Tests/unpackage.stable.err sql/test/testdb-upgrade-chain-hge/Tests/unpackage.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.SQL.py.src sql/test/testdb-upgrade-chain-hge/Tests/upgrade.reqtests sql/test/testdb-upgrade-chain/Tests/dump.sql sql/test/testdb-upgrade-chain/Tests/unpackage.py sql/test/testdb-upgrade-chain/Tests/unpackage.stable.err sql/test/testdb-upgrade-chain/Tests/unpackage.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.SQL.py.src sql/test/testdb-upgrade-chain/Tests/upgrade.reqtests sql/test/testdb-upgrade-hge/Tests/dump.sql sql/test/testdb-upgrade-hge/Tests/dump.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/unpackage.py sql/test/testdb-upgrade-hge/Tests/unpackage.stable.err sql/test/testdb-upgrade-hge/Tests/unpackage.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.SQL.py.src sql/test/testdb-upgrade-hge/Tests/upgrade.reqtests sql/test/testdb-upgrade/Tests/dump.sql sql/test/testdb-upgrade/Tests/unpackage.py sql/test/testdb-upgrade/Tests/unpackage.stable.err sql/test/testdb-upgrade/Tests/unpackage.stable.out sql/test/testdb-upgrade/Tests/upgrade.SQL.py sql/test/testdb-upgrade/Tests/upgrade.reqtests Modified Files: sql/test/testdb-upgrade-chain-hge/Tests/All sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/All sql/test/testdb-upgrade-chain/Tests/dump.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/All sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/All sql/test/testdb-upgrade/Tests/dump.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: mtest Log Message: Converted sql/test/testdb-upgrade* directories. diffs (truncated from 1371 to 300 lines): diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/All b/sql/test/testdb-upgrade-chain-hge/Tests/All --- a/sql/test/testdb-upgrade-chain-hge/Tests/All +++ b/sql/test/testdb-upgrade-chain-hge/Tests/All @@ -1,4 +1,3 @@ -HAVE_HGE&HAVE_GEOM&PREVHGECHAINREL?unpackage HAVE_HGE&HAVE_GEOM&PREVHGECHAINREL?upgrade HAVE_HGE&HAVE_GEOM&PREVHGECHAINREL&RELEASERUN?package HAVE_HGE&HAVE_GEOM&PREVHGECHAINREL?dump diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/dump.SQL.py.src b/sql/test/testdb-upgrade-chain-hge/Tests/dump.SQL.py.src new file mode 100644 --- /dev/null +++ b/sql/test/testdb-upgrade-chain-hge/Tests/dump.SQL.py.src @@ -0,0 +1,1 @@ +$RELSRCDIR/../../testdb/Tests/dump.SQL.py diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/dump.sql b/sql/test/testdb-upgrade-chain-hge/Tests/dump.sql deleted file mode 100644 --- a/sql/test/testdb-upgrade-chain-hge/Tests/dump.sql +++ /dev/null @@ -1,2 +0,0 @@ -SET TIME ZONE INTERVAL '+00:00' HOUR TO MINUTE; -\D diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out.int128 b/sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out rename from sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out.int128 rename to sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out --- a/sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out.int128 +++ b/sql/test/testdb-upgrade-chain-hge/Tests/dump.stable.out @@ -1,70 +1,3 @@ -stdout of test 'dump` in directory 'sql/test/testdb-upgrade-chain-hge` itself: - - -# 15:45:59 > -# 15:45:59 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=34328" "--set" "mapi_usock=/var/tmp/mtest-31831/.s.monetdb.34328" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/
MonetDB: mtest - dump with mclinet -D by default
Changeset: a40ed4c21682 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a40ed4c21682 Modified Files: testing/sqltest.py Branch: mtest Log Message: dump with mclinet -D by default diffs (20 lines): diff --git a/testing/sqltest.py b/testing/sqltest.py --- a/testing/sqltest.py +++ b/testing/sqltest.py @@ -570,8 +570,15 @@ class SQLTestCase(): user = self.conn_ctx.username, passwd = self.conn_ctx.password) dump = None +if '--inserts' in args: +args = list(args) +cmd = 'sqldump' +else: +cmd = 'sql' +# TODO should more options be allowed here +args = ['-lsql', '-D'] try: -with process.client('sqldump', **kwargs, args=list(args), stdout=process.PIPE, stderr=process.PIPE) as p: +with process.client(cmd, **kwargs, args=args, stdout=process.PIPE, stderr=process.PIPE) as p: dump, err = p.communicate() except Exception as e: pass ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
monetdb-java: default - Implemented some more tests
Changeset: 1850e0dfb5f7 for monetdb-java URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=1850e0dfb5f7 Modified Files: tests/JDBC_API_Tester.java Branch: default Log Message: Implemented some more tests diffs (truncated from 779 to 300 lines): diff --git a/tests/JDBC_API_Tester.java b/tests/JDBC_API_Tester.java --- a/tests/JDBC_API_Tester.java +++ b/tests/JDBC_API_Tester.java @@ -7,9 +7,15 @@ */ import java.sql.*; -import java.util.*; + import java.io.StringReader; import java.nio.charset.Charset; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Iterator; +import java.util.List; +import java.util.TimeZone; import org.monetdb.jdbc.types.INET; import org.monetdb.jdbc.types.URL; @@ -453,7 +459,7 @@ final public class JDBC_API_Tester { int items = 0; sb.append("4. table " + items + " items"); while (rs.next()) { - System.out.print(", " + rs.getString("id")); + sb.append(", ").append(rs.getString("id")); i++; } if (i != items) { @@ -1216,37 +1222,7 @@ final public class JDBC_API_Tester { sb.append(" writable ").append(rsmd.isWritable(col)).append("\n"); } - // testing and showing parameter meta data - ParameterMetaData pmd = pstmt.getParameterMetaData(); - sb.append("pmd. ").append(pmd.getParameterCount()).append(" parameters:\n"); - for (int parm = 1; parm <= pmd.getParameterCount(); parm++) { - sb.append("Param ").append(parm).append("\n"); - int nullable = pmd.isNullable(parm); - sb.append(" nullable ").append(nullable).append(" ("); - switch (nullable) { - case ParameterMetaData.parameterNoNulls:sb.append("NO"); break; - case ParameterMetaData.parameterNullable: sb.append("YA"); break; - case ParameterMetaData.parameterNullableUnknown:sb.append("UNKNOWN"); break; - // default: sb.append("INVALID " + nullable); break; - } - sb.append(")\n"); - sb.append(" signed ").append(pmd.isSigned(parm)).append("\n"); - sb.append(" precision ").append(pmd.getPrecision(parm)).append("\n"); - sb.append(" scale ").append(pmd.getScale(parm)).append("\n"); - sb.append(" type ").append(pmd.getParameterType(parm)).append("\n"); - sb.append(" typename ").append(pmd.getParameterTypeName(parm)).append("\n"); - sb.append(" classname ").append(pmd.getParameterClassName(parm)).append("\n"); - int mode = pmd.getParameterMode(parm); - sb.append(" mode ").append(mode).append(" ("); - switch (mode) { - case ParameterMetaData.parameterModeIn: sb.append("IN"); break; - case ParameterMetaData.parameterModeInOut: sb.append("INOUT"); break; - case ParameterMetaData.parameterModeOut:sb.append("OUT"); break; - case ParameterMetaData.parameterModeUnknown:sb.append("UNKNOWN"); break; - // default: sb.append("INVALID " + mode); break; - } - sb.append(")\n"); - } + showParams(pstmt); con.rollback(); con.setAutoCommit(true); @@ -1543,75 +1519,615 @@ final public class JDBC_API_Tester { sb.setLength(0);// clear the output log buffer Statement stmt = null; + PreparedStatement pstmt = null; + ResultSet rs = null; try { + con.setAutoCommit(false); + // >> false: auto commit should be off now + sb.append("0. false\t" + con.getAutoCommit()).append("\n"); + stmt = con.createStatement(); + int updates = stmt.executeUpdate("CREATE TABLE Test_PStimedate (t time, ts timestamp, d date)"); + if (updates != -2) + sb.append("1. Expected -2 go
MonetDB: mtest - fix crash_with_prepare_statement.Bug-2549
Changeset: 6e0ddc83fbc4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e0ddc83fbc4 Added Files: sql/test/prepare/Tests/crash_with_prepare_statement.Bug-2549.SQL.py sql/test/prepare/Tests/crash_with_prepare_statement.Bug-2549.sql sql/test/prepare/Tests/crash_with_prepare_statement.Bug-2549.stable.err sql/test/prepare/Tests/crash_with_prepare_statement.Bug-2549.stable.out Removed Files: sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.sql sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.stable.err sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.stable.out sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.test Modified Files: sql/test/BugTracker-2010/Tests/All sql/test/prepare/Tests/All Branch: mtest Log Message: fix crash_with_prepare_statement.Bug-2549 diffs (truncated from 437 to 300 lines): diff --git a/sql/test/BugTracker-2010/Tests/All b/sql/test/BugTracker-2010/Tests/All --- a/sql/test/BugTracker-2010/Tests/All +++ b/sql/test/BugTracker-2010/Tests/All @@ -8,7 +8,6 @@ correlated_update_type_mismatch.SF-29478 heap_combine_crash.SF-2947763 rank-over-crash.SF-2926454 embedded_record_seperator.SF-2991400 -crash_with_prepare_statement.Bug-2549 mat.slice_on_empty_BATs.SF-2994521 reorder.SF-2995671 crashonschema.Bug-2547 diff --git a/sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.sql b/sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.sql deleted file mode 100644 --- a/sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE SCHEMA TB; - -CREATE TABLE TB.STOCK_ITEM ( - S_W_ID INTEGER NOT NULL, - S_I_ID INTEGER NOT NULL, - S_QUANTITY INTEGER NOT NULL, - S_DIST_01 CHAR(24) NOT NULL, - S_DIST_02 CHAR(24) NOT NULL, - S_DIST_03 CHAR(24) NOT NULL, - S_DIST_04 CHAR(24) NOT NULL, - S_DIST_05 CHAR(24) NOT NULL, - S_DIST_06 CHAR(24) NOT NULL, - S_DIST_07 CHAR(24) NOT NULL, - S_DIST_08 CHAR(24) NOT NULL, - S_DIST_09 CHAR(24) NOT NULL , - S_DIST_10 CHAR(24) NOT NULL, - S_YTD DECIMAL(8,0) NOT NULL, - S_ORDER_CNT INTEGER NOT NULL, - S_REMOTE_CNT INTEGER NOT NULL, - S_DATA VARCHAR(50) NOT NULL -); - -PREPARE -UPDATE TB.STOCK_ITEM SET - S_QUANTITY = ?, - S_YTD = S_YTD + ?, - S_ORDER_CNT = S_ORDER_CNT + 1 -WHERE S_W_ID = ? AND S_I_ID = ?; - -drop table TB.STOCK_ITEM; - -drop schema TB; diff --git a/sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.stable.err b/sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.stable.err deleted file mode 100644 --- a/sql/test/BugTracker-2010/Tests/crash_with_prepare_statement.Bug-2549.stable.err +++ /dev/null @@ -1,86 +0,0 @@ -stderr of test 'crash_with_prepare_statement.Bug-2549` in directory 'sql/test/BugTracker-2010` itself: - - -# 00:18:04 > -# 00:18:04 > mserver5 "--config=/ufs/manegold/_/scratch0/Monet/HG/Feb2010/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/manegold/_/scratch0/Monet/HG/Feb2010/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/lib64/MonetDB5:/ufs/manegold/_/scratch0/Monet/HG/Feb2010/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/lib64/MonetDB5/lib:/ufs/manegold/_/scratch0/Monet/HG/Feb2010/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/lib64/MonetDB5/bin" --set "gdk_dbfarm=/ufs/manegold/_/scratch0/Monet/HG/Feb2010/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/var/MonetDB5/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=34918 --set xrpc_port=49630 --set monet_prompt= --trace "--dbname=mTests_src_test_BugTracker-2010" --set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Ov er.. -# 00:18:04 > - -# builtin opt gdk_arch = 64bitx86_64-unknown-linux-gnu -# builtin opt gdk_version = 1.36.6 -# builtin opt prefix = /ufs/manegold/_/scratch0/Monet/HG/Feb2010/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert -# builtin opt exec_prefix = ${prefix} -# builtin opt gdk_dbname = tst -# builtin opt gdk_dbfarm = ${prefix}/var/MonetDB -# builtin opt gdk_debug = 8 -# builtin opt gdk_alloc_map = yes -# builtin opt gdk_vmtrim = yes -# builtin opt monet_admin = adm -# builtin opt monet_prompt = > -# builtin opt monet_welcome = yes -# builtin opt monet_mod_path = ${exec_prefix}/lib64/MonetDB -# builtin opt monet_daemon = yes -# builtin opt host = localhost -# builtin opt mapi_port = 5 -# builtin opt mapi_noheaders = no -# builtin opt mapi_debug = 0 -# builtin opt mapi_clients = 2 -# builtin opt sql_debug = 0 -# builtin opt standoff_ns = http://monetdb.cwi.nl/standoff -# builtin opt standoff_start = start -# builtin opt standoff_end = end -# config
MonetDB: mtest - moved limit_in_prepare.Bug-2552
Changeset: f2b06c5f474d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f2b06c5f474d Added Files: sql/test/prepare/Tests/limit_in_prepare.Bug-2552.SQL.py sql/test/prepare/Tests/limit_in_prepare.Bug-2552.sql sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.err sql/test/prepare/Tests/limit_in_prepare.Bug-2552.stable.out Removed Files: sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.err sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.stable.out sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.test Modified Files: sql/test/BugTracker-2010/Tests/All sql/test/prepare/Tests/All Branch: mtest Log Message: moved limit_in_prepare.Bug-2552 diffs (truncated from 712 to 300 lines): diff --git a/sql/test/BugTracker-2010/Tests/All b/sql/test/BugTracker-2010/Tests/All --- a/sql/test/BugTracker-2010/Tests/All +++ b/sql/test/BugTracker-2010/Tests/All @@ -15,7 +15,6 @@ connectto.Bug-2548 copy-into-too-long-string.Bug-2358 in_column_exp.Bug-2561 multiple-updates-in-transaction.Bug-2543 -limit_in_prepare.Bug-2552 select_star.Bug-2563 delete_insert.Bug-2529 decimal_div_whole_nrs.Bug-2579 diff --git a/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql b/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql deleted file mode 100644 --- a/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql +++ /dev/null @@ -1,64 +0,0 @@ -CREATE TABLE "sys"."tbls" ( - "id"INTEGER, - "name" VARCHAR(1024), - "schema_id" INTEGER, - "query" VARCHAR(2048), - "type" SMALLINT, - "system"BOOLEAN, - "commit_action" SMALLINT, - "readonly" BOOLEAN, - "temporary" SMALLINT -); -COPY 40 RECORDS INTO "sys"."tbls" FROM stdin USING DELIMITERS E'\t',E'\n','"'; -2001 "schemas" 2000NULL0 true0 false 0 -2007 "types" 2000NULL0 true0 false 0 -2016 "functions" 2000NULL0 true0 false 0 -2027 "args" 2000NULL0 true0 false 0 -2036 "sequences" 2000NULL0 true0 false 0 -2046 "dependencies" 2000NULL0 true0 false 0 -2050 "connections" 2000NULL0 true0 false 0 -2059 "_tables" 2000NULL0 true0 false 0 -2068 "_columns" 2000NULL0 true0 false 0 -2079 "keys" 2000NULL0 true0 false 0 -2086 "idxs" 2000NULL0 true0 false 0 -2091 "triggers" 2000NULL0 true0 false 0 -2102 "objects" 2000NULL0 true0 false 0 -2107 "_tables" 2106NULL0 true2 false 0 -2116 "_columns" 2106NULL0 true2 false 0 -2127 "keys" 2106NULL0 true2 false 0 -2134 "idxs" 2106NULL0 true2 false 0 -2139 "triggers" 2106NULL0 true2 false 0 -2150 "objects" 2106NULL0 true2 false 0 -5183 "tables"2000"SELECT * FROM (SELECT p.*, 0 AS ""temporary"" FROM ""sys"".""_tables"" AS p UNION ALL SELECT t.*, 1 AS ""temporary"" FROM ""tmp"".""_tables"" AS t) AS tables where tables.type <> 2;" 1 true0 false 0 -5193 "columns" 2000"SELECT * FROM (SELECT p.* FROM ""sys"".""_columns"" AS p UNION ALL SELECT t.* FROM ""tmp"".""_columns"" AS t) AS columns;" 1 true0 false 0 -5209 "db_user_info" 2000NULL0 true0 false 0 -5215 "users" 2000"SELECT u.""name"" AS ""name"", ui.""fullname"", ui.""default_schema"" FROM db_users() AS u LEFT JOIN ""sys"".""db_user_info"" AS ui ON u.""name"" = ui.""name"" ;" 1 true0 false 0 -5219 "user_role" 2000NULL0 true0 false 0 -5222 "auths" 2000NULL0 true0 false 0 -5226 "privileges"2000NULL0 true0 false 0 -5399 "querylog_catalog" 2000"-- create table views for convenience\ncreate view sys.querylog_catalog as select * from sys.querylog_catalog();" 1 true0 false 0 -5411 "querylog_calls"2000"create view sys.querylog_calls as select * from sys.querylog_calls();" 1 true0 false 0 -5429 "querylog_history" 2000"create view sys.querylog_history as\nselect qd.*, ql.""start"",ql.""stop"", ql.arguments, ql.tuples, ql.run, ql.ship, ql.cpu, ql.space, ql.io \nfrom sys.querylog_catalog() qd, sys.querylog_calls() ql\nwhere qd.id = ql.id and qd.owner = user;" 1 true0 false 0 -5466 "tracelog"
MonetDB: mtest - moved prepare_on_boolean_bug.Bug-2581
Changeset: f5fec5f77f56 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f5fec5f77f56 Added Files: sql/test/prepare/Tests/prepare_on_boolean_bug.Bug-2581.SQL.py sql/test/prepare/Tests/prepare_on_boolean_bug.Bug-2581.sql sql/test/prepare/Tests/prepare_on_boolean_bug.Bug-2581.stable.err sql/test/prepare/Tests/prepare_on_boolean_bug.Bug-2581.stable.out Removed Files: sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.sql sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.stable.err sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.stable.out sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.test Modified Files: sql/test/BugTracker-2010/Tests/All sql/test/prepare/Tests/All Branch: mtest Log Message: moved prepare_on_boolean_bug.Bug-2581 diffs (truncated from 316 to 300 lines): diff --git a/sql/test/BugTracker-2010/Tests/All b/sql/test/BugTracker-2010/Tests/All --- a/sql/test/BugTracker-2010/Tests/All +++ b/sql/test/BugTracker-2010/Tests/All @@ -20,7 +20,6 @@ delete_insert.Bug-2529 decimal_div_whole_nrs.Bug-2579 SQLengine_error_on_join.Bug-2580 keycheck_crash.Bug-2583 -prepare_on_boolean_bug.Bug-2581 in_query_with_constants_fails.Bug-2582 prepare_statements_crash_server.Bug-2599 and_not_broken.Bug-2602 diff --git a/sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.sql b/sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.sql deleted file mode 100644 --- a/sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.sql +++ /dev/null @@ -1,3 +0,0 @@ -create table skycrash (id serial, boom boolean); -prepare select * from skycrash where boom = ? and boom = ?; -drop table skycrash; diff --git a/sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.stable.err b/sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.stable.err deleted file mode 100644 --- a/sql/test/BugTracker-2010/Tests/prepare_on_boolean_bug.Bug-2581.stable.err +++ /dev/null @@ -1,77 +0,0 @@ -stderr of test 'prepare_on_boolean_bug.Bug-2581` in directory 'sql/test/BugTracker-2010` itself: - - -# 09:34:27 > -# 09:34:27 > mserver5 "--config=/ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/bin" --set "gdk_dbfarm=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=30431 --set xrpc_port=48860 --set monet_prompt= --set mal_listing=2 --trace "--dbname=mTests_src_test_BugTracker-2010" --set mal_listing=0 ; echo ; echo Over.. -# 09:34:27 > - -# builtin opt gdk_arch = 64bitx86_64-unknown-linux-gnu -# builtin opt gdk_version = 1.38.0 -# builtin opt prefix = /ufs/niels/scratch/rc/Linux-x86_64 -# builtin opt exec_prefix = ${prefix} -# builtin opt gdk_dbname = demo -# builtin opt gdk_dbfarm = ${prefix}/var/MonetDB/dbfarm -# builtin opt gdk_debug = 0 -# builtin opt gdk_alloc_map = no -# builtin opt gdk_vmtrim = yes -# builtin opt monet_admin = adm -# builtin opt monet_prompt = > -# builtin opt monet_welcome = yes -# builtin opt monet_mod_path = ${exec_prefix}/lib/MonetDB -# builtin opt monet_daemon = no -# builtin opt host = localhost -# builtin opt mapi_port = 5 -# builtin opt mapi_clients = 2 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_debug = 0 -# builtin opt standoff_ns = -# builtin opt standoff_start = start -# builtin opt standoff_end = end -# config opt prefix = /ufs/niels/scratch/rc/Linux-x86_64 -# config opt config = ${prefix}/etc/monetdb5.conf -# config opt prefix = /ufs/niels/scratch/rc/Linux-x86_64 -# config opt exec_prefix = ${prefix} -# config opt gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm -# config opt monet_mod_path = ${exec_prefix}/lib/MonetDB5:${exec_prefix}/lib/MonetDB5/lib:${exec_prefix}/lib/MonetDB5/bin -# config opt mero_pidfile = ${prefix}/var/run/MonetDB/merovingian.pid -# config opt mero_controlport = 50001 -# config opt sql_optimizer = default_pipe -# config opt minimal_pipe = inline,remap,deadcode,multiplex,garbageCollector -# config opt default_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt nov2009_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector -# config opt replication_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector -# config opt
MonetDB: monetdbe-proxy - dump functions while being careful wit...
Changeset: 2227f1d52305 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2227f1d52305 Modified Files: dump.sql dump_output.sql Branch: monetdbe-proxy Log Message: dump functions while being careful with object dependencies. diffs (98 lines): diff --git a/dump.sql b/dump.sql --- a/dump.sql +++ b/dump.sql @@ -2,6 +2,7 @@ START TRANSACTION; --We start with creating static versions of catalogue tables that are going to be affected by this dump script itself. CREATE TEMPORARY TABLE _user_sequences AS SELECT * FROM sys.sequences; +CREATE TEMPORARY TABLE _user_functions AS SELECT * FROM sys.functions f WHERE NOT f.system; CREATE FUNCTION SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || s || ''' '; END; CREATE FUNCTION DQ (s STRING) RETURNS STRING BEGIN RETURN '"' || s || '"'; END; --TODO: Figure out why this breaks with the space @@ -353,20 +354,35 @@ RETURN FROM describe_sequences(); END; +CREATE FUNCTION describe_functions() RETURNS TABLE (o INT, sch STRING, fun STRING, def STRING) BEGIN +RETURN + SELECT f.id, s.name, f.name, f.func from _user_functions f JOIN schemas s ON f.schema_id = s.id; +END; + +CREATE FUNCTION dump_functions() RETURNS TABLE (o INT, stmt STRING) BEGIN + RETURN SELECT f.o, 'SET SCHEMA ' || DQ(f.sch) || ';' || f.def || 'SET SCHEMA "sys";' FROM describe_functions() f; +END; + --The dump statement should normally have an auto-incremented column representing the creation order. --But in cases of db objects that can be interdependent, i.e. functions and table-likes, we need access to the underlying sequence of the AUTO_INCREMENT property. ---Because we need to explicitly overwrite the creation order column "o" in those cases and after inserting the dump statements for functions and table-likes, +--Because we need to explicitly overwrite the creation order column "o" in those cases. After inserting the dump statements for functions and table-likes, --we can restart the auto-increment sequence with a sensible value for following dump statements. CREATE SEQUENCE _auto_increment; CREATE TEMPORARY TABLE dump_statements(o INT DEFAULT NEXT VALUE FOR _auto_increment, s STRING, PRIMARY KEY (o)); +--Because ALTER SEQUENCE statements are not allowed in procedures, +--we have to do a really nasty hack to restart the _auto_increment sequence. + +CREATE FUNCTION restart_sequence(sch STRING, seq STRING, val BIGINT) RETURNS BIGINT EXTERNAL NAME sql."restart"; + CREATE PROCEDURE dump_database(describe BOOLEAN) BEGIN set schema sys; INSERT INTO dump_statements(s) VALUES ('START TRANSACTION;'); + INSERT INTO dump_statements(s) VALUES ('SET SCHEMA "sys";'); INSERT INTO dump_statements(s) --dump_create_roles SELECT 'CREATE ROLE ' || DQ(name) || ';' FROM auths @@ -418,6 +434,15 @@ BEGIN sys.sequences seq JOIN sys.comments rem ON seq.id = rem.id WHERE sch.id = seq.schema_id; + DECLARE current_order INT; + SET current_order = (SELECT max(o) FROM dump_statements) - (SELECT min(ids.id) FROM (select id from tables union select id from functions) ids(id)); + + INSERT INTO dump_statements SELECT f.o + current_order, f.stmt FROM dump_functions() f; + + SET current_order = (SELECT max(o) + 1 FROM dump_statements); + DECLARE dummy_result BIGINT; + SET dummy_result = restart_sequence('sys', '_auto_increment', current_order + 1); + INSERT INTO dump_statements(s) --dump_create_tables SELECT 'CREATE ' || ts.table_type_name || ' ' || DQ(s.name) || '.' || DQ(t.name) || dump_column_definition(t.id) || @@ -449,15 +474,12 @@ BEGIN SELECT comment_on('COLUMN', DQ(s.name) || '.' || DQ(t.name) || '.' || DQ(c.name), rem.remark) FROM sys.columns c JOIN sys.comments rem ON c.id = rem.id, sys.tables t, sys.schemas s WHERE c.table_id = t.id AND t.schema_id = s.id AND NOT t.system; - --TODO STREAM TABLE? - --TODO functions --TODO VIEW --TODO Triggers --TODO COMMENTS ON TABLE --TODO TABLE level grants --TODO COLUMN level grants --TODO User Defined Types? sys.types - --TODO Triggers --TODO ALTER SEQUENCE using RESTART WITH after importing table_data. INSERT INTO dump_statements(s) VALUES ('COMMIT;'); diff --git a/dump_output.sql b/dump_output.sql --- a/dump_output.sql +++ b/dump_output.sql @@ -1,4 +1,5 @@ START TRANSACTION; +SET SCHEMA "sys"; CREATE ROLE "king"; CREATE USER "voc" WITH ENCRYPTED PASSWORD 'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e' NAME 'VOC Explorer' SCHEMA sys; CREATE USER "voc2" WITH ENCRYPTED PASSWORD 'ea45cf4e124b215a28631ec7ff0bf06e82fc26b2be7a066c9594855690fb5d42438be58d6523132384a1738cb4e5139caa1f970ebdfb422d65834d9a4ef61c0e' NAME 'VOC E
MonetDB: monetdbe-proxy - Use an explicit sequence to implement ...
Changeset: 7bb88771f17c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7bb88771f17c Modified Files: dump.sql Branch: monetdbe-proxy Log Message: Use an explicit sequence to implement auto-incrementation in dump_statements table. diffs (48 lines): diff --git a/dump.sql b/dump.sql --- a/dump.sql +++ b/dump.sql @@ -1,5 +1,8 @@ START TRANSACTION; +--We start with creating static versions of catalogue tables that are going to be affected by this dump script itself. +CREATE TEMPORARY TABLE _user_sequences AS SELECT * FROM sys.sequences; + CREATE FUNCTION SQ (s STRING) RETURNS STRING BEGIN RETURN ' ''' || s || ''' '; END; CREATE FUNCTION DQ (s STRING) RETURNS STRING BEGIN RETURN '"' || s || '"'; END; --TODO: Figure out why this breaks with the space CREATE FUNCTION FQTN(s STRING, t STRING) RETURNS STRING BEGIN RETURN DQ(s) || '.' || DQ(t); END; @@ -332,7 +335,7 @@ BEGIN seq."increment", seq."cacheinc", seq."cycle" - FROM sys.sequences seq, sys.schemas s + FROM _user_sequences seq, sys.schemas s WHERE s.id = seq.schema_id ORDER BY s.name, seq.name; END; @@ -350,11 +353,13 @@ RETURN FROM describe_sequences(); END; ---We cannot directly use dump_sequences() later because the temporary table "dump_statements" creates a SEQUENCE due to AUTO_INCREMENT. ---So we first dump the current sequences into a temp table "_dump_sequences" which will use to create the database_dump. +--The dump statement should normally have an auto-incremented column representing the creation order. +--But in cases of db objects that can be interdependent, i.e. functions and table-likes, we need access to the underlying sequence of the AUTO_INCREMENT property. +--Because we need to explicitly overwrite the creation order column "o" in those cases and after inserting the dump statements for functions and table-likes, +--we can restart the auto-increment sequence with a sensible value for following dump statements. -CREATE TEMPORARY TABLE _dump_sequences AS SELECT * FROM dump_sequences(); -CREATE TEMPORARY TABLE dump_statements(o INT AUTO_INCREMENT, s STRING, PRIMARY KEY (o)); +CREATE SEQUENCE _auto_increment; +CREATE TEMPORARY TABLE dump_statements(o INT DEFAULT NEXT VALUE FOR _auto_increment, s STRING, PRIMARY KEY (o)); CREATE PROCEDURE dump_database(describe BOOLEAN) BEGIN @@ -404,7 +409,7 @@ BEGIN FROM sys.auths a1, sys.auths a2, sys.user_role ur WHERE a1.id = ur.login_id AND a2.id = ur.role_id; - INSERT INTO dump_statements(s) SELECT * FROM _dump_sequences; + INSERT INTO dump_statements(s) SELECT * FROM dump_sequences(); INSERT INTO dump_statements(s) --dump_create_comments_on_sequences SELECT comment_on('SEQUENCE', DQ(sch.name) || '.' || DQ(seq.name), rem.remark) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: monetdbe-proxy - Formatting.
Changeset: cc5beba8b624 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc5beba8b624 Modified Files: dump.sql Branch: monetdbe-proxy Log Message: Formatting. diffs (12 lines): diff --git a/dump.sql b/dump.sql --- a/dump.sql +++ b/dump.sql @@ -344,7 +344,7 @@ END; CREATE FUNCTION dump_sequences() RETURNS TABLE(stmt STRING) BEGIN RETURN SELECT - 'CREATE SEQUENCE ' || FQTN(sch, seq) || 'AS BIGINT ' || + 'CREATE SEQUENCE ' || FQTN(sch, seq) || ' AS BIGINT ' || CASE WHEN "s" <> 0 THEN ' START WITH ' || "s" ELSE '' END || CASE WHEN "inc" <> 1 THEN ' INCREMENT BY ' || "inc" ELSE '' END || CASE WHEN "mi" <> 0 THEN ' MINVALUE ' || "mi" ELSE '' END || ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: monetdbe-proxy - Simplify query.
Changeset: be8bf7967308 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=be8bf7967308 Modified Files: dump.sql Branch: monetdbe-proxy Log Message: Simplify query. diffs (12 lines): diff --git a/dump.sql b/dump.sql --- a/dump.sql +++ b/dump.sql @@ -487,6 +487,7 @@ BEGIN END; CALL dump_database(TRUE); -SELECT GROUP_CONCAT(s) OVER (PARTITION BY o range between current row and current row) FROM dump_statements; + +SELECT s FROM dump_statements order by o; ROLLBACK; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: monetdbe-proxy - dump tables while being careful with o...
Changeset: 98361702debe for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=98361702debe Modified Files: dump.sql dump_output.sql Branch: monetdbe-proxy Log Message: dump tables while being careful with object dependencies. diffs (122 lines): diff --git a/dump.sql b/dump.sql --- a/dump.sql +++ b/dump.sql @@ -363,13 +363,43 @@ CREATE FUNCTION dump_functions() RETURNS RETURN SELECT f.o, 'SET SCHEMA ' || DQ(f.sch) || ';' || f.def || 'SET SCHEMA "sys";' FROM describe_functions() f; END; +CREATE FUNCTION describe_tables() RETURNS TABLE(o INT, sch STRING, tab STRING, typ STRING, col STRING, opt STRING) BEGIN +RETURN + SELECT + t.id, + s.name, + t.name, + ts.table_type_name, + dump_column_definition(t.id), + CASE + WHEN ts.table_type_name = 'REMOTE TABLE' THEN + dump_remote_table_expressions(s.name, t.name) + WHEN ts.table_type_name = 'MERGE TABLE' THEN + dump_merge_table_partition_expressions(t.id) + ELSE + '' + END + FROM sys.schemas s, table_types ts, sys._tables t + WHERE ts.table_type_name IN ('TABLE', 'MERGE TABLE', 'REMOTE TABLE', 'REPLICA TABLE') + AND t.system = FALSE + AND s.id = t.schema_id + AND ts.table_type_id = t.type + AND s.name <> 'tmp'; +END; + +CREATE FUNCTION dump_tables() RETURNS TABLE (o INT, stmt STRING) BEGIN +RETURN + SELECT t.o, 'CREATE ' || t.typ || ' ' || FQTN(t.sch, t.tab) || t.col || t.opt || ';' + FROM describe_tables() t; +END; + --The dump statement should normally have an auto-incremented column representing the creation order. --But in cases of db objects that can be interdependent, i.e. functions and table-likes, we need access to the underlying sequence of the AUTO_INCREMENT property. --Because we need to explicitly overwrite the creation order column "o" in those cases. After inserting the dump statements for functions and table-likes, --we can restart the auto-increment sequence with a sensible value for following dump statements. -CREATE SEQUENCE _auto_increment; -CREATE TEMPORARY TABLE dump_statements(o INT DEFAULT NEXT VALUE FOR _auto_increment, s STRING, PRIMARY KEY (o)); +CREATE SEQUENCE tmp._auto_increment; +CREATE TEMPORARY TABLE dump_statements(o INT DEFAULT NEXT VALUE FOR tmp._auto_increment, s STRING, PRIMARY KEY (o)); --Because ALTER SEQUENCE statements are not allowed in procedures, --we have to do a really nasty hack to restart the _auto_increment sequence. @@ -434,32 +464,18 @@ BEGIN sys.sequences seq JOIN sys.comments rem ON seq.id = rem.id WHERE sch.id = seq.schema_id; - DECLARE current_order INT; - SET current_order = (SELECT max(o) FROM dump_statements) - (SELECT min(ids.id) FROM (select id from tables union select id from functions) ids(id)); - - INSERT INTO dump_statements SELECT f.o + current_order, f.stmt FROM dump_functions() f; - - SET current_order = (SELECT max(o) + 1 FROM dump_statements); - DECLARE dummy_result BIGINT; - SET dummy_result = restart_sequence('sys', '_auto_increment', current_order + 1); + --START OF COMPLICATED DEPENDENCY STUFF: + --functions and table-likes can be interdependent. They should be inserted in the order of their catalogue id. + DECLARE offs INT; + SET offs = (SELECT max(o) FROM dump_statements) - (SELECT min(ids.id) FROM (select id from tables union select id from functions) ids(id)); - INSERT INTO dump_statements(s) --dump_create_tables - SELECT - 'CREATE ' || ts.table_type_name || ' ' || DQ(s.name) || '.' || DQ(t.name) || dump_column_definition(t.id) || - CASE - WHEN ts.table_type_name = 'REMOTE TABLE' THEN - dump_remote_table_expressions(s.name, t.name) || ';' - WHEN ts.table_type_name = 'MERGE TABLE' THEN - dump_merge_table_partition_expressions(t.id) || ';' - ELSE - ';' - END - FROM sys.schemas s, table_types ts, sys._tables t - WHERE ts.table_type_name IN ('TABLE', 'MERGE TABLE', 'REMOTE TABLE', 'REPLICA TABLE') - AND t.system = FALSE - AND s.id = t.schema_id - AND ts.table_type_id = t.type - AND s.name <> 'tmp'; + INSERT INTO dump_statements SELECT f.o + offs, f.stmt FROM dump_functions() f; + INSERT INTO dump_statements SELECT t.o + offs, t.stmt FROM dump_tables() t; + + SET
MonetDB: monetdbe-proxy - dump views
Changeset: 3b8feaba2ad3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3b8feaba2ad3 Modified Files: dump.sql Branch: monetdbe-proxy Log Message: dump views diffs (35 lines): diff --git a/dump.sql b/dump.sql --- a/dump.sql +++ b/dump.sql @@ -376,11 +376,13 @@ RETURN dump_remote_table_expressions(s.name, t.name) WHEN ts.table_type_name = 'MERGE TABLE' THEN dump_merge_table_partition_expressions(t.id) + WHEN ts.table_type_name = 'VIEW' THEN + t.query ELSE '' END - FROM sys.schemas s, table_types ts, sys._tables t - WHERE ts.table_type_name IN ('TABLE', 'MERGE TABLE', 'REMOTE TABLE', 'REPLICA TABLE') + FROM sys.schemas s, table_types ts, sys.tables t + WHERE ts.table_type_name IN ('TABLE', 'VIEW', 'MERGE TABLE', 'REMOTE TABLE', 'REPLICA TABLE') AND t.system = FALSE AND s.id = t.schema_id AND ts.table_type_id = t.type @@ -389,7 +391,14 @@ END; CREATE FUNCTION dump_tables() RETURNS TABLE (o INT, stmt STRING) BEGIN RETURN - SELECT t.o, 'CREATE ' || t.typ || ' ' || FQTN(t.sch, t.tab) || t.col || t.opt || ';' + SELECT + t.o, + CASE + WHEN t.typ <> 'VIEW' THEN + 'CREATE ' || t.typ || ' ' || FQTN(t.sch, t.tab) || t.col || t.opt || ';' + ELSE + t.opt + END FROM describe_tables() t; END; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list