MonetDB: scoping2 - Merged with default
Changeset: 8f4ff4af17c8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f4ff4af17c8 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_statement.c sql/include/sql_catalog.h sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/storage/sql_catalog.c tools/monetdbe/monetdbe.c Branch: scoping2 Log Message: Merged with default diffs (truncated from 4032 to 300 lines): diff --git a/buildtools/coverity_model.c b/buildtools/coverity_model.c new file mode 100644 --- /dev/null +++ b/buildtools/coverity_model.c @@ -0,0 +1,166 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ + +/* + * This file contains a model for Coverity Scan. + * This file is not a normal source file. It is not compiled by any + * compiler, but instead it is uploaded to the Coverity site and used + * during any analysis they do on our code. + * + * We model our use of the various allocation functions. + * Things we want to do is model that GDKmalloc and friends are paired + * with GDKfree, and that exceptions created by createException and + * createMalException should be freed with freeException. + * + * author: Sjoerd Mullender + */ + +typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return; +typedef struct {} *MalBlkPtr; + +void +GDKfree(void *blk) +{ + if (blk) { + __coverity_free__(blk); + __coverity_mark_as_afm_freed__(blk, "GDKfree"); + } +} + +void * +GDKmalloc(size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if(has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + __coverity_mark_as_uninitialized_buffer__(p); + return p; + } + return 0; +} + +void * +GDKzalloc(size_t size) +{ + void *p = GDKmalloc(size); + if (p) { + for (size_t i = 0; i < size; i++) + ((char *) p)[i] = 0; + } + return p; +} + +char * +GDKstrdup(const char *s) +{ + char *p; + size_t i; + int has_memory; + if (s == 0) + return 0; + __coverity_string_null_sink__(s); + __coverity_string_size_sink__(s); + if (has_memory) { + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + for (i = 0; (p[i] = s[i]); i++) + ; + return p; + } + return 0; +} + +char * +GDKstrndup(const char *s, size_t size) +{ + char *p; + size_t i; + __coverity_negative_sink__(size); + if (s == 0) + return 0; + p = GDKmalloc(size + 1); + if (p) { + for (i = 0; i < size && (p[i] = s[i]); i++) + ; + p[i] = 0; + } + return p; +} + +void * +GDKrealloc(void *blk, size_t size) +{ + void *p = GDKmalloc(size); + if (p != 0) + GDKfree(blk); + return p; +} + +void * +GDKmmap(const char *path, int mode, size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if (has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKmunmap"); + __coverity_writeall__(p); + return p; + } + return 0; +} + +gdk_return +GDKmunmap(void *p, size_t size) +{ + int failed; + __coverity_free__(p); + __coverity_mark_as_afm_freed__(p, "GDKmunmap"); + return failed ? GDK_FAIL : GDK_SUCCEED; +} + +void * +GDKmremap(const char *path, int mode, void *old_address, size_t old_size, size_t *new_size) +{ + void *p = GDKmmap(path, mode, new_size); + if (p) { + (void) GDKmunmap(old_address, old_size); + } + return p; +} + +char * +createException(enum malexception type, const char *fcn, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +char * +createMalException(MalBlkPtr mb, int pc, enum malexception type, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +void +freeException(char *p) +{ + if (p) { +
MonetDB: default - Merged with Oct2020
Changeset: cec6ceb82f7a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cec6ceb82f7a Modified Files: monetdb5/mal/mal_authorize.c monetdb5/mal/mal_prelude.c monetdb5/mal/mal_profiler.c monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/batstr.c monetdb5/modules/mal/remote.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/include/sql_catalog.h sql/server/rel_optimizer.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/storage/store.c tools/monetdbe/monetdbe.c Branch: default Log Message: Merged with Oct2020 diffs (truncated from 2896 to 300 lines): diff --git a/buildtools/coverity_model.c b/buildtools/coverity_model.c new file mode 100644 --- /dev/null +++ b/buildtools/coverity_model.c @@ -0,0 +1,166 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ + +/* + * This file contains a model for Coverity Scan. + * This file is not a normal source file. It is not compiled by any + * compiler, but instead it is uploaded to the Coverity site and used + * during any analysis they do on our code. + * + * We model our use of the various allocation functions. + * Things we want to do is model that GDKmalloc and friends are paired + * with GDKfree, and that exceptions created by createException and + * createMalException should be freed with freeException. + * + * author: Sjoerd Mullender + */ + +typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return; +typedef struct {} *MalBlkPtr; + +void +GDKfree(void *blk) +{ + if (blk) { + __coverity_free__(blk); + __coverity_mark_as_afm_freed__(blk, "GDKfree"); + } +} + +void * +GDKmalloc(size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if(has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + __coverity_mark_as_uninitialized_buffer__(p); + return p; + } + return 0; +} + +void * +GDKzalloc(size_t size) +{ + void *p = GDKmalloc(size); + if (p) { + for (size_t i = 0; i < size; i++) + ((char *) p)[i] = 0; + } + return p; +} + +char * +GDKstrdup(const char *s) +{ + char *p; + size_t i; + int has_memory; + if (s == 0) + return 0; + __coverity_string_null_sink__(s); + __coverity_string_size_sink__(s); + if (has_memory) { + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + for (i = 0; (p[i] = s[i]); i++) + ; + return p; + } + return 0; +} + +char * +GDKstrndup(const char *s, size_t size) +{ + char *p; + size_t i; + __coverity_negative_sink__(size); + if (s == 0) + return 0; + p = GDKmalloc(size + 1); + if (p) { + for (i = 0; i < size && (p[i] = s[i]); i++) + ; + p[i] = 0; + } + return p; +} + +void * +GDKrealloc(void *blk, size_t size) +{ + void *p = GDKmalloc(size); + if (p != 0) + GDKfree(blk); + return p; +} + +void * +GDKmmap(const char *path, int mode, size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if (has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKmunmap"); + __coverity_writeall__(p); + return p; + } + return 0; +} + +gdk_return +GDKmunmap(void *p, size_t size) +{ + int failed; + __coverity_free__(p); + __coverity_mark_as_afm_freed__(p, "GDKmunmap"); + return failed ? GDK_FAIL : GDK_SUCCEED; +} + +void * +GDKmremap(const char *path, int mode, void *old_address, size_t old_size, size_t *new_size) +{ + void *p = GDKmmap(path, mode, new_size); + if (p) { + (void) GDKmunmap(old_address, old_size); + } + return p; +} + +char * +createException(enum malexception type, const char *fcn, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +char * +createMalException(MalBlkPtr mb, int pc, enum malexception type, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); +
MonetDB: Jun2020 - Make sure it will compile
Changeset: 1fe1cf577ab6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1fe1cf577ab6 Modified Files: sql/server/rel_optimizer.c Branch: Jun2020 Log Message: Make sure it will compile diffs (25 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -5012,8 +5012,8 @@ rel_push_semijoin_down_or_up(visitor *v, static int rel_part_nr( sql_rel *rel, sql_exp *e ) { - sql_column *c; - sql_rel *bt; + sql_column *c = NULL; + sql_rel *bt = NULL; assert(e->type == e_cmp); c = exp_find_column_(rel, e->l, -1, ); @@ -5031,8 +5031,8 @@ rel_part_nr( sql_rel *rel, sql_exp *e ) static int rel_uses_part_nr( sql_rel *rel, sql_exp *e, int pnr ) { - sql_column *c; - sql_rel *bt; + sql_column *c = NULL; + sql_rel *bt = NULL; assert(e->type == e_cmp); /* ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Merged with Jun2020
Changeset: 23c8a1a7ff28 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=23c8a1a7ff28 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/common/sql_list.c sql/include/sql_catalog.h sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_partition.c sql/storage/sql_catalog.c sql/storage/store.c sql/test/merge-partitions/Tests/mergepart01.stable.err Branch: Oct2020 Log Message: Merged with Jun2020 diffs (truncated from 1833 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -3932,7 +3932,7 @@ rel2bin_insert(backend *be, sql_rel *rel pin = refs_find_rel(refs, prel); if (constraint && !be->first_statement_generated) - sql_insert_check_null(be, (be->cur_append && t->p) ? t->p : t, inserts->op4.lval); + sql_insert_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ t, inserts->op4.lval); l = sa_list(sql->sa); @@ -3944,12 +3944,14 @@ rel2bin_insert(backend *be, sql_rel *rel } /* before */ +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_insert_triggers(be, up, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_insert_triggers(be, t, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", t->base.name); @@ -3986,12 +3988,14 @@ rel2bin_insert(backend *be, sql_rel *rel if (!insert) return NULL; +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_insert_triggers(be, up, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_insert_triggers(be, t, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", t->base.name); if (ddl) { @@ -4822,7 +4826,7 @@ sql_update(backend *be, sql_table *t, st node *n; if (!be->first_statement_generated) - sql_update_check_null(be, (be->cur_append && t->p) ? t->p : t, updates); + sql_update_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ t, updates); /* check keys + get idx */ idx_updates = update_idxs_and_check_keys(be, t, rows, updates, l, NULL); @@ -4832,12 +4836,14 @@ sql_update(backend *be, sql_table *t, st } /* before */ +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_update_triggers(be, up, rows, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_update_triggers(be, t, rows, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", t->base.name); @@ -4852,12 +4858,14 @@ sql_update(backend *be, sql_table *t, st return sql_error(sql, 02, SQLSTATE(42000) "UPDATE: cascade failed for table '%s'", t->base.name); /* after */ +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_update_triggers(be, up, rows, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_update_triggers(be, t, rows, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", t->base.name); @@ -4919,7 +4927,7 @@ rel2bin_update(backend *be, sql_rel *rel updates[c->colnr] = bin_find_column(be, update, ce->l, ce->r); } if (!be->first_statement_generated) - sql_update_check_null(be, (be->cur_append && t->p) ? t->p : t, updates); + sql_update_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ t, updates); /* check keys + get idx */ updcol = first_updated_col(updates, list_length(t->columns.set)); @@ -4947,12 +4955,14 @@ rel2bin_update(backend *be, sql_rel *rel
MonetDB: Oct2020 - Model for Coverity.
Changeset: d18667572d01 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d18667572d01 Added Files: buildtools/coverity_model.c Branch: Oct2020 Log Message: Model for Coverity. diffs (171 lines): diff --git a/buildtools/coverity_model.c b/buildtools/coverity_model.c new file mode 100644 --- /dev/null +++ b/buildtools/coverity_model.c @@ -0,0 +1,166 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + */ + +/* + * This file contains a model for Coverity Scan. + * This file is not a normal source file. It is not compiled by any + * compiler, but instead it is uploaded to the Coverity site and used + * during any analysis they do on our code. + * + * We model our use of the various allocation functions. + * Things we want to do is model that GDKmalloc and friends are paired + * with GDKfree, and that exceptions created by createException and + * createMalException should be freed with freeException. + * + * author: Sjoerd Mullender + */ + +typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return; +typedef struct {} *MalBlkPtr; + +void +GDKfree(void *blk) +{ + if (blk) { + __coverity_free__(blk); + __coverity_mark_as_afm_freed__(blk, "GDKfree"); + } +} + +void * +GDKmalloc(size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if(has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + __coverity_mark_as_uninitialized_buffer__(p); + return p; + } + return 0; +} + +void * +GDKzalloc(size_t size) +{ + void *p = GDKmalloc(size); + if (p) { + for (size_t i = 0; i < size; i++) + ((char *) p)[i] = 0; + } + return p; +} + +char * +GDKstrdup(const char *s) +{ + char *p; + size_t i; + int has_memory; + if (s == 0) + return 0; + __coverity_string_null_sink__(s); + __coverity_string_size_sink__(s); + if (has_memory) { + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "GDKfree"); + for (i = 0; (p[i] = s[i]); i++) + ; + return p; + } + return 0; +} + +char * +GDKstrndup(const char *s, size_t size) +{ + char *p; + size_t i; + __coverity_negative_sink__(size); + if (s == 0) + return 0; + p = GDKmalloc(size + 1); + if (p) { + for (i = 0; i < size && (p[i] = s[i]); i++) + ; + p[i] = 0; + } + return p; +} + +void * +GDKrealloc(void *blk, size_t size) +{ + void *p = GDKmalloc(size); + if (p != 0) + GDKfree(blk); + return p; +} + +void * +GDKmmap(const char *path, int mode, size_t size) +{ + int has_memory; + __coverity_negative_sink__(size); + if (has_memory) { + void *p = __coverity_alloc__(size); + __coverity_mark_as_afm_allocated__(p, "GDKmunmap"); + __coverity_writeall__(p); + return p; + } + return 0; +} + +gdk_return +GDKmunmap(void *p, size_t size) +{ + int failed; + __coverity_free__(p); + __coverity_mark_as_afm_freed__(p, "GDKmunmap"); + return failed ? GDK_FAIL : GDK_SUCCEED; +} + +void * +GDKmremap(const char *path, int mode, void *old_address, size_t old_size, size_t *new_size) +{ + void *p = GDKmmap(path, mode, new_size); + if (p) { + (void) GDKmunmap(old_address, old_size); + } + return p; +} + +char * +createException(enum malexception type, const char *fcn, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +char * +createMalException(MalBlkPtr mb, int pc, enum malexception type, const char *format, ...) +{ + char *p; + __coverity_format_string_sink__(format); + p = __coverity_alloc_nosize__(); + __coverity_mark_as_afm_allocated__(p, "freeException"); + return p; +} + +void +freeException(char *p) +{ + if (p) { + __coverity_free__(p); + __coverity_mark_as_afm_freed__(p, "freeException"); + } +} ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Coverity fixes.
Changeset: 32cf81859e1b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=32cf81859e1b Modified Files: tools/merovingian/daemon/connections.c tools/merovingian/daemon/forkmserver.c Branch: Oct2020 Log Message: Coverity fixes. diffs (32 lines): diff --git a/tools/merovingian/daemon/connections.c b/tools/merovingian/daemon/connections.c --- a/tools/merovingian/daemon/connections.c +++ b/tools/merovingian/daemon/connections.c @@ -76,7 +76,6 @@ openConnectionIP(int *socks, bool udp, b (const char *) , sizeof on) < 0) { e = errno; closesocket(sock); - sock = -1; continue; } #ifdef SO_EXCLUSIVEADDRUSE diff --git a/tools/merovingian/daemon/forkmserver.c b/tools/merovingian/daemon/forkmserver.c --- a/tools/merovingian/daemon/forkmserver.c +++ b/tools/merovingian/daemon/forkmserver.c @@ -934,12 +934,15 @@ fork_profiler(const char *dbname, sabdb snprintf(profiler_executable, executable_len, "%s%s%s", tmp_exe, profiler_filename, s + 8); free(tmp_exe); - /* coverity[toctou] */ +#ifndef STATIC_CODE_ANALYSIS + /* hide for coverity: time-of-check time-of-use; it's ok to do +* this since if the file were to disappear between this check +* and the use, things won't fall apart */ if (stat(profiler_executable, _info) == -1) { error = newErr("Cannot find profiler executable"); goto cleanup; } - /* free(tmp_exe); */ +#endif } /* Verify that the requested db is running */ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - fix sql/test/Dump
Changeset: 831ec320bf46 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=831ec320bf46 Added Files: sql/test/Dump/Tests/dump-empty.SQL.py Modified Files: sql/test/Dump/Tests/All sql/test/Dump/Tests/clean-again.test sql/test/Dump/Tests/dump-again.SQL.py sql/test/Dump/Tests/dump.SQL.py sql/test/Dump/Tests/test-again.test sql/test/Dump/Tests/test.test Branch: mtest Log Message: fix sql/test/Dump diffs (191 lines): diff --git a/sql/test/Dump/Tests/All b/sql/test/Dump/Tests/All --- a/sql/test/Dump/Tests/All +++ b/sql/test/Dump/Tests/All @@ -7,4 +7,4 @@ reload test clean-again reload-again -test-again +#test-again diff --git a/sql/test/Dump/Tests/clean-again.test b/sql/test/Dump/Tests/clean-again.test --- a/sql/test/Dump/Tests/clean-again.test +++ b/sql/test/Dump/Tests/clean-again.test @@ -1,16 +1,16 @@ -statement error +statement ok drop table "test" -statement error +statement ok drop sequence "test_seq" -statement error +statement ok drop table "typestest" -statement error +statement ok drop table keytest2 -statement error +statement ok drop table keytest1 diff --git a/sql/test/Dump/Tests/dump-again.SQL.py b/sql/test/Dump/Tests/dump-again.SQL.py --- a/sql/test/Dump/Tests/dump-again.SQL.py +++ b/sql/test/Dump/Tests/dump-again.SQL.py @@ -1,15 +1,24 @@ import os, sys -try: -from MonetDBtesting import process -except ImportError: -import process +from MonetDBtesting.sqltest import SQLTestCase + +with SQLTestCase() as tc: +d = tc.sqldump('--inserts') +# this dump will be used in subsequent test +with open(os.path.join(os.environ['TSTTRGDIR'], 'dumpoutput2.sql'), 'w') as f: +f.write(d.data) +d.assertMatchStableOut(fout='dump-again.stable.out') -with process.client('sqldump', args=['--inserts'], stdout=process.PIPE, stderr=process.PIPE) as p: -dump, err = p.communicate() - -f = open(os.path.join(os.environ['TSTTRGDIR'], 'dumpoutput2.sql'), 'w') -f.write(dump) -f.close() - -sys.stdout.write(dump) -sys.stderr.write(err) +#try: +#from MonetDBtesting import process +#except ImportError: +#import process +# +#with process.client('sqldump', args=['--inserts'], stdout=process.PIPE, stderr=process.PIPE) as p: +#dump, err = p.communicate() +# +#f = open(os.path.join(os.environ['TSTTRGDIR'], 'dumpoutput2.sql'), 'w') +#f.write(dump) +#f.close() +# +#sys.stdout.write(dump) +#sys.stderr.write(err) diff --git a/sql/test/Dump/Tests/dump-empty.SQL.py b/sql/test/Dump/Tests/dump-empty.SQL.py new file mode 100644 --- /dev/null +++ b/sql/test/Dump/Tests/dump-empty.SQL.py @@ -0,0 +1,6 @@ +from MonetDBtesting.sqltest import SQLTestCase + +with SQLTestCase() as tc: +tc.sqldump('--inserts').assertMatchStableOut(fout='dump-empty.stable.out') + + diff --git a/sql/test/Dump/Tests/dump.SQL.py b/sql/test/Dump/Tests/dump.SQL.py --- a/sql/test/Dump/Tests/dump.SQL.py +++ b/sql/test/Dump/Tests/dump.SQL.py @@ -1,15 +1,24 @@ import os, sys -try: -from MonetDBtesting import process -except ImportError: -import process +from MonetDBtesting.sqltest import SQLTestCase + +with SQLTestCase() as tc: +d = tc.sqldump() +d.assertMatchStableOut(fout='dump.stable.out') +# this dump will be used in subsequent test +with open(os.path.join(os.environ['TSTTRGDIR'], 'dumpoutput.sql'), 'w') as f: +f.write(d.data) -with process.client('sqldump', stdout=process.PIPE, stderr=process.PIPE) as p: -dump, err = p.communicate() - -f = open(os.path.join(os.environ['TSTTRGDIR'], 'dumpoutput.sql'), 'w') -f.write(dump) -f.close() - -sys.stdout.write(dump) -sys.stderr.write(err) +#try: +#from MonetDBtesting import process +#except ImportError: +#import process +# +#with process.client('sqldump', stdout=process.PIPE, stderr=process.PIPE) as p: +#dump, err = p.communicate() +# +#f = open(os.path.join(os.environ['TSTTRGDIR'], 'dumpoutput.sql'), 'w') +#f.write(dump) +#f.close() +# +#sys.stdout.write(dump) +#sys.stderr.write(err) diff --git a/sql/test/Dump/Tests/test-again.test b/sql/test/Dump/Tests/test-again.test --- a/sql/test/Dump/Tests/test-again.test +++ b/sql/test/Dump/Tests/test-again.test @@ -1,10 +1,25 @@ -statement error +statement ok insert into test (id) values (5) -statement error +statement ok insert into test (id) values (6) -statement error +query II rowsort select * from test + +0 +7 +1 +10 +2 +5 +3 +8 +4 +5 +5 +8 +6 +5 diff --git a/sql/test/Dump/Tests/test.test b/sql/test/Dump/Tests/test.test --- a/sql/test/Dump/Tests/test.test +++ b/sql/test/Dump/Tests/test.test @@ -1,10 +1,23 @@ -statement error +statement ok insert into test (id) values (5) -statement error +statement ok insert into test (id) values (6) -statement error +query II rowsort select * from test - - + +0 +7 +1 +10 +2 +5 +3 +8 +4 +5 +5 +8 +6 +5 ___ checkin-list mailing list checkin-list@monetdb.org
MonetDB: mtest - compare sql dumps poc
Changeset: 4db4ad09644e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4db4ad09644e Modified Files: testing/Mz.py.in testing/sqltest.py Branch: mtest Log Message: compare sql dumps poc diffs (110 lines): diff --git a/testing/Mz.py.in b/testing/Mz.py.in --- a/testing/Mz.py.in +++ b/testing/Mz.py.in @@ -1128,7 +1128,7 @@ def RunTest(env, test, oktests, pSrvr): reason = "as MAPIPORT=%s is not available." % env['MAPIPORT'] else: #test_rgx = re.compile("^"+TST+"((_[sp][0-9][0-9])?\..*)?$", re.MULTILINE) -test_rgx = re.compile("^"+TST+"((_[sp][0-9][0-9])?\.(?!stable).*)?$", re.MULTILINE) +test_rgx = re.compile("^"+TST+"((_[sp][0-9][0-9])?\..*)?$", re.MULTILINE) for f in listdir(TSTSRCDIR): if test_rgx.match(f): try: diff --git a/testing/sqltest.py b/testing/sqltest.py --- a/testing/sqltest.py +++ b/testing/sqltest.py @@ -8,6 +8,7 @@ import sys import unittest import pymonetdb import MonetDBtesting.utils as utils +import difflib TSTDB=os.getenv("TSTDB") MAPIPORT=os.getenv("MAPIPORT") @@ -42,6 +43,36 @@ def piped_representation(data=[]): res = list(map(mapfn, data)) return '\n'.join(res) +def filter_junk(s: str): +"""filters empty strings and comments +""" +s = s.strip() +if s.startswith('--') or s.startswith('#') or s.startswith('stdout of test'): +return False +if s == '': +return False +return True + +def filter_matching_blocks(a: [str] = [], b: [str] = []): +# TODO add some ctx before any mismatch lines +ptr = 0 +red_a = [] +red_b = [] +min_size = min(len(a), len(b)) +s = difflib.SequenceMatcher() +for i in range(min_size): +s.set_seq1(a[i].replace('\t', '').replace(' ', '')) +s.set_seq2(b[i].replace('\t', '').replace(' ', '')) +# should be high matching ratio +if s.real_quick_ratio() < 0.95: +red_a.append(a[i]) +red_b.append(b[i]) +# keep track of last mismatch to add some ctx in between +ptr = i +# add trailing data if len(a) != len(b) +red_a+=a[min_size:] +red_b+=b[min_size:] +return red_a, red_b class PyMonetDBConnectionContext(object): def __init__(self, @@ -221,6 +252,26 @@ class SQLTestResult(object): self.fail(msg, data=self.data) return self +class SQLDump(): +def __init__(self, test_case, data=[]): +self.test_case = test_case +self.data = data +conn_ctx = test_case.conn_ctx +self.assertion_errors = [] # holds assertion errors + +def assertMatchStableOut(self, fout): +stable = [] +dump = list(filter(filter_junk, self.data.split('\n'))) +with open(fout, 'r') as f: +stable = list(filter(filter_junk, f.read().split('\n'))) +a, b = filter_matching_blocks(stable, dump) +diff = list(difflib.unified_diff(a, b, fromfile='stable', tofile='test')) +if len(diff) > 0: +err_file = self.test_case.err_file +msg = "sql dump expected to match stable output {} but it didnt\'t\n".format(fout) +msg+='\n'.join(diff) +self.assertion_errors.append(AssertionError(msg)) +print(msg, file=err_file) class SQLTestCase(): def __init__(self, out_file=sys.stdout, err_file=sys.stderr): @@ -277,3 +328,22 @@ class SQLTestCase(): def drop(self): raise NotImplementedError() + +def sqldump(self, *args): +kwargs = dict( +host = self.conn_ctx.hostname, +port = self.conn_ctx.port, +dbname = self.conn_ctx.database, +user = self.conn_ctx.username, +passwd = self.conn_ctx.password) +dump = None +try: +import MonetDBtesting.process as process +with process.client('sqldump', **kwargs, args=list(args), stdout=process.PIPE, stderr=process.PIPE) as p: +dump, err = p.communicate() +except Exception as e: +raise SystemExit(str(e)) +res = SQLDump(self, data=dump) +self.test_results.append(res) +return res + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: copybinary - Append to index in parallel with regular a...
Changeset: 7260debe9b71 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7260debe9b71 Modified Files: monetdb5/optimizer/opt_parappend.c sql/backends/monet5/sql.c sql/storage/bat/bat_storage.c sql/storage/sql_storage.h Branch: copybinary Log Message: Append to index in parallel with regular appends diffs (135 lines): diff --git a/monetdb5/optimizer/opt_parappend.c b/monetdb5/optimizer/opt_parappend.c --- a/monetdb5/optimizer/opt_parappend.c +++ b/monetdb5/optimizer/opt_parappend.c @@ -130,14 +130,6 @@ transform(parstate *state, Client cntxt, return MAL_SUCCEED; } - const char *cname = getVarConstant(mb, cname_var).val.sval; - if (cname[0] == '%') { - // don't touch indices - flush_finish_stmt(state, mb); - pushInstruction(mb, old); - return MAL_SUCCEED; - } - *actions += 1; int cookie_var = setup_append_prep(state, cntxt, mb, old); 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 @@ -1729,7 +1729,6 @@ mvc_append_prep_wrap(Client cntxt, MalBl const char *tname = *getArgReference_str(stk, pci, pci->retc + 2); sql_schema *s; sql_table *t; - sql_column *c; // for N columns, we ought to have N + 1 return values and N + 3 parameters. int first_col = pci->retc + 3; @@ -1763,16 +1762,19 @@ mvc_append_prep_wrap(Client cntxt, MalBl if (strNil(cname)) throw(SQL, "sql.append_prep", SQLSTATE(42000) "column name %d is nil", i); - if (cname[0] == '%') - throw(SQL, "sql.append_prep", SQLSTATE(42000) "sql.append_prep not intended for indices: %s.%s.%s", sname, tname, cname); - - c = mvc_bind_column(m, t, cname); - if (c == NULL) - throw(SQL, "sql.append_prep", SQLSTATE(42S02) "Column missing %s.%s.%s", sname, tname, cname); - - void *cookie = store_funcs.append_col_prep(m->session->tr, c); - - *cookie_out = cookie; + + bool is_column = cname[0] != '%'; + if (is_column) { + sql_column *c = mvc_bind_column(m, t, cname); + if (c == NULL) + throw(SQL, "sql.append_prep", SQLSTATE(42S02) "Column missing %s.%s.%s", sname, tname, cname); + *cookie_out = store_funcs.append_col_prep(m->session->tr, c); + } else { + sql_idx *i = mvc_bind_idx(m, s, cname + 1); + if (i == NULL) + throw(SQL, "sql.append_prep", SQLSTATE(42S02) "Index missing %s.%s.%s", sname, tname, cname); + *cookie_out = store_funcs.append_idx_prep(m->session->tr, i); + } } return MAL_SUCCEED; diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -896,26 +896,29 @@ append_col(sql_trans *tr, sql_column *c, return ok; } -static int -append_idx(sql_trans *tr, sql_idx * i, void *ib, int tpe) +static void* +append_idx_prepare(sql_trans *tr, sql_idx *i) { - int ok = LOG_OK; - BAT *b = ib; - sql_delta *bat; - - if (tpe == TYPE_bat && !BATcount(b)) - return ok; - if (bind_idx_data(tr, i) == LOG_ERR) + return NULL; + + sql_delta *delta = i->data; + + /* appends only write */ + delta->wtime = i->base.wtime = i->t->base.wtime = i->t->s->base.wtime = tr->wtime = tr->wstime; + + return delta; +} + +static int +append_idx(sql_trans *tr, sql_idx * i, void *data, int tpe) +{ + sql_delta *delta = append_idx_prepare(tr, i); + if (delta == NULL) return LOG_ERR; - bat = i->data; - /* appends only write */ - bat->wtime = i->base.wtime = i->t->base.wtime = i->t->s->base.wtime = tr->wtime = tr->wstime; - if (tpe == TYPE_bat) - ok = delta_append_bat(bat, ib); - else - ok = delta_append_val(bat, ib); + int ok = append_col_execute(delta, data, tpe == TYPE_bat); + return ok; } @@ -3128,6 +3131,7 @@ bat_storage_init( store_functions *sf) sf->append_col_prep = (append_col_prep_fptr)_col_prepare; sf->append_col_exec = (append_col_exec_fptr)_col_execute; sf->append_idx = (append_idx_fptr)_idx; + sf->append_idx_prep = (append_idx_prep_fptr)_idx_prepare; sf->update_col = (update_col_fptr)_col; sf->update_idx = (update_idx_fptr)_idx; sf->delete_tab = (delete_tab_fptr)_tab; diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h --- a/sql/storage/sql_storage.h +++ b/sql/storage/sql_storage.h @@ -139,6 +139,7 @@ typedef int
MonetDB: copybinary - Forgot some HAVE_HGE's
Changeset: 39274c1891cf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=39274c1891cf Modified Files: clients/examples/C/bincopyloops.c common/utils/copybinary.h Branch: copybinary Log Message: Forgot some HAVE_HGE's diffs (34 lines): diff --git a/clients/examples/C/bincopyloops.c b/clients/examples/C/bincopyloops.c --- a/clients/examples/C/bincopyloops.c +++ b/clients/examples/C/bincopyloops.c @@ -31,8 +31,11 @@ convert64(void *start, void *end) void convert128(void *start, void *end) { - for (uhge *p = start; p < (uhge*)end; p++) + for (uhge *p = start; p < (uhge*)end; p++) { +#ifdef HAVE_HGE copy_binary_convert128(p); +#endif + } } diff --git a/common/utils/copybinary.h b/common/utils/copybinary.h --- a/common/utils/copybinary.h +++ b/common/utils/copybinary.h @@ -120,12 +120,14 @@ copy_binary_convert64(void *p) *pp = copy_binary_byteswap64(*pp); } +#ifdef HAVE_HGE static inline void copy_binary_convert128(void *p) { uhge *pp = (uhge*)p; *pp = copy_binary_byteswap128(*pp); } +#endif static inline void copy_binary_convert_date(void *p) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: copybinary - Also append single values in parallel
Changeset: f33dedca3b86 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f33dedca3b86 Modified Files: monetdb5/optimizer/opt_parappend.c sql/backends/monet5/sql.c Branch: copybinary Log Message: Also append single values in parallel diffs (72 lines): diff --git a/monetdb5/optimizer/opt_parappend.c b/monetdb5/optimizer/opt_parappend.c --- a/monetdb5/optimizer/opt_parappend.c +++ b/monetdb5/optimizer/opt_parappend.c @@ -63,7 +63,7 @@ OPTparappendImplementation(Client cntxt, for (size_t i = 0; i < old_stop; i++) { InstrPtr p = old_mb_stmt[i]; - if (p->modname == sqlRef && p->fcnname == appendRef && isaBatType(getArgType(mb, p, 5))) { + if (p->modname == sqlRef && p->fcnname == appendRef) { msg = transform(, cntxt, mb, p, ); } else { if (p->barrier != 0 || mayhaveSideEffects(cntxt, mb, p, false) || needs_chain_var(, p)) { 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 @@ -1783,22 +1783,33 @@ str mvc_append_exec_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { (void) cntxt; - (void) mb; - void *cookie = *getArgReference_ptr(stk, pci, 1); - bat batid = *getArgReference_bat(stk, pci, 2); - - BAT *b = BATdescriptor(batid); - if (b == NULL) - throw(SQL, "sql.append_bat_exec", SQLSTATE(HY005) "Cannot access column descriptor"); - if( b && BATcount(b) > 4096 && !b->batTransient) - BATmsync(b); - - int ret = store_funcs.append_col_exec(cookie, b, true); - - BBPunfix(b->batCacheid); + int ret; + ptr cookie = *getArgReference_ptr(stk, pci, 1); + ptr incoming = getArgReference(stk, pci, 2); + int incoming_type = getArgType(mb, pci, 2); + + if (incoming_type > GDKatomcnt) + incoming_type = TYPE_bat; + + if (incoming_type == TYPE_bat) { + bat batid = *(bat*)incoming; + BAT *b = BATdescriptor(batid); + if (b == NULL) + throw(SQL, "sql.append_bat_exec", SQLSTATE(HY005) "Cannot access column descriptor"); + if (BATcount(b) > 4096 && !b->batTransient) + BATmsync(b); + + ret = store_funcs.append_col_exec(cookie, b, true); + BBPunfix(b->batCacheid); + } else { + if (ATOMextern(incoming_type)) + incoming = *(ptr*)incoming; + + ret = store_funcs.append_col_exec(cookie, incoming, false); + } if (ret != LOG_OK) - throw(SQL, "sql_append_bat_exec", GDK_EXCEPTION); + throw(SQL, "sql_append_exec", GDK_EXCEPTION); return MAL_SUCCEED; } @@ -5398,7 +5409,7 @@ static mel_func sql_init_funcs[] = { pattern("sql", "append_exec", mvc_append_exec_wrap, false, "Perform the actual append", args(1,3, arg("",ptr), - arg("cookie",ptr),batargany("ins",1))), + arg("cookie",ptr),argany("ins",1))), // tmp_1, cookie_1 := sql.append_prep(chain_0, s, t, c_1); // done_1 := sql.append_exec(cookie_1, bat_1); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: copybinary - Prepare bat_storage for single value appen...
Changeset: a7c33b12d6ca for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a7c33b12d6ca Modified Files: sql/backends/monet5/sql.c sql/storage/bat/bat_storage.c sql/storage/sql_storage.h Branch: copybinary Log Message: Prepare bat_storage for single value append_exec's diffs (69 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 @@ -1793,7 +1793,7 @@ mvc_append_exec_wrap(Client cntxt, MalBl if( b && BATcount(b) > 4096 && !b->batTransient) BATmsync(b); - int ret = store_funcs.append_col_exec(cookie, b); + int ret = store_funcs.append_col_exec(cookie, b, true); BBPunfix(b->batCacheid); diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -866,14 +866,21 @@ append_col_prepare(sql_trans *tr, sql_co } static int -append_col_execute(void *incoming_delta, void *incoming_bat) +append_col_execute(void *incoming_delta, void *incoming_data, bool is_bat) { sql_delta *delta = incoming_delta; - BAT *bat = incoming_bat; - - if (!BATcount(bat)) - return LOG_OK; - int ok = delta_append_bat(delta, bat); + int ok; + + if (is_bat) { + BAT *bat = incoming_data; + + if (!BATcount(bat)) + return LOG_OK; + ok = delta_append_bat(delta, bat); + } else { + ok = delta_append_val(delta, incoming_data); + } + return ok; } @@ -884,12 +891,7 @@ append_col(sql_trans *tr, sql_column *c, if (delta == NULL) return LOG_ERR; - int ok; - if (tpe == TYPE_bat) { - ok = append_col_execute(delta, i); - } else { - ok = delta_append_val(delta, i); - } + int ok = append_col_execute(delta, i, tpe == TYPE_bat); return ok; } diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h --- a/sql/storage/sql_storage.h +++ b/sql/storage/sql_storage.h @@ -137,7 +137,7 @@ typedef void *(*bind_del_data_fptr) (sql */ typedef int (*append_col_fptr) (sql_trans *tr, sql_column *c, void *d, int t); typedef void *(*append_col_prep_fptr) (sql_trans *tr, sql_column *c); -typedef int (*append_col_exec_fptr) (void *dlt, void *b); +typedef int (*append_col_exec_fptr) (void *dlt, void *b, bool is_bat); typedef int (*append_idx_fptr) (sql_trans *tr, sql_idx *i, void *d, int t); typedef int (*update_col_fptr) (sql_trans *tr, sql_column *c, void *tids, void *d, int t); typedef int (*update_idx_fptr) (sql_trans *tr, sql_idx *i, void *tids, void *d, int t); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: copybinary - Get rid of sql.append_bat
Changeset: 544a83138f72 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=544a83138f72 Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/sql.h Branch: copybinary Log Message: Get rid of sql.append_bat it was an intermediate stage we don't need anymore. diffs (95 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 @@ -1717,70 +1717,6 @@ mvc_append_wrap(Client cntxt, MalBlkPtr return MAL_SUCCEED; } - -str -mvc_append_bat_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) -{ - int *res = getArgReference_int(stk, pci, 0); - mvc *m = NULL; - str msg; - const char *sname = *getArgReference_str(stk, pci, 2); - const char *tname = *getArgReference_str(stk, pci, 3); - const char *cname = *getArgReference_str(stk, pci, 4); - assert(isaBatType(getArgType(mb, pci, 5))); - bat batid = *getArgReference_bat(stk, pci, 5); - sql_schema *s; - sql_table *t; - sql_column *c; - - if (strNil(sname)) - throw(SQL, "sql.append_bat", SQLSTATE(42000) "sql.append_bat schema name is nil"); - if (strNil(tname)) - throw(SQL, "sql.append_bat", SQLSTATE(42000) "sql.append_bat table name is nil"); - if (strNil(cname)) - throw(SQL, "sql.append_bat", SQLSTATE(42000) "sql.append_bat column name is nil"); - - if (cname[0] == '%') - throw(SQL, "sql.append_bat", SQLSTATE(42000) "sql.append_bat not intended for indices: %s.%s.%s", sname, tname, cname); - - *res = 0; - if ((msg = getSQLContext(cntxt, mb, , NULL)) != NULL) - return msg; - if ((msg = checkSQLContext(cntxt)) != NULL) - return msg; - s = mvc_bind_schema(m, sname); - if (s == NULL) - throw(SQL, "sql.append_bat", SQLSTATE(3F000) "Schema missing %s", sname); - t = mvc_bind_table(m, s, tname); - if (t == NULL) - throw(SQL, "sql.append_bat", SQLSTATE(42S02) "Table missing %s.%s", sname, tname); - c = mvc_bind_column(m, t, cname); - if (c == NULL) - throw(SQL, "sql.append_bat", SQLSTATE(42S02) "Column missing %s.%s.%s", sname, tname, cname); - - fprintf(stderr, "WOPIE1\n"); - void *cookie = store_funcs.append_col_prep(m->session->tr, c); - - BAT *b = BATdescriptor(batid); - if (b == NULL) - throw(SQL, "sql.append_bat_exec", SQLSTATE(HY005) "Cannot access column descriptor %s.%s.%s", - sname,tname,cname); - if( b && BATcount(b) > 4096 && !b->batTransient) - BATmsync(b); - - fprintf(stderr, "WOPIE2\n"); - int ret = store_funcs.append_col_exec(cookie, b); - - if (b) { - BBPunfix(b->batCacheid); - } - - if (ret != LOG_OK) - throw(SQL, "sql_append_bat_exec", GDK_EXCEPTION); - - return MAL_SUCCEED; -} - // chain_out, cookie_1, ..., cookie_N := sql.append_prep(chain_in, s, t, c_1, ... c_N); str mvc_append_prep_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) @@ -5454,9 +5390,6 @@ static mel_func sql_init_funcs[] = { arg("",int), arg("mvc",int),arg("sname",str),arg("tname",str),arg("cname",str),argany("ins",0))), - pattern("sql", "append_bat", mvc_append_bat_wrap, false, "Append to the column tname.cname (possibly optimized to replace the insert bat of tname.cname. Returns sequence number for order dependence.", -args(1,6, arg("",int),arg("mvc",int),arg("sname",str),arg("tname",str),arg("cname",str),batargany("ins",1))), - pattern("sql", "append_prep", mvc_append_prep_wrap, false, "Prepare to append to the column. Return new mvc state and cookie to pass to append_exec", args(2,6, diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h --- a/sql/backends/monet5/sql.h +++ b/sql/backends/monet5/sql.h @@ -66,7 +66,6 @@ sql5_export str SQLcatalog(Client cntxt, sql5_export str mvc_grow_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str mvc_append_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -sql5_export str mvc_append_bat_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str mvc_append_prep_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str mvc_append_exec_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str mvc_append_finish_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - This test doesn't require the JDBC client
Changeset: 33dfc647b13b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=33dfc647b13b Removed Files: sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.bat sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.sh Branch: mtest Log Message: This test doesn't require the JDBC client diffs (31 lines): diff --git a/sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.bat b/sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.bat deleted file mode 100755 --- a/sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off - -echo user=monetdb> .monetdb -echo password=monetdb>>.monetdb - -prompt # $t $g -echo on - -call java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d %TSTDB% -e -f "%RELSRCDIR%\except-union-intersect-bug-sf-1146079.sql" - -@del .monetdb diff --git a/sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.sh b/sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.sh deleted file mode 100755 --- a/sql/test/bugs/Tests/except-union-intersect-bug-sf-1146079.SQL.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -cat << EOF > .monetdb -user=monetdb -password=monetdb -EOF - -Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f \"$RELSRCDIR/except-union-intersect-bug-sf-1146079.sql\"" - -rm -f .monetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Converted sql/test/Triggers directory
Changeset: 679729082453 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=679729082453 Added Files: sql/test/Triggers/Tests/cascaded_triggers.test sql/test/Triggers/Tests/recursive_triggers.test sql/test/Triggers/Tests/referencing_clause_new.test sql/test/Triggers/Tests/referencing_clause_old.test sql/test/Triggers/Tests/trigger_activation.test sql/test/Triggers/Tests/trigger_insert.test sql/test/Triggers/Tests/triggers_schema_operations.test Modified Files: sql/test/Triggers/Tests/trigger_owner.SQL.py sql/test/Triggers/Tests/trigger_owner.stable.err sql/test/Triggers/Tests/trigger_owner.stable.out Branch: mtest Log Message: Converted sql/test/Triggers directory diffs (truncated from 1318 to 300 lines): diff --git a/sql/test/Triggers/Tests/cascaded_triggers.test b/sql/test/Triggers/Tests/cascaded_triggers.test new file mode 100644 --- /dev/null +++ b/sql/test/Triggers/Tests/cascaded_triggers.test @@ -0,0 +1,96 @@ +statement ok +create table t_0_1(id int, name varchar(1024), age int) + +statement ok +create table t_0_2(id int, age int) + +statement ok +create trigger test_0 after insert on t_0_1 + insert into t_0_2 select t_0_1.id,t_0_1.age from t_0_1 + +statement ok +insert into t_0_1 values(1, 'mo', 25) + +query ITI rowsort +select * from t_0_1 + +1 +mo +25 + +query II rowsort +select * from t_0_2 + +1 +25 + +statement ok +create trigger test_1 after delete on t_0_1 + insert into t_0_1 values(3, 'mo', 27) + +statement ok +delete from t_0_1 where id = 1 + +query ITI rowsort +select * from t_0_1 + +3 +mo +27 + +query II rowsort +select * from t_0_2 + +1 +25 +3 +27 + +statement ok +create trigger test_2 after update on t_0_1 + delete from t_0_2 + +statement ok +create trigger test_3 after delete on t_0_2 + insert into t_0_1 values(1, 'mo', 25) + +statement ok +update t_0_1 set name = 'monet' where id = 2 + +query ITI rowsort +select * from t_0_1 + +1 +mo +25 +3 +mo +27 + +query II rowsort +select * from t_0_2 + +1 +25 +3 +27 + +statement ok +drop trigger test_0 + +statement ok +drop trigger test_1 + +statement ok +drop trigger test_2 + +statement ok +drop trigger test_3 + +statement ok +drop table t_0_1 + +statement ok +drop table t_0_2 + + diff --git a/sql/test/Triggers/Tests/recursive_triggers.test b/sql/test/Triggers/Tests/recursive_triggers.test new file mode 100644 --- /dev/null +++ b/sql/test/Triggers/Tests/recursive_triggers.test @@ -0,0 +1,83 @@ +statement ok +create table t_1_1(id int, name varchar(1024), age int) + +statement ok +create table t_1_2(id int, age int) + +statement ok +create trigger test_0 after insert on t_1_1 + insert into t_1_1 values(3, 'mo', 27) + +statement ok +drop trigger test_0 + +statement ok +create trigger test_0 after insert on t_1_1 + insert into t_1_2 select id,age from t_1_1 + +statement ok +create trigger test_1 after insert on t_1_2 + insert into t_1_1 values(3, 'mo', 27) + +statement ok +drop trigger test_0 + +statement ok +drop trigger test_1 + +statement ok +create trigger test_0 after insert on t_1_1 + insert into t_1_2 select id,age from t_1_1 + +statement ok +create trigger test_1 after insert on t_1_2 + delete from t_1_2 + +statement ok +create trigger test_2 after delete on t_1_2 + insert into t_1_1 values(3, 'mo', 27) + +statement ok +drop trigger test_0 + +statement ok +drop trigger test_1 + +statement ok +drop trigger test_2 + +statement ok +create PROCEDURE p1(id int, age int) +BEGIN + insert into t_1_2 values(id, age); +END + +statement ok +create PROCEDURE p1() +BEGIN + declare id int, age int; + set id = 1; + set age = 23; + call p1(id, age); +END + +statement ok +create trigger test_0 after insert on t_1_2 +BEGIN ATOMIC + insert into t_1_1 values(1, 'monetdb', 24); + call p1(); +END + +statement ok +drop trigger test_0 + +statement ok +drop ALL procedure p1 + +statement ok +drop table t_1_1 + +statement ok +drop table t_1_2 + + diff --git a/sql/test/Triggers/Tests/referencing_clause_new.test b/sql/test/Triggers/Tests/referencing_clause_new.test new file mode 100644 --- /dev/null +++ b/sql/test/Triggers/Tests/referencing_clause_new.test @@ -0,0 +1,391 @@ +statement ok +create table t_2_1 (id int, name varchar(1024)) + +statement ok +create table t_2_2 (id int, name varchar(1024)) + +statement ok +insert into t_2_1 values(10, 'monetdb') + +statement ok +insert into t_2_1 values(20, 'monet') + +statement ok +create trigger test_2_1 + after update on t_2_1 referencing new row as new_row + for each row insert into t_2_2 values(0, 'update_new_row') + +statement ok +create trigger test_2_2 + after update on t_2_1 referencing new row new_row + for each row insert into t_2_2 values(1, 'update_new_row') + +statement ok +create trigger test_2_3 + after update on t_2_1 referencing new as new_row +
MonetDB: Jun2020 - moved sql_part to the schema level. When we h...
Changeset: e915cdbda23a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e915cdbda23a Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/common/sql_list.c sql/include/sql_catalog.h sql/server/rel_distribute.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_partition.c sql/storage/sql_catalog.c sql/storage/store.c Branch: Jun2020 Log Message: moved sql_part to the schema level. When we handle changes at the schema level (after handling table changes), we are always sure the tables exist. sql part now holds a pointer to the merge/replica table and the member. diffs (truncated from 1848 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -4079,7 +4079,7 @@ rel2bin_insert(backend *be, sql_rel *rel pin = refs_find_rel(refs, prel); if (constraint && !be->first_statement_generated) - sql_insert_check_null(be, (be->cur_append && t->p) ? t->p : t, inserts->op4.lval); + sql_insert_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ t, inserts->op4.lval); l = sa_list(sql->sa); @@ -4091,12 +4091,14 @@ rel2bin_insert(backend *be, sql_rel *rel } /* before */ +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_insert_triggers(be, up, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_insert_triggers(be, t, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", t->base.name); @@ -4132,12 +4134,14 @@ rel2bin_insert(backend *be, sql_rel *rel if (!insert) return NULL; +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_insert_triggers(be, up, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_insert_triggers(be, t, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "INSERT INTO: triggers failed for table '%s'", t->base.name); if (ddl) { @@ -4994,7 +4998,7 @@ sql_update(backend *be, sql_table *t, st node *n; if (!be->first_statement_generated) - sql_update_check_null(be, (be->cur_append && t->p) ? t->p : t, updates); + sql_update_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ t, updates); /* check keys + get idx */ idx_updates = update_idxs_and_check_keys(be, t, rows, updates, l, NULL); @@ -5004,12 +5008,14 @@ sql_update(backend *be, sql_table *t, st } /* before */ +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_update_triggers(be, up, rows, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_update_triggers(be, t, rows, updates, 0)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", t->base.name); @@ -5024,12 +5030,14 @@ sql_update(backend *be, sql_table *t, st return sql_error(sql, 02, SQLSTATE(42000) "UPDATE: cascade failed for table '%s'", t->base.name); /* after */ +#if 0 if (be->cur_append && !be->first_statement_generated) { for(sql_table *up = t->p ; up ; up = up->p) { if (!sql_update_triggers(be, up, rows, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", up->base.name); } } +#endif if (!sql_update_triggers(be, t, rows, updates, 1)) return sql_error(sql, 02, SQLSTATE(27000) "UPDATE: triggers failed for table '%s'", t->base.name); @@ -5091,7 +5099,7 @@ rel2bin_update(backend *be, sql_rel *rel updates[c->colnr] = bin_find_column(be, update, ce->l, ce->r); } if (!be->first_statement_generated) - sql_update_check_null(be, (be->cur_append && t->p) ? t->p : t, updates); + sql_update_check_null(be, /*(be->cur_append && t->p) ? t->p :*/ t, updates);
MonetDB: mtest - This file is no longer needed
Changeset: e7e018e934e5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e7e018e934e5 Removed Files: sql/test/BugTracker-2008/insert-null-byte.sql Branch: mtest Log Message: This file is no longer needed diffs (7 lines): diff --git a/sql/test/BugTracker-2008/insert-null-byte.sql b/sql/test/BugTracker-2008/insert-null-byte.sql deleted file mode 100644 index 7b66f962a8977b203eb4e7153b0cab9275bbfbd4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch literal 0 Hc$@https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Silenced one more Python test
Changeset: 117b113f8247 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=117b113f8247 Modified Files: sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.SQL.py sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.out Branch: mtest Log Message: Silenced one more Python test diffs (160 lines): diff --git a/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.SQL.py b/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.SQL.py --- a/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.SQL.py +++ b/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.SQL.py @@ -1,20 +1,23 @@ -import os, sys +import sys try: from MonetDBtesting import process except ImportError: import process -with process.client('sql', -stdin=open(os.path.join(os.getenv('TSTSRCDIR'), - os.path.pardir, - 'insert-null-byte.sql')), - stdout=process.PIPE, stderr=process.PIPE) as c: -out, err = c.communicate() -sys.stdout.write(out) -sys.stderr.write(err) +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(b"\x00") +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'NULL byte in input on line 1 of input' not in err: +sys.stderr.write('Expected error: NULL byte in input on line 1 of input') -with process.client('sql', stdin=process.PIPE, -stdout=process.PIPE, stderr=process.PIPE) as c: +with process.client('sql', stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: out, err = c.communicate('drop table strings2233581;') -sys.stdout.write(out) -sys.stderr.write(err) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or 'DROP TABLE: no such table \'strings2233581\'' not in str(err): +sys.stderr.write('Expected error: DROP TABLE: no such table \'strings2233581\'') diff --git a/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err b/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err --- a/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err +++ b/sql/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err @@ -5,88 +5,6 @@ stderr of test 'insert-null-byte.SF-2233 # 17:08:25 > mserver5 "--config=/ufs/sjoerd/Monet-virgin-stable/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/sjoerd/src/MonetDB/virgin-stable/sql/x86_64-unknown-linux-gnu/src/backends/monet5/.libs:/ufs/sjoerd/src/MonetDB/virgin-stable/sql/x86_64-unknown-linux-gnu/src/backends/monet5:/ufs/sjoerd/Monet-virgin-stable/lib64/MonetDB5:/ufs/sjoerd/Monet-virgin-stable/lib64/MonetDB5/lib:/ufs/sjoerd/Monet-virgin-stable/lib64/MonetDB5/bin" --set "gdk_dbfarm=/ufs/sjoerd/src/MonetDB/virgin-stable/sql/x86_64-unknown-linux-gnu/dbfarm" --set "sql_logdir=/ufs/sjoerd/src/MonetDB/virgin-stable/sql/x86_64-unknown-linux-gnu/sql_logs" --set "xquery_logdir=/ufs/sjoerd/src/MonetDB/virgin-stable/sql/x86_64-unknown-linux-gnu/xquery_logs" --set mapi_open=true --set xrpc_open=true --set mapi_port=34343 --set xrpc_port=49456 --set monet_prompt= --trace "--dbname=mTests_src_test_BugTracker-2008" --set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over.. # 17:08:25 > -# builtin opt gdk_arch = 64bitx86_64-unknown-linux-gnu -# builtin opt gdk_version = 1.26.3 -# builtin opt monet_pid = 22279 -# builtin opt prefix = /ufs/sjoerd/Monet-virgin-stable -# 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_mem_bigsize = 262144 -# builtin opt gdk_alloc_map = yes -# builtin opt gdk_mem_pagebits = 14 -# builtin opt gdk_vmtrim = yes -# builtin opt monet_admin = adm -# builtin opt monet_prompt = > -# builtin opt monet_welcome = yes -# builtin opt monet_mod_path = ${prefix}/lib64/MonetDB:${prefix}/lib64/bin -# 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 sql_logdir = ${prefix}/var/MonetDB -# builtin opt xquery_logdir = ${prefix}/var/MonetDB -# builtin opt standoff_ns = http://monetdb.cwi.nl/standoff -# builtin opt standoff_start = start -# builtin opt standoff_end = end -# config opt prefix = /ufs/sjoerd/Monet-virgin-stable -# config opt config = ${prefix}/etc/monetdb5.conf -# config opt prefix = /ufs/sjoerd/Monet-virgin-stable -# config opt exec_prefix =
MonetDB: mmt - cleanup
Changeset: 361454dc7388 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=361454dc7388 Modified Files: sql/storage/store.c Branch: mmt Log Message: cleanup diffs (12 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -3239,8 +3239,6 @@ sql_trans_copy_part( sql_trans *tr, sql_ npt->tpe = pt->tpe; npt->with_nills = pt->with_nills; npt->t = t; - if (npt) - assert(0); assert(isMergeTable(npt->t) || isReplicaTable(npt->t)); if (isRangePartitionTable(t)) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mmt - merged with Oct2020
Changeset: 38152883cf31 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=38152883cf31 Modified Files: sql/storage/store.c Branch: mmt Log Message: merged with Oct2020 diffs (truncated from 2236 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -161,16 +161,13 @@ BuildRequires: pkgconfig(libR) BuildRequires: texlive-obsolete %endif %endif -# if we were to compile with cmocka support (-DWITH_CMOCKA=ON): -# BuildRequires: pkgconfig(cmocka) -# if we were to compile with NetCDF support (-DNETCDF=ON): -# BuildRequires: pkgconfig(netcdf) -# if we were to compile with proj support (-DWITH_PROJ=ON): -# BuildRequires: pkgconfig(proj) -# if we were to compile with snappy support (-DWITH_SNAPPY=ON): -# BuildRequires: pkgconfig(snappy) -# if we were to compile with valgrind support (-DWITH_VALGRIND=ON): -# BuildRequires: pkgconfig(valgrind) +# optional packages: +# BuildRequires: pkgconfig(cmocka) # -DWITH_CMOCKA=ON +# BuildRequires: pkgconfig(gdal) # -DSHP=ON +# BuildRequires: pkgconfig(netcdf) # -DNETCDF=ON +# BuildRequires: pkgconfig(proj) # -DWITH_PROJ=ON +# BuildRequires: pkgconfig(snappy) # -DWITH_SNAPPY=ON +# BuildRequires: pkgconfig(valgrind) # -DWITH_VALGRIND=ON %if (0%{?fedora} >= 22) Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release} diff --git a/clients/mapiclient/ReadlineTools.c b/clients/mapiclient/ReadlineTools.c --- a/clients/mapiclient/ReadlineTools.c +++ b/clients/mapiclient/ReadlineTools.c @@ -23,6 +23,12 @@ #include/* for strncasecmp */ #endif +#ifndef WIN32 +/* for umask */ +#include +#include +#endif + static const char *sql_commands[] = { "SELECT", "INSERT", @@ -313,37 +319,40 @@ invoke_editor(int cnt, int key) { char *read_buff = NULL; char *editor = NULL; FILE *fp = NULL; - size_t content_len; + long content_len; size_t read_bytes, idx; -#ifdef WIN32 - char *mytemp; - char template[] = "mclient_temp_XX"; -#else - int mytemp; - char template[] = "/tmp/mclient_temp_XX"; -#endif (void) cnt; (void) key; #ifdef WIN32 + char *mytemp; + char template[] = "mclient_temp_XX"; if ((mytemp = _mktemp(template)) == NULL) { -#else - if ((mytemp = mkstemp(template)) == 0) { -#endif readline_show_error("invoke_editor: Cannot create temp file\n"); goto bailout; } - -#ifdef WIN32 if ((fp = fopen(mytemp, "r+")) == NULL) { -#else - if ((fp = fdopen(mytemp, "r+")) == NULL) { -#endif // Notify the user that we cannot create temp file readline_show_error("invoke_editor: Cannot create temp file\n"); goto bailout; } +#else + int mytemp; + char template[] = "/tmp/mclient_temp_XX"; + mode_t msk = umask(077); + mytemp = mkstemp(template); + (void) umask(msk); + if (mytemp == -1) { + readline_show_error("invoke_editor: Cannot create temp file\n"); + goto bailout; + } + if ((fp = fdopen(mytemp, "r+")) == NULL) { + // Notify the user that we cannot create temp file + readline_show_error("invoke_editor: Cannot create temp file\n"); + goto bailout; + } +#endif fwrite(rl_line_buffer, sizeof(char), rl_end, fp); fflush(fp); @@ -368,24 +377,24 @@ invoke_editor(int cnt, int key) { rewind(fp); if (content_len > 0) { - read_buff = (char *)malloc(content_len*sizeof(char)); + read_buff = (char *)malloc(content_len + 1); if (read_buff == NULL) { readline_show_error("invoke_editor: Cannot allocate memory\n"); goto bailout; } - read_bytes = fread(read_buff, sizeof(char), content_len, fp); - if (read_bytes != content_len) { + read_bytes = fread(read_buff, sizeof(char), (size_t) content_len, fp); + if (read_bytes != (size_t) content_len) { readline_show_error("invoke_editor: Did not read from file correctly\n"); goto bailout; } - *(read_buff + read_bytes) = 0; + read_buff[read_bytes] = 0; /* Remove trailing whitespace */ idx = read_bytes - 1; while(isspace(*(read_buff + idx))) { - *(read_buff + idx) = 0; + read_buff[idx] = 0; idx--; } @@ -404,7 +413,8 @@ invoke_editor(int cnt, int key) { return 0; bailout: - fclose(fp); + if (fp) + fclose(fp); free(read_buff); unlink(template); return 1; diff --git a/clients/mapiclient/msqldump.c
MonetDB: mtest - Removed unused union_leak.SF-2540169 test (file...
Changeset: c631a5948878 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c631a5948878 Removed Files: sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.1.sql.in sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.3.sql sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.4.sql sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.bat sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.sh sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.csv sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.stable.err sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.stable.out Branch: mtest Log Message: Removed unused union_leak.SF-2540169 test (files missing) diffs (truncated from 2000290 to 300 lines): diff --git a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.1.sql.in b/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.1.sql.in deleted file mode 100644 --- a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.1.sql.in +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE databasetest1 ("float1" DOUBLE); -START TRANSACTION; -COPY 100 OFFSET 2 RECORDS INTO "databasetest1" FROM E'$QTSTSRCDIR/union_leak.SF-2540169.csv' USING DELIMITERS ',',E'\n'; -COMMIT; -CREATE TABLE databasetest2 ("float1" DOUBLE); -START TRANSACTION; -COPY 100 OFFSET 102 RECORDS INTO "databasetest1" FROM E'$QTSTSRCDIR/union_leak.SF-2540169.csv' USING DELIMITERS ',',E'\n'; -COMMIT; -CREATE VIEW databasetest AS -SELECT * FROM databasetest1 -UNION ALL -SELECT * FROM databasetest2 -; diff --git a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.3.sql b/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.3.sql deleted file mode 100644 --- a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.3.sql +++ /dev/null @@ -1,1 +0,0 @@ -SELECT sum(float1) AS currencyfloat FROM databasetest; diff --git a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.4.sql b/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.4.sql deleted file mode 100644 --- a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.4.sql +++ /dev/null @@ -1,3 +0,0 @@ -drop view databasetest; -drop table databasetest2; -drop table databasetest1; diff --git a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.bat b/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.bat deleted file mode 100755 --- a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.bat +++ /dev/null @@ -1,10 +0,0 @@ -@prompt # $t $g -@echo on - -%SQL_CLIENT% "%TSTTRGDIR%\%1%.1.sql" -%MAL_CLIENT% "%TSTTRGDIR%\%1%.2.mal" -%SQL_CLIENT% "%TSTTRGDIR%\%1%.3.sql" -%MAL_CLIENT% "%TSTTRGDIR%\%1%.2.mal" -%SQL_CLIENT% "%TSTTRGDIR%\%1%.3.sql" -%MAL_CLIENT% "%TSTTRGDIR%\%1%.2.mal" -%SQL_CLIENT% "%TSTTRGDIR%\%1%.4.sql" diff --git a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.sh b/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.sh deleted file mode 100755 --- a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.SQL.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.1.sql" -Mlog -x "$MAL_CLIENT $TSTTRGDIR/$1.2.mal" -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.3.sql" -Mlog -x "$MAL_CLIENT $TSTTRGDIR/$1.2.mal" -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.3.sql" -Mlog -x "$MAL_CLIENT $TSTTRGDIR/$1.2.mal" -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.4.sql" diff --git a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.csv b/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.csv deleted file mode 100644 --- a/sql/test/BugTracker-2009/Tests/union_leak.SF-2540169.csv +++ /dev/null @@ -1,201 +0,0 @@ -"float1" -3.6 -48.8 -63.2 -81.5 -13 -80.3 -73.7 -9.5 -87.7 -98.8 -50.1 -15.6 -3.4 -36.6 -14.9 -55 -92.2 -99.1 -8.3 -38.3 -75.8 -95.1 -72.9 -85.9 -32.8 -64.4 -20.4 -85.3 -63.2 -50.3 -41.7 -68.8 -21.5 -55 -90.2 -59 -75.1 -90.2 -21.6 -57.3 -42.3 -6.2 -66 -60 -64.1 -23 -71.5 -4.5 -36.9 -54.3 -97.6 -4.6 -72.2 -47.1 -42.3 -75 -89 -69.5 -61.2 -4.2 -4.5 -87.3 -61 -2.7 -33.5 -36.9 -46.3 -6.6 -71.6 -32 -95.4 -12.4 -6.5 -23 -96.1 -9.2 -70.8 -51.7 -35.2 -86.2 -5.6 -11.7 -23.4 -68.4 -33.4 -16.6 -66.3 -32.3 -72.5 -44.8 -49.3 -44.5 -31.3 -10.3 -84.9 -17 -40.1 -14.4 -62.8 -27 -23 -9.2 -90.4 -1 -43.2 -44.1 -63.9 -28.7 -75.6 -36.2 -81.1 -2.6 -7.5 -80 -69.1 -93.8 -45.6 -23.9 -60.8 -56.4 -88.5 -95 -59.4 -28.2 -68 -47.5 -3.7 -73 -84.6 -35 -68.2 -50.7 -85.6 -54.6 -79 -13.5 -24.7 -58 -37.2 -95.3 -12.9 -22.2 -81.3 -36.3 -63.7 -42 -60.9 -80.6 -7.8 -48.2 -86.4 -10.1 -32.8 -48.6 -24.1 -44.9 -64.2 -7.3 -77.7 -55.5 -62.9 -74.7 -7.2 -59.5 -97.7 -46.4 -90.7 -79.1 -21.8 -43.9 -73.5 -26.7 -91 -98.1 -8.3 -93.3 -69.2 -46.7 -91.2 -5.9 -44.7 -7 -60.9 -70.5 -89.8 -47.7 -8.8 -79.8 -27.2 -76.8 -15.3 -73.1 -8.6 -16 -43.7 -39.4 -38.4 -90.3 -90 -67.4 -53.7 -50 -36.3 -97.1 -38.1 -32.6 -33.3 -59.3 -19.8 -64 -88 -90.2 -24.7 -59 -8.3 -76.9 -22.7 -68.4 -53.9 -81.4 -48.9 -56.7 -12.4 -90.7 -48 -26 -25.7 -53.4 -70.5 -75.5 -13.4 -93.5 -29.5 ___ checkin-list mailing list
MonetDB: mtest - Don't use shell or command line scripts, instea...
Changeset: 1b36512eb332 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1b36512eb332 Added Files: sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.err sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.out sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.test sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.del.reqtests sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.del.sql sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.del.stable.err sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.del.stable.out sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.del.test sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view1.reqtests sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view1.stable.err sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view1.stable.out sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view1.test sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view2.reqtests sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view2.stable.err sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view2.stable.out sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.view2.test Removed Files: sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.bat sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.sh sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.stable.err sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.stable.out Modified Files: sql/test/BugTracker-2009/Tests/All Branch: mtest Log Message: Don't use shell or command line scripts, instead add tests with dependencies diffs (truncated from 715 to 300 lines): diff --git a/sql/test/BugTracker-2009/Tests/All b/sql/test/BugTracker-2009/Tests/All --- a/sql/test/BugTracker-2009/Tests/All +++ b/sql/test/BugTracker-2009/Tests/All @@ -93,7 +93,10 @@ overflow.SF-2853458 bit_and.SF-2850341 double_count_limit_bug.SF-2862146 create_on_ro_db_crash.SF-2830238 -old_views_incorrectly_reused.SF-2863804 +old_views_incorrectly_reused.SF-2863804.def +old_views_incorrectly_reused.SF-2863804.view1 +old_views_incorrectly_reused.SF-2863804.view2 +old_views_incorrectly_reused.SF-2863804.del updating_non-loaded_columns.SF-2864313_OK-0 updating_non-loaded_columns.SF-2864313_KO-1 updating_non-loaded_columns.SF-2864313_KO-2 diff --git a/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.bat b/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.bat deleted file mode 100755 --- a/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.bat +++ /dev/null @@ -1,6 +0,0 @@ -@prompt # $t $g -@echo on - -%SQL_CLIENT% "%TSTTRGDIR%\%1%.def.sql" -%SQL_CLIENT% "%TSTTRGDIR%\%1%.view1.sql" -%SQL_CLIENT% "%TSTTRGDIR%\%1%.view2.sql" diff --git a/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.sh b/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.sh deleted file mode 100755 --- a/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.SQL.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.def.sql" -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.view1.sql" -Mlog -x "$SQL_CLIENT $TSTTRGDIR/$1.view2.sql" diff --git a/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.err b/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.err @@ -0,0 +1,12 @@ +stderr of test 'old_views_incorrectly_reused.SF-2863804.def` in directory 'sql/test/BugTracker-2009` itself: + + +# 14:01:21 > +# 14:01:21 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-77000" "--port=33925" +# 14:01:21 > + + +# 14:01:21 > +# 14:01:21 > "Done." +# 14:01:21 > + diff --git a/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.out b/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2009/Tests/old_views_incorrectly_reused.SF-2863804.def.stable.out @@ -0,0 +1,30 @@ +stdout of test 'old_views_incorrectly_reused.SF-2863804.def` in directory 'sql/test/BugTracker-2009` itself: + + +# 14:01:21 > +# 14:01:21 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e"
MonetDB: Oct2020 - Coverity inspired fixes.
Changeset: b009cad15c3e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b009cad15c3e Modified Files: monetdb5/mal/mal_client.c monetdb5/mal/mal_module.c monetdb5/mal/mal_prelude.c monetdb5/modules/atoms/json.c monetdb5/modules/kernel/batmmath.c monetdb5/modules/kernel/batstr.c monetdb5/modules/mal/batcalc.c monetdb5/modules/mal/orderidx.c monetdb5/optimizer/opt_macro.c tools/merovingian/daemon/forkmserver.c Branch: Oct2020 Log Message: Coverity inspired fixes. diffs (truncated from 360 to 300 lines): diff --git a/monetdb5/mal/mal_client.c b/monetdb5/mal/mal_client.c --- a/monetdb5/mal/mal_client.c +++ b/monetdb5/mal/mal_client.c @@ -71,7 +71,10 @@ MCinit(void) maxclients = atoi(max_clients); if (maxclients <= 0) { maxclients = 64; - GDKsetenv("max_clients", "64"); + if (GDKsetenv("max_clients", "64") != GDK_SUCCEED) { + TRC_CRITICAL(MAL_SERVER, "Initialization failed: " MAL_MALLOC_FAIL "\n"); + return false; + } } MAL_MAXCLIENTS = /* client connections */ maxclients; diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c --- a/monetdb5/mal/mal_module.c +++ b/monetdb5/mal/mal_module.c @@ -42,8 +42,8 @@ findFunctionImplementation(const char *c Symbol s; if ((s = moduleIndex[i]->space[j]) != NULL) { do { - if (strcmp(s->def->binding, cname) == 0 && - s->def && + if (s->def && + strcmp(s->def->binding, cname) == 0 && s->def->stmt && s->def->stmt[0] && s->def->stmt[0]->fcn) { diff --git a/monetdb5/mal/mal_prelude.c b/monetdb5/mal/mal_prelude.c --- a/monetdb5/mal/mal_prelude.c +++ b/monetdb5/mal/mal_prelude.c @@ -334,8 +334,10 @@ melFunction(bool command, char *mod, cha (void)comment; if (fname) strcpy(mb->binding, fname); - if( mb == NULL) + if (mb == NULL) { + freeSymbol(s); return MEL_ERR; + } sig = newInstruction(mb, mod, fcn); sig->retc = 0; sig->argc = 0; @@ -347,16 +349,22 @@ melFunction(bool command, char *mod, cha if(retc == 0) { idx = newTmpVariable(mb, TYPE_void); sig = pushReturn(mb, sig, idx); - if (sig == NULL) + if (idx < 0 || sig == NULL) { + freeInstruction(sig); + freeSymbol(s); return MEL_ERR; + } } for (i = 0; i 0) { if (a.isbat) @@ -373,8 +381,11 @@ melFunction(bool command, char *mod, cha mel_func_arg a = va_arg(va, mel_func_arg); idx = makeFuncArgument(mb, ); sig = pushArgument(mb, sig, idx); - if (sig == NULL) + if (idx < 0 || sig == NULL) { + freeInstruction(sig); + freeSymbol(s); return MEL_ERR; + } int tpe = TYPE_any; if (a.nr > 0) { if (a.isbat) diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1417,7 +1417,8 @@ JSONjson2number(dbl *ret, json *js) { dbl val = 0; dbl *val_ptr = - JSONjson2numberInternal((void **)_ptr, js, strtod_wrapper); + str tmp; + rethrow(__func__, tmp, JSONjson2numberInternal((void **)_ptr, js, strtod_wrapper)); if (val_ptr == NULL) { *ret = dbl_nil; @@ -1434,8 +1435,9 @@ JSONjson2integer(lng *ret, json *js) { lng val = 0; lng *val_ptr = + str tmp; - JSONjson2numberInternal((void **)_ptr, js, strtol_wrapper); + rethrow(__func__, tmp, JSONjson2numberInternal((void **)_ptr, js, strtol_wrapper)); if (val_ptr == NULL) { *ret = lng_nil; } diff --git a/monetdb5/modules/kernel/batmmath.c b/monetdb5/modules/kernel/batmmath.c --- a/monetdb5/modules/kernel/batmmath.c +++ b/monetdb5/modules/kernel/batmmath.c @@ -338,8 +338,10 @@ CMDscienceBINARY(MalStkPtr stk, InstrPtr BBPunfix(b1->batCacheid); if (b2) BBPunfix(b2->batCacheid); +/* cannot happen if (s1) BBPunfix(s1->batCacheid); +*/ if (s2) BBPunfix(s2->batCacheid);
MonetDB: mtest - Silencing more Python tests and removed unused ...
Changeset: 983b8d3f87ef for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=983b8d3f87ef Removed Files: sql/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.SQL.py sql/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.stable.err sql/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.stable.out Modified Files: sql/test/BugTracker-2009/Tests/All sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.SQL.py sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.out sql/test/BugTracker-2009/Tests/lost_update.SF-2790020.SQL.py sql/test/BugTracker-2009/Tests/lost_update.SF-2790020.stable.err sql/test/BugTracker-2009/Tests/lost_update.SF-2790020.stable.out sql/test/BugTracker-2009/Tests/parallel_bulk-load.SF-2771052.unpack_csv.py sql/test/BugTracker-2009/Tests/parallel_bulk-load.SF-2771052.unpack_csv.stable.out Branch: mtest Log Message: Silencing more Python tests and removed unused set_history_and_drop_table.SF-2607045 test (it's files are now missing) diffs (truncated from 747 to 300 lines): diff --git a/sql/test/BugTracker-2009/Tests/All b/sql/test/BugTracker-2009/Tests/All --- a/sql/test/BugTracker-2009/Tests/All +++ b/sql/test/BugTracker-2009/Tests/All @@ -27,7 +27,6 @@ rollback_bug update-crash correlated-selection-bug row_number_bug.SF-2546109 -#set_history_and_drop_table.SF-2607045 not relevant anymore TypeException_having_count_distinct.SF-2494227 insert_into_done_by_procedure.SF-2607293 decimal_needs_truncation.SF-2605686 diff --git a/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.SQL.py b/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.SQL.py --- a/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.SQL.py +++ b/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.SQL.py @@ -1,4 +1,6 @@ -import os, socket, sys, tempfile +import os, socket, tempfile + +from MonetDBtesting.sqltest import SQLTestCase try: from MonetDBtesting import process except ImportError: @@ -12,15 +14,6 @@ def freeport(): return port myport = freeport() -def client(input): -c = process.client('sql', port=myport, dbname='db1', stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) -out, err = c.communicate(input) -sys.stdout.write(out) -sys.stderr.write(err) - -script1 = '''\ -create table t2 (a int); -''' with tempfile.TemporaryDirectory() as farm_dir: os.mkdir(os.path.join(farm_dir, 'db1')) @@ -29,15 +22,13 @@ with tempfile.TemporaryDirectory() as fa dbfarm=os.path.join(farm_dir, 'db1'), stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s: -out, err = s.communicate() -sys.stdout.write(out) -sys.stderr.write(err) +s.communicate() with process.server(mapiport=myport, dbname='db1', dbfarm=os.path.join(farm_dir, 'db1'), args=["--set", "gdk_readonly=yes"], stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s: -client(script1) -out, err = s.communicate() -sys.stdout.write(out) -sys.stderr.write(err) +with SQLTestCase() as tc: +tc.connect(username="monetdb", password="monetdb", port=myport, database='db1') +tc.execute("create table t2 (a int);").assertFailed(err_message="Schema statements cannot be executed on a readonly database.") +s.communicate() diff --git a/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err b/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err --- a/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err +++ b/sql/test/BugTracker-2009/Tests/create_on_ro_db_crash.SF-2830238.stable.err @@ -5,61 +5,6 @@ stderr of test 'create_on_ro_db_crash.SF # 21:37:20 > /usr/bin/python create_on_ro_db_crash.SF-2830238.py create_on_ro_db_crash.SF-2830238 # 21:37:20 > -MAPI = (monetdb) /var/tmp/mtest-27483/.s.monetdb.35395 -QUERY = create table t2 (a int); -ERROR = !Schema statements cannot be executed on a readonly database. -CODE = 25006 -# builtin opt gdk_dbpath = /ufs/sjoerd/@Monet-candidate/var/monetdb5/dbfarm/demo -# 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 = yes -# builtin opt host = localhost -# builtin opt mapi_port = 5 -# builtin opt mapi_noheaders = no -# builtin opt mapi_debug = 0 -# builtin opt
MonetDB: mtest - Another badly converted BOM test and don't forg...
Changeset: b5d9f67cef75 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b5d9f67cef75 Added Files: sql/test/BugTracker-2009/Tests/BOM.SF-2787813.py Removed Files: sql/test/BugTracker-2009/Tests/BOM.SF-2787813.sql sql/test/BugTracker-2009/Tests/BOM.SF-2787813.test Modified Files: sql/test/BugTracker-2009/Tests/BOM.SF-2787813.stable.err sql/test/BugTracker-2009/Tests/BOM.SF-2787813.stable.out sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py Branch: mtest Log Message: Another badly converted BOM test and don't forget to check the expected result diffs (159 lines): diff --git a/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.sql b/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.py rename from sql/test/BugTracker-2009/Tests/BOM.SF-2787813.sql rename to sql/test/BugTracker-2009/Tests/BOM.SF-2787813.py --- a/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.sql +++ b/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.py @@ -1,1 +1,21 @@ -select 1; +import sys + +try: +from MonetDBtesting import process +except ImportError: +import process + + +# This line starts with the BOM followed by SELECT 1;\n +INPUT1 = b"\xEF\xBB\xBF\x53\x45\x4C\x45\x43\x54\x20\x31\x3B\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(INPUT1) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'Unexpected character (U+FEFF)' not in err: +sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") +if "[ 1\\t]" not in str(out): +sys.stderr.write("The select 1; after the BOM character should have run and returned the result 1") + diff --git a/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.stable.err b/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.stable.err --- a/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.stable.err +++ b/sql/test/BugTracker-2009/Tests/BOM.SF-2787813.stable.err @@ -5,72 +5,6 @@ stderr of test 'BOM.SF-2787813` in direc # 17:07:23 > mserver5 "--config=/ufs/sjoerd/Monet-Stable/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/sjoerd/src/MonetDB/stable/sql/x86_64-unknown-linux-gnu/src/backends/monet5/.libs:/ufs/sjoerd/src/MonetDB/stable/sql/x86_64-unknown-linux-gnu/src/backends/monet5:/ufs/sjoerd/Monet-Stable/lib64/MonetDB5:/ufs/sjoerd/Monet-Stable/lib64/MonetDB5/lib:/ufs/sjoerd/Monet-Stable/lib64/MonetDB5/bin" --set "gdk_dbfarm=/ufs/sjoerd/src/MonetDB/stable/sql/x86_64-unknown-linux-gnu/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=35738 --set xrpc_port=45769 --set monet_prompt= --trace "--dbname=mTests_src_test_BugTracker-2009" --set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over.. # 17:07:23 > -# builtin opt gdk_arch = 64bitx86_64-unknown-linux-gnu -# builtin opt gdk_version = 1.30.0 -# builtin opt prefix = /ufs/sjoerd/Monet-Stable -# 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 = ${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 sql_logdir = sql_logs -# builtin opt xquery_logdir = xquery_logs -# builtin opt standoff_ns = http://monetdb.cwi.nl/standoff -# builtin opt standoff_start = start -# builtin opt standoff_end = end -# config opt prefix = /ufs/sjoerd/Monet-Stable -# config opt config = ${prefix}/etc/monetdb5.conf -# config opt prefix = /ufs/sjoerd/Monet-Stable -# config opt exec_prefix = ${prefix} -# config opt gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm -# config opt gdk_dbname = demo -# config opt gdk_alloc_map = no -# config opt gdk_embedded = no -# config opt gdk_debug = 0 -# config opt monet_mod_path = ${prefix}/lib64/MonetDB5:${prefix}/lib64/MonetDB5/lib:${prefix}/lib64/MonetDB5/bin -# config opt monet_daemon = no -# config opt monet_welcome = yes -# config opt mero_msglog = ${prefix}/var/log/MonetDB/merovingian.log -# config opt mero_errlog = ${prefix}/var/log/MonetDB/merovingian.log -# config opt mero_pidfile = ${prefix}/var/run/MonetDB/merovingian.pid -# config opt mero_exittimeout = 7 -# config opt mero_doproxy = yes -# config opt mero_discoveryttl = 600 -# config opt mal_init = ${prefix}/lib64/MonetDB5/mal_init.mal -# config opt mal_listing = 2 -# config opt mapi_port = 5 -# config opt mapi_open = false -# config opt sql_logdir = sql_logs -# cmdline opt config =
MonetDB: mtest - Converting unicode-bom.Bug-2641 test to Python ...
Changeset: 2aaa4be50f21 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2aaa4be50f21 Added Files: sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py Removed Files: sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.test Modified Files: sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.out Branch: mtest Log Message: Converting unicode-bom.Bug-2641 test to Python (we can't write the BOM character from pymonetdb on normal circustances), but I think there's a bug with BOM character as an identifier diffs (229 lines): diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py rename from sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql rename to sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py --- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.sql +++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.py @@ -1,10 +1,66 @@ --- The Unicode BOM (Byte Order Marker) is only a BOM when at the start --- of a file. Anywhere else it's a ZERO WIDTH NO-BREAK SPACE which we --- shouldn't ignore. - --- the line above has nothing but the BOM, the line below starts with one -SELECT 1; --- next line has the BOM in the middle of the SELECT -SELECT 1; --- finally, more than one BOM scattered over the entire statement -SELECT 1; +import sys + +try: +from MonetDBtesting import process +except ImportError: +import process + + +# The Unicode BOM (Byte Order Marker) is only a BOM when at the start +# of a file. Anywhere else it's a ZERO WIDTH NO-BREAK SPACE which we +# shouldn't ignore. + +# This line has the BOM character plus the newline +INPUT1 = b"\xEF\xBB\xBF\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(INPUT1) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'Unexpected character (U+FEFF)' not in err: +sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") + +# This line starts with the BOM followed by SELECT 1;\n +INPUT2 = b"\xEF\xBB\xBF\x53\x45\x4C\x45\x43\x54\x20\x31\x3B\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(INPUT2) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'Unexpected character (U+FEFF)' not in err: +sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") + +# This line has the BOM in the middle of the SELECT 1;\n +INPUT3 = b"\x53\x45\x4C\xEF\xBB\xBF\x45\x43\x54\x20\x31\x3B\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(INPUT3) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'syntax error in' not in err: +sys.stderr.write("Expected stderr to contain 'syntax error in'") + +# More than one BOM scattered over the entire statement +INPUT4 = b"\x53\x45\xEF\xBB\xBF\x4C\x45\xEF\xBB\xBF\x43\x54\xEF\xBB\xBF\x20\x31\xEF\xBB\xBF\x3B\xEF\xBB\xBF\x0A" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(INPUT4) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'Unexpected character (U+FEFF)' not in err: +sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") + +# Using BOM as a SQL identifier +INPUT5 = b"\x53\x45\x4C\x45\x43\x54\x20\x22\xEF\xBB\xBF\x22\x3B" +with process.client('sql', text=False, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +out, err = c.communicate(INPUT5) +retcode = c.returncode + +if retcode == 0: +sys.stderr.write("Expected nonzero return code") +if not err or b'Unexpected character (U+FEFF)' not in err: +sys.stderr.write("Expected stderr to contain 'Unexpected character (U+FEFF)'") diff --git a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err --- a/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err +++ b/sql/test/BugTracker-2010/Tests/unicode-bom.Bug-2641.stable.err @@ -5,88 +5,6 @@ stderr of test 'unicode-bom.Bug-2641` in # 11:21:04 > mserver5 "--config=/ufs/fabian/scratch/monetdb/Jun2010/program-x86_64/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set
MonetDB: mtest - Silence client's stderr, and removed redundant ...
Changeset: 5cfb3ec1ae60 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5cfb3ec1ae60 Removed Files: sql/test/BugTracker-2017/Tests/too-large-decimals.Bug-6192.stable.err.int128 Modified Files: sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py Branch: mtest Log Message: Silence client's stderr, and removed redundant error output diffs (73 lines): diff --git a/sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py b/sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py --- a/sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py +++ b/sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py @@ -1,4 +1,6 @@ -import os, socket, sys, tempfile +import os, socket, tempfile + +from MonetDBtesting.sqltest import SQLTestCase try: from MonetDBtesting import process except ImportError: @@ -19,9 +21,7 @@ with tempfile.TemporaryDirectory() as fa dbfarm=os.path.join(farm_dir, 'db1'), stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as srv: -with process.client('sql', port=myport, dbname='db1', -stdin=process.PIPE, stdout=process.PIPE, -stderr=process.PIPE) as c: -out, err = c.communicate('call sys.shutdown(10);') -sys.stderr.write(err) +with SQLTestCase() as tc: +tc.connect(username="monetdb", password="monetdb", port=myport, database='db1') +tc.execute("call sys.shutdown(10);").assertSucceeded() srv.communicate() diff --git a/sql/test/BugTracker-2017/Tests/too-large-decimals.Bug-6192.stable.err.int128 b/sql/test/BugTracker-2017/Tests/too-large-decimals.Bug-6192.stable.err.int128 deleted file mode 100644 --- a/sql/test/BugTracker-2017/Tests/too-large-decimals.Bug-6192.stable.err.int128 +++ /dev/null @@ -1,44 +0,0 @@ -stderr of test 'too-large-decimals.Bug-6192` in directory 'sql/test/BugTracker-2017` itself: - - -# 14:58:47 > -# 14:58:47 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=32047" "--set" "mapi_usock=/var/tmp/mtest-18303/.s.monetdb.32047" "--set" "monet_prompt=" "--forcemito" "--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017" "--set" "embedded_r=yes" "--set" "embedded_py=true" -# 14:58:47 > - -# builtin opt gdk_dbpath = /ufs/sjoerd/Monet-stable/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 32047 -# cmdline opt mapi_usock = /var/tmp/mtest-18303/.s.monetdb.32047 -# cmdline opt monet_prompt = -# cmdline opt gdk_dbpath = /ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017 -# cmdline opt embedded_r = yes -# cmdline opt embedded_py = true -# cmdline opt gdk_debug = 536870922 - -# 14:58:48 > -# 14:58:48 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-18303" "--port=32047" -# 14:58:48 > - -MAPI = (monetdb) /var/tmp/mtest-18303/.s.monetdb.32047 -QUERY = INSERT INTO test_table4 VALUES (531421754532.553234531231250); -ERROR = !overflow in conversion to DECIMAL(12,2). -CODE = 22003 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = INSERT INTO test_table4 VALUES (531421754532); -ERROR = !overflow in conversion to DECIMAL(12,2). -CODE = 22003 - -# 14:58:48 > -# 14:58:48 > "Done." -# 14:58:48 > - ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mmt - Keep the parts of merge/replica tables with in th...
Changeset: a5fabb4507d0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a5fabb4507d0 Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/sql_cat.c sql/common/sql_list.c sql/include/sql_catalog.h sql/server/rel_distribute.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_partition.c sql/storage/sql_catalog.c sql/storage/store.c Branch: mmt Log Message: Keep the parts of merge/replica tables with in the schema. (on merge/replica level we keep a list). Each partition now has a counter, counting the number of times the table is member of a hierarchy. diffs (truncated from 1453 to 300 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 @@ -389,12 +389,14 @@ create_table_or_view(mvc *sql, char* sna mvc_copy_key(sql, nt, k); } } - if (t->members.set) { - for (n = t->members.set->h; n; n = n->next) { + /* + if (t->members) { + for (n = t->members->h; n; n = n->next) { sql_part *pt = n->data; mvc_copy_part(sql, nt, pt); } } + */ if (t->triggers.set) { for (n = t->triggers.set->h; n; n = n->next) { sql_trigger *tr = n->data; diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -157,7 +157,7 @@ validate_alter_table_add_table(mvc *sql, const char *errtable = TABLE_TYPE_DESCRIPTION(rmt->type, rmt->properties); if (!update && (!isMergeTable(rmt) && !isReplicaTable(rmt))) throw(SQL,call,SQLSTATE(42S02) "ALTER TABLE: cannot add table '%s.%s' to %s '%s.%s'", psname, ptname, errtable, msname, mtname); - node *n = cs_find_id(>members, rpt->base.id); + node *n = list_find_base_id(rmt->members, rpt->base.id); if (isView(rpt)) throw(SQL,call,SQLSTATE(42000) "ALTER TABLE: can't add a view into a %s", errtable); if (isDeclaredTable(rpt)) @@ -415,7 +415,7 @@ alter_table_del_table(mvc *sql, char *ms const char *errtable = TABLE_TYPE_DESCRIPTION(mt->type, mt->properties); if (!isMergeTable(mt) && !isReplicaTable(mt)) throw(SQL,"sql.alter_table_del_table",SQLSTATE(42S02) "ALTER TABLE: cannot drop table '%s.%s' to %s '%s.%s'", psname, ptname, errtable, msname, mtname); - if (!(n = cs_find_id(>members, pt->base.id))) + if (!(n = list_find_base_id(mt->members, pt->base.id))) throw(SQL,"sql.alter_table_del_table",SQLSTATE(42S02) "ALTER TABLE: table '%s.%s' isn't part of %s '%s.%s'", ps->base.name, ptname, errtable, ms->base.name, mtname); sql_trans_del_table(sql->session->tr, mt, pt, drop_action); @@ -1710,7 +1710,7 @@ SQLrename_table(Client cntxt, MalBlkPtr throw(SQL, "sql.rename_table", SQLSTATE(42000) "ALTER TABLE: not possible to change schema of a declared table"); if (mvc_check_dependency(sql, t->base.id, TABLE_DEPENDENCY, NULL)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' (there are database objects which depend on it)", otable_name); - if (!list_empty(t->members.set)) + if (!list_empty(t->members)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' while it has children", otable_name); if (!list_empty(t->triggers.set)) throw(SQL, "sql.rename_table", SQLSTATE(2BM37) "ALTER TABLE: unable to set schema of table '%s' while it has triggers", otable_name); diff --git a/sql/common/sql_list.c b/sql/common/sql_list.c --- a/sql/common/sql_list.c +++ b/sql/common/sql_list.c @@ -309,6 +309,7 @@ list_remove_node(list *l, node *n) if (p != n) while (p && p->next != n) p = p->next; + assert(p==n||(p && p->next == n)); if (p == n) { l->h = n->next; p = NULL; @@ -323,7 +324,7 @@ list_remove_node(list *l, node *n) MT_lock_unset(>ht_lock); node_destroy(l, n); l->cnt--; - assert(l->cnt >= 0); + assert(l->cnt > 0 || l->h == NULL); return p; } diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h --- a/sql/include/sql_catalog.h +++ b/sql/include/sql_catalog.h @@ -267,6 +267,7 @@ typedef struct sql_schema { changeset types; changeset funcs; changeset seqs; + changeset parts;/* merge/replica tables can only contain parts from the same
MonetDB: mtest - Badly converted prepared statement tests
Changeset: 54bd5e4eff3b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54bd5e4eff3b Modified Files: sql/test/BugTracker-2009/Tests/decimal_needs_truncation.SF-2605686.test sql/test/BugTracker-2009/Tests/prepare_commit_execute.SF-2606020.test sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.test sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.test sql/test/subquery/Tests/subquery4.test Branch: mtest Log Message: Badly converted prepared statement tests diffs (100 lines): diff --git a/sql/test/BugTracker-2009/Tests/decimal_needs_truncation.SF-2605686.test b/sql/test/BugTracker-2009/Tests/decimal_needs_truncation.SF-2605686.test --- a/sql/test/BugTracker-2009/Tests/decimal_needs_truncation.SF-2605686.test +++ b/sql/test/BugTracker-2009/Tests/decimal_needs_truncation.SF-2605686.test @@ -15,10 +15,10 @@ select * from testdec 0.123 -statement error +statement ok PREPARE INSERT INTO testdec (testdec) values (?) -statement error +statement ok exec **(0.12345) query R rowsort diff --git a/sql/test/BugTracker-2009/Tests/prepare_commit_execute.SF-2606020.test b/sql/test/BugTracker-2009/Tests/prepare_commit_execute.SF-2606020.test --- a/sql/test/BugTracker-2009/Tests/prepare_commit_execute.SF-2606020.test +++ b/sql/test/BugTracker-2009/Tests/prepare_commit_execute.SF-2606020.test @@ -10,28 +10,28 @@ commit statement ok start transaction -statement error +statement ok prepare insert into pce (i,s) values (?,?) -statement error +statement ok exec **(1,'test 1') -statement error +statement ok select * from pce -statement error +statement ok commit statement ok start transaction -statement error +statement ok exec **(2,'test 2') -statement error +statement ok select * from pce -statement error +statement ok commit statement ok diff --git a/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.test b/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.test --- a/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.test +++ b/sql/test/BugTracker-2009/Tests/prepare_decimal_bug.SF-2831994.test @@ -5,7 +5,7 @@ create table "test2831994" ( "value2" DECIMAL (5, 5) ) -statement error +statement ok prepare insert into "test2831994"("id","value","value2") values (?, ?, ?) statement error diff --git a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.test b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.test --- a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.test +++ b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.test @@ -8,9 +8,9 @@ statement error select a statement error -iamerror; --just an error +iamerror statement error -select a; --a is not there +select a diff --git a/sql/test/subquery/Tests/subquery4.test b/sql/test/subquery/Tests/subquery4.test --- a/sql/test/subquery/Tests/subquery4.test +++ b/sql/test/subquery/Tests/subquery4.test @@ -27,12 +27,12 @@ PREPARE SELECT (SELECT ? FROM evilfunction((SELECT 1))) FROM another_T -statement error +statement ok PREPARE SELECT (SELECT 1 FROM evilfunction((SELECT ?))) FROM another_T -statement error +statement ok PREPARE SELECT (SELECT 1 FROM evilfunction((SELECT ?, ?))) FROM another_T ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: mtest - Don't print server's stderr
Changeset: 3431ffb244bf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3431ffb244bf Modified Files: sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py sql/test/BugTracker-2013/Tests/corrupt-after-restart.Bug-3282.SQL.py sql/test/BugTracker-2017/Tests/shutdown.Bug-6182.SQL.py sql/test/BugTracker-2018/Tests/local_replica_table_not_detected.Bug-6620.py sql/test/BugTracker-2018/Tests/remote-table-where-is-null.Bug-6601.py sql/test/BugTracker-2018/Tests/remote-table-where-not-equal.Bug-6621.py sql/test/BugTracker-2019/Tests/alter_table_drop_column.Bug-6749.py sql/test/BugTracker-2019/Tests/remote-table-non-existent-column.Bug-6750.py sql/test/BugTracker-2020/Tests/functions-not-persist.Bug-6819.SQL.py sql/test/BugTracker-2020/Tests/remote-table-like.Bug-6841.py sql/test/BugTracker-2020/Tests/table-udf-on-remote.Bug-6971.py sql/test/BugTracker/Tests/mdb_starts_with_sql_debug_64.SF-1999354.SQL.py sql/test/BugTracker/Tests/set_a_new_user_password.SF-1844050.SQL.py sql/test/BugTracker/Tests/set_sql_debug_64__breaking_the_DB.SF-1906287.SQL.py sql/test/merge-partitions/Tests/mergepart23.SQL.py sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-table.py sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-view.py sql/test/rename/Tests/rename00.SQL.py sql/test/rename/Tests/rename11.py sql/test/scripts/Tests/alastair_udf_mergetable_bug.py Branch: mtest Log Message: Don't print server's stderr diffs (truncated from 492 to 300 lines): diff --git a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py --- a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py +++ b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py @@ -19,8 +19,7 @@ with tempfile.TemporaryDirectory() as fa dbfarm=os.path.join(farm_dir, 'db1'), stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s: -out, err = s.communicate() -sys.stderr.write(err) +s.communicate() with process.server(mapiport=myport, dbname='db1', dbfarm=os.path.join(farm_dir, 'db1'), stdin=process.PIPE, @@ -48,5 +47,4 @@ with tempfile.TemporaryDirectory() as fa cursor.close() client.close() -out, err = s.communicate() -sys.stderr.write(err) +s.communicate() diff --git a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py --- a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py +++ b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py @@ -34,8 +34,7 @@ with tempfile.TemporaryDirectory() as fa cur1.close() client1.close() -out, err = dproc.communicate() -sys.stderr.write(err) +dproc.communicate() with process.server(mapiport=dport, dbname='db', dbfarm=os.path.join(farm_dir, 'db'), @@ -53,5 +52,4 @@ with tempfile.TemporaryDirectory() as fa cur1.close() client1.close() -out, err = dproc.communicate() -sys.stderr.write(err) +dproc.communicate() diff --git a/sql/test/BugTracker-2013/Tests/corrupt-after-restart.Bug-3282.SQL.py b/sql/test/BugTracker-2013/Tests/corrupt-after-restart.Bug-3282.SQL.py --- a/sql/test/BugTracker-2013/Tests/corrupt-after-restart.Bug-3282.SQL.py +++ b/sql/test/BugTracker-2013/Tests/corrupt-after-restart.Bug-3282.SQL.py @@ -53,8 +53,7 @@ with tempfile.TemporaryDirectory() as fa sys.stderr.write('Expected 2097152') cur.close() cli.close() -out, err = s.communicate() -sys.stderr.write(err) +s.communicate() with process.server(mapiport=myport, dbname='db1', dbfarm=os.path.join(farm_dir, 'db1'), stdin=process.PIPE, @@ -66,8 +65,7 @@ with tempfile.TemporaryDirectory() as fa sys.stderr.write('Expected 2097152') cur.close() cli.close() -out, err = s.communicate() -sys.stderr.write(err) +s.communicate() with process.server(mapiport=myport, dbname='db1', dbfarm=os.path.join(farm_dir, 'db1'), stdin=process.PIPE, @@ -80,5 +78,4 @@ with tempfile.TemporaryDirectory() as fa cur.execute('drop table table3282;') cur.close() cli.close() -out, err = s.communicate() -sys.stderr.write(err) +
MonetDB: mtest - Merged with default
Changeset: e932da68b494 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e932da68b494 Modified Files: clients/Tests/MAL-signatures.test sql/test/miscellaneous/Tests/simple_selects.test sql/test/sys-schema/Tests/systemfunctions.test Branch: mtest Log Message: Merged with default diffs (truncated from 34588 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -161,16 +161,13 @@ BuildRequires: pkgconfig(libR) BuildRequires: texlive-obsolete %endif %endif -# if we were to compile with cmocka support (-DWITH_CMOCKA=ON): -# BuildRequires: pkgconfig(cmocka) -# if we were to compile with NetCDF support (-DNETCDF=ON): -# BuildRequires: pkgconfig(netcdf) -# if we were to compile with proj support (-DWITH_PROJ=ON): -# BuildRequires: pkgconfig(proj) -# if we were to compile with snappy support (-DWITH_SNAPPY=ON): -# BuildRequires: pkgconfig(snappy) -# if we were to compile with valgrind support (-DWITH_VALGRIND=ON): -# BuildRequires: pkgconfig(valgrind) +# optional packages: +# BuildRequires: pkgconfig(cmocka) # -DWITH_CMOCKA=ON +# BuildRequires: pkgconfig(gdal) # -DSHP=ON +# BuildRequires: pkgconfig(netcdf) # -DNETCDF=ON +# BuildRequires: pkgconfig(proj) # -DWITH_PROJ=ON +# BuildRequires: pkgconfig(snappy) # -DWITH_SNAPPY=ON +# BuildRequires: pkgconfig(valgrind) # -DWITH_VALGRIND=ON %if (0%{?fedora} >= 22) Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release} diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -6259,6 +6259,8 @@ stdout of test 'MAL-signatures` in direc [ "batmtime", "timestamp_to_str", "pattern batmtime.timestamp_to_str(X_1:timestamp, X_2:bat[:str], X_3:bat[:oid]):bat[:str] ","MTIMEtimestamp_to_str_bulk_p1;", "" ] [ "batmtime", "timestamp_to_str", "pattern batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str):bat[:str] ", "MTIMEtimestamp_to_str_bulk_p2;", "" ] [ "batmtime", "timestamp_to_str", "pattern batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str, X_3:bat[:oid]):bat[:str] ","MTIMEtimestamp_to_str_bulk_p2;", "" ] +[ "batmtime", "usweekofyear", "pattern batmtime.usweekofyear(X_1:bat[:date]):bat[:int] ", "MTIMEdate_extract_usweekofyear_bulk;", "" ] +[ "batmtime", "usweekofyear", "pattern batmtime.usweekofyear(X_1:bat[:date], X_2:bat[:oid]):bat[:int] ", "MTIMEdate_extract_usweekofyear_bulk;", "" ] [ "batmtime", "weekofyear", "pattern batmtime.weekofyear(X_1:bat[:date]):bat[:int] ", "MTIMEdate_extract_weekofyear_bulk;", "" ] [ "batmtime", "weekofyear", "pattern batmtime.weekofyear(X_1:bat[:date], X_2:bat[:oid]):bat[:int] ","MTIMEdate_extract_weekofyear_bulk;", "" ] [ "batmtime", "year", "pattern batmtime.year(X_1:bat[:date]):bat[:int] ", "MTIMEdate_extract_year_bulk;", "" ] @@ -9089,6 +9091,7 @@ stdout of test 'MAL-signatures` in direc [ "mtime", "timestamp_sub_month_interval", "command mtime.timestamp_sub_month_interval(X_1:timestamp, X_2:int):timestamp ", "MTIMEtimestamp_sub_month_interval;", "" ] [ "mtime", "timestamp_sub_msec_interval", "command mtime.timestamp_sub_msec_interval(X_1:timestamp, X_2:lng):timestamp ", "MTIMEtimestamp_sub_msec_interval;","" ] [ "mtime", "timestamp_to_str", "command mtime.timestamp_to_str(X_1:timestamp, X_2:str):str ", "MTIMEtimestamp_to_str;", "" ] +[ "mtime", "usweekofyear", "command mtime.usweekofyear(X_1:date):int ", "MTIMEdate_extract_usweekofyear;", "" ] [ "mtime", "weekofyear", "command mtime.weekofyear(X_1:date):int ", "MTIMEdate_extract_weekofyear;","" ] [ "mtime", "year", "command mtime.year(X_1:date):int ", "MTIMEdate_extract_year;", "" ] [ "mtime", "year", "command mtime.year(X_1:int):int ", "MTIMEsql_year;", "" ] diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -8789,6 +8789,8 @@ stdout of test 'MAL-signatures` in direc [ "batmtime", "timestamp_to_str", "pattern batmtime.timestamp_to_str(X_1:timestamp, X_2:bat[:str], X_3:bat[:oid]):bat[:str] ","MTIMEtimestamp_to_str_bulk_p1;", "" ] [ "batmtime", "timestamp_to_str", "pattern batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str):bat[:str] ", "MTIMEtimestamp_to_str_bulk_p2;", "" ] [ "batmtime", "timestamp_to_str", "pattern batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str, X_3:bat[:oid]):bat[:str] ","MTIMEtimestamp_to_str_bulk_p2;", "" ] +[ "batmtime", "usweekofyear", "pattern
MonetDB: Oct2020 - Some coverity fixes.
Changeset: 1a756861b128 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a756861b128 Modified Files: monetdb5/mal/mal_authorize.c monetdb5/mal/mal_builder.c monetdb5/mal/mal_profiler.c Branch: Oct2020 Log Message: Some coverity fixes. diffs (85 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -1075,7 +1075,7 @@ AUTHaddRemoteTableCredentials(const char { char *pwhash = NULL; bool free_pw = false; - str tmp, output = MAL_SUCCEED; + str output = MAL_SUCCEED; BUN p; str msg = MAL_SUCCEED; diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c --- a/monetdb5/mal/mal_builder.c +++ b/monetdb5/mal/mal_builder.c @@ -539,7 +539,7 @@ pushStr(MalBlkPtr mb, InstrPtr q, const return NULL; cst.vtype= TYPE_str; if ((cst.val.sval= GDKstrdup(Val)) == NULL) { - str msg = createException(MAL, "pushStr", "Can not allocate string variable") + str msg = createException(MAL, "pushStr", "Can not allocate string variable"); addMalException(mb, msg); freeException(msg); } else{ diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -117,7 +117,8 @@ logdel(struct logbuf *logbuf) static bool logadd(struct logbuf *logbuf, _In_z_ _Printf_format_string_ const char *fmt, ...) - __attribute__((__format__(__printf__, 2, 3))); + __attribute__((__format__(__printf__, 2, 3))) + __attribute__((__warn_unused_result__)); static bool logadd(struct logbuf *logbuf, const char *fmt, ...) { @@ -131,6 +132,8 @@ logadd(struct logbuf *logbuf, const char tmp_len = vsnprintf(tmp_buff, sizeof(tmp_buff), fmt, va); if (tmp_len < 0) { logdel(logbuf); + va_end(va); + va_end(va2); return false; } if (logbuf->loglen + (size_t) tmp_len >= logbuf->logcap) { @@ -146,6 +149,8 @@ logadd(struct logbuf *logbuf, const char if (alloc_buff == NULL) { TRC_ERROR(MAL_SERVER, "Profiler JSON buffer reallocation failure\n"); logdel(logbuf); + va_end(va); + va_end(va2); return false; } logbuf->logbuffer = alloc_buff; @@ -158,6 +163,8 @@ logadd(struct logbuf *logbuf, const char logbuf->loglen += vsnprintf(logbuf->logbase + logbuf->loglen, logbuf->logcap - logbuf->loglen, fmt, va2); + va_end(va); + va_end(va2); return true; } @@ -354,13 +361,13 @@ renderProfilerEvent(Client cntxt, MalBlk if (!logadd(, ",\"width\":%d", d->twidth)) return; /* keeping information about the individual auxiliary heaps is helpful during analysis. */ - if( d->thash) - logadd(, ",\"hash\":" LLFMT, (lng) hashinfo(d->thash, d->batCacheid)); - if( d->tvheap) - logadd(, ",\"vheap\":" LLFMT, (lng) heapinfo(d->tvheap, d->batCacheid)); - if( d->timprints) - logadd(, ",\"imprints\":" LLFMT, (lng) IMPSimprintsize(d)); - /* logadd(, "\"debug\":\"%s\",", d->debugmessages); */ + if( d->thash && !logadd(, ",\"hash\":" LLFMT, (lng) hashinfo(d->thash, d->batCacheid))) + return; + if( d->tvheap && !logadd(, ",\"vheap\":" LLFMT, (lng) heapinfo(d->tvheap, d->batCacheid))) + return; + if( d->timprints && !logadd(, ",\"imprints\":" LLFMT, (lng) IMPSimprintsize(d))) + return; + /* if (!logadd(, "\"debug\":\"%s\",", d->debugmessages)) return; */ BBPunfix(d->batCacheid); } if (!logadd(, ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Approved output
Changeset: 588bbc722502 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=588bbc722502 Modified Files: sql/test/sys-schema/Tests/systemfunctions.stable.out sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 Branch: default Log Message: Approved output diffs (24 lines): diff --git a/sql/test/sys-schema/Tests/systemfunctions.stable.out b/sql/test/sys-schema/Tests/systemfunctions.stable.out --- a/sql/test/sys-schema/Tests/systemfunctions.stable.out +++ b/sql/test/sys-schema/Tests/systemfunctions.stable.out @@ -3595,6 +3595,8 @@ stdout of test 'systemfunctions` in dire [ "sys", "user_statistics", 4, "timestamp","" ] [ "sys", "user_statistics", 5, "bigint", "" ] [ "sys", "user_statistics", 6, "clob", "" ] +[ "sys", "usweekofyear", 0, "int", "usweekofyear" ] +[ "sys", "usweekofyear", 1, "date", "" ] [ "sys", "uuid", 0, "uuid", "create function sys.uuid()\nreturns uuid external name uuid.\"new\";" ] [ "sys", "uuid", 0, "uuid", "create function sys.uuid(d int)\nreturns uuid external name uuid.\"new\";" ] [ "sys", "uuid", 1, "int", "" ] diff --git a/sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 b/sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 --- a/sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 +++ b/sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 @@ -4062,6 +4062,8 @@ stdout of test 'systemfunctions` in dire [ "sys", "user_statistics", 4, "timestamp","" ] [ "sys", "user_statistics", 5, "bigint", "" ] [ "sys", "user_statistics", 6, "clob", "" ] +[ "sys", "usweekofyear", 0, "int", "usweekofyear" ] +[ "sys", "usweekofyear", 1, "date", "" ] [ "sys", "uuid", 0, "uuid", "create function sys.uuid()\nreturns uuid external name uuid.\"new\";" ] [ "sys", "uuid", 0, "uuid", "create function sys.uuid(d int)\nreturns uuid external name uuid.\"new\";" ] [ "sys", "uuid", 1, "int", "" ] ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list