MonetDB: odbc-tls - Fix memory leak in msettings_clone()
Changeset: a0d9e908f2ec for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a0d9e908f2ec Modified Files: clients/mapilib/msettings.c Branch: odbc-tls Log Message: Fix memory leak in msettings_clone() diffs (16 lines): diff --git a/clients/mapilib/msettings.c b/clients/mapilib/msettings.c --- a/clients/mapilib/msettings.c +++ b/clients/mapilib/msettings.c @@ -273,10 +273,10 @@ msettings *msettings_create(void) msettings *msettings_clone(const msettings *orig) { msettings *mp = malloc(sizeof(*mp)); - char **unknowns = calloc(2 * orig->nr_unknown, sizeof(char*)); + char **unknowns = orig->nr_unknown > 0 ? calloc(2 * orig->nr_unknown, sizeof(char*)) : NULL; const char *namebuf = orig->unix_sock_name_buffer; char *cloned_name_buffer = namebuf ? strdup(namebuf) : NULL; - if (!mp || !unknowns || (namebuf && !cloned_name_buffer)) { + if (!mp || (orig->nr_unknown > 0 && !unknowns) || (namebuf && !cloned_name_buffer)) { free(mp); free(unknowns); free(cloned_name_buffer); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - enable ALTER TABLE ... ADD CONSTRAINT ... CHECK...
Changeset: 51333b32e0a1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/51333b32e0a1 Modified Files: sql/backends/monet5/rel_bin.c sql/test/pg_regress/Tests/alter_table.test Branch: check Log Message: enable ALTER TABLE ... ADD CONSTRAINT ... CHECK ... statements diffs (97 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 @@ -5997,33 +5997,36 @@ sql_update_check(backend *be, sql_key * sql_rel* rel = rel_read(sql, sa_strdup(sql->sa, key->check), &pos, sa_list(sql->sa)); stack_pop_frame(sql); - sql_rel* base = rel->l; - assert(strcmp(((sql_exp*) updates->exps->h->data)->alias.name, TID) == 0); - list_append(base->exps, exp_copy(sql, updates->exps->h->data)); - - bool need_join = 0; - list* pexps = sa_list(sql->sa); - sql_exp* tid_exp = exp_copy(sql, updates->exps->h->data); - unsigned label = ++sql->label; - exp_setrelname(sql->sa, tid_exp, label); - list_append(pexps, tid_exp); - for (node* m = base->exps->h; m; m = m->next) { - if (exps_find_exp( updates->exps, m->data) == NULL) { - pexps = list_append(pexps, exp_copy(sql, m->data)); - need_join = 1; - } - } - - if (need_join) { - base = rel_project(sql->sa, base, pexps); - sql_rel* join = rel_crossproduct(sql->sa, base, updates, op_join); - sql_exp* join_cond = exp_compare(sql->sa, exp_ref(sql, base->exps->h->data), exp_ref(sql, updates->exps->h->data), cmp_equal); - join->exps = sa_list(sql->sa); - join->exps = list_append(join->exps, join_cond); - rel->l = join; - } - else { - rel->l = updates; + + if (!key->base.new) { + sql_rel* base = rel->l; + assert(strcmp(((sql_exp*) updates->exps->h->data)->alias.name, TID) == 0); + list_append(base->exps, exp_copy(sql, updates->exps->h->data)); + + bool need_join = 0; + list* pexps = sa_list(sql->sa); + sql_exp* tid_exp = exp_copy(sql, updates->exps->h->data); + unsigned label = ++sql->label; + exp_setrelname(sql->sa, tid_exp, label); + list_append(pexps, tid_exp); + for (node* m = base->exps->h; m; m = m->next) { + if (exps_find_exp( updates->exps, m->data) == NULL) { + pexps = list_append(pexps, exp_copy(sql, m->data)); + need_join = 1; + } + } + + if (need_join) { + base = rel_project(sql->sa, base, pexps); + sql_rel* join = rel_crossproduct(sql->sa, base, updates, op_join); + sql_exp* join_cond = exp_compare(sql->sa, exp_ref(sql, base->exps->h->data), exp_ref(sql, updates->exps->h->data), cmp_equal); + join->exps = sa_list(sql->sa); + join->exps = list_append(join->exps, join_cond); + rel->l = join; + } + else { + rel->l = updates; + } } sql_subfunc *cnt = sql_bind_func(sql, "sys", "count", sql_bind_localtype("void"), NULL, F_AGGR, true, true); @@ -6138,9 +6141,15 @@ rel2bin_update(backend *be, sql_rel *rel return NULL; t = rel_ddl_table_get(tr); - /* no columns to update (probably an new pkey!) */ - if (!rel->exps) + /* no columns to update (probably an new pkey or ckey!) */ + if (!rel->exps) { + for (m = ol_first_node(t->keys); m; m = m->next) { + sql_key * key = m->data; + if (key->type == ckey && key->base.new) + sql_update_check(be, key, rel->r, refs); + } return ddl; + } } if (rel->r) /* first construct the update relation */ diff --git a/sql/test/pg_regress/Tests/alter_table.test b/sql/test/pg_regress/Tests/alter_table.test --- a/sql/test/pg_regress/Tests/alter_table.test +++ b/sql/test/pg_regress/Tests/alter_table.test @@ -469,7 +469,7 @@ create table atacc1 ( test int ) statement ok insert into atacc1 (test) values (2) -statement ok +statement error alter table atacc1 add constraint atacc_test1 check (test>3) statement ok ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - merge with default
Changeset: 9d1fac6dfbb4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9d1fac6dfbb4 Branch: check Log Message: merge with default diffs (118 lines): diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c --- a/monetdb5/modules/atoms/str.c +++ b/monetdb5/modules/atoms/str.c @@ -1910,60 +1910,62 @@ STRselect(MalStkPtr stk, InstrPtr pci, throw(MAL, fname, SQLSTATE(HY013) MAL_MALLOC_FAIL); } - BATiter bi = bat_iterator(b); - QryCtx *qry_ctx = MT_thread_get_qry_ctx(); - if (icase) - str_cmp = str_icmp; - oid *vals = Tloc(bn, 0); - const int klen = str_strlen(key); - if (ci.tpe == cand_dense) { - if (with_strimps_anti) - scanloop(strNil(v) || str_cmp(v, key, klen) == 0, canditer_next_dense); - else if (anti) - scanloop(!strNil(v) && str_cmp(v, key, klen) != 0, canditer_next_dense); - else - scanloop(!strNil(v) && str_cmp(v, key, klen) == 0, canditer_next_dense); - } else { - if (with_strimps_anti) - scanloop(strNil(v) || str_cmp(v, key, klen) == 0, canditer_next); - else if (anti) - scanloop(!strNil(v) && str_cmp(v, key, klen) != 0, canditer_next); - else - scanloop(!strNil(v) && str_cmp(v, key, klen) == 0, canditer_next); - } - bat_iterator_end(&bi); - TIMEOUT_CHECK(qry_ctx, HANDLE_TIMEOUT(qry_ctx)); - - if (!msg) { - BATsetcount(bn, rcnt); - bn->tsorted = true; - bn->trevsorted = bn->batCount <= 1; - bn->tkey = true; - bn->tnil = false; - bn->tnonil = true; - bn->tseqbase = rcnt == 0 ? - 0 : rcnt == 1 ? - *(const oid *) Tloc(bn, 0) : rcnt == ci.ncand && ci.tpe == cand_dense ? ci.hseq : oid_nil; - - if (with_strimps_anti) { - BAT *rev; - if (old_s) { - rev = BATdiffcand(old_s, bn); + if (!strNil(key)) { + BATiter bi = bat_iterator(b); + QryCtx *qry_ctx = MT_thread_get_qry_ctx(); + if (icase) + str_cmp = str_icmp; + oid *vals = Tloc(bn, 0); + const int klen = str_strlen(key); + if (ci.tpe == cand_dense) { + if (with_strimps_anti) + scanloop(strNil(v) || str_cmp(v, key, klen) == 0, canditer_next_dense); + else if (anti) + scanloop(!strNil(v) && str_cmp(v, key, klen) != 0, canditer_next_dense); + else + scanloop(!strNil(v) && str_cmp(v, key, klen) == 0, canditer_next_dense); + } else { + if (with_strimps_anti) + scanloop(strNil(v) || str_cmp(v, key, klen) == 0, canditer_next); + else if (anti) + scanloop(!strNil(v) && str_cmp(v, key, klen) != 0, canditer_next); + else + scanloop(!strNil(v) && str_cmp(v, key, klen) == 0, canditer_next); + } + bat_iterator_end(&bi); + TIMEOUT_CHECK(qry_ctx, HANDLE_TIMEOUT(qry_ctx)); + + if (!msg) { + BATsetcount(bn, rcnt); + bn->tsorted = true; + bn->trevsorted = bn->batCount <= 1; + bn->tkey = true; + bn->tnil = false; + bn->tnonil = true; + bn->tseqbase = rcnt == 0 ? + 0 : rcnt == 1 ? + *(const oid *) Tloc(bn, 0) : rcnt == ci.ncand && ci.tpe == cand_dense ? ci.hseq : oid_nil; + + if (with_strimps_anti) { + BAT *rev; + if (old_s) { + rev = BATdiffcand(old_s, bn); #ifndef NDEBUG - BAT *is = BATintersectcand(old_s, bn); - if (is) { - assert(is->batCount == bn->batCount); - BBPreclaim(is); - } - assert(rev->batCount == old_s->batCount - bn->batCount); + BAT *is = BATintersectcand(old_s, bn); + if (is) { + assert(is->batCount == bn->batCount); + BBPreclaim(is); + } +
MonetDB: Dec2023 - use private lock (not global store lock) in o...
Changeset: 530559f07b47 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/530559f07b47 Modified Files: sql/storage/objectset.c Branch: Dec2023 Log Message: use private lock (not global store lock) in objectset diffs (51 lines): diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -55,6 +55,7 @@ typedef struct objectset { sql_allocator *sa; destroy_fptr destroy; MT_RWLock rw_lock; /*readers-writer lock to protect the links (chains) in the objectversion chain.*/ + MT_Lock lock; /* global objectset lock for os_add/del */ versionhead *name_based_h; versionhead *name_based_t; versionhead *id_based_h; @@ -668,6 +669,7 @@ os_new(sql_allocator *sa, destroy_fptr d }; os->destroy = destroy; MT_rwlock_init(&os->rw_lock, "sa_readers_lock"); + MT_lock_init(&os->lock, "single_writer_lock"); } return os; @@ -685,6 +687,7 @@ os_destroy(objectset *os, sql_store stor { if (ATOMIC_DEC(&os->refcnt) > 0) return; + MT_lock_destroy(&os->lock); MT_rwlock_destroy(&os->rw_lock); ATOMIC_DESTROY(&os->refcnt); versionhead* n=os->id_based_h; @@ -928,9 +931,9 @@ os_add_(objectset *os, struct sql_trans int os_add(objectset *os, struct sql_trans *tr, const char *name, sql_base *b) { - store_lock(tr->store); + MT_lock_set(&os->lock); int res = os_add_(os, tr, name, b); - store_unlock(tr->store); + MT_lock_unset(&os->lock); return res; } @@ -1031,9 +1034,9 @@ os_del_(objectset *os, struct sql_trans int os_del(objectset *os, struct sql_trans *tr, const char *name, sql_base *b) { - store_lock(tr->store); + MT_lock_set(&os->lock); int res = os_del_(os, tr, name, b); - store_unlock(tr->store); + MT_lock_unset(&os->lock); return res; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - get rid of duplicate definition
Changeset: 1b16c69fc345 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1b16c69fc345 Modified Files: sql/backends/monet5/sql_gencode.c sql/server/rel_dump.c sql/server/rel_dump.h sql/server/rel_schema.c Branch: check Log Message: get rid of duplicate definition diffs (133 lines): diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -316,36 +316,6 @@ static int return -1; } -static str -rel2str( mvc *sql, sql_rel *rel) -{ - buffer *b = NULL; - stream *s = NULL; - list *refs = NULL; - char *res = NULL; - - b = buffer_create(1024); - if(b == NULL) - goto cleanup; - s = buffer_wastream(b, "rel_dump"); - if(s == NULL) - goto cleanup; - refs = sa_list(sql->sa); - if (!refs) - goto cleanup; - - rel_print_refs(sql, s, rel, 0, refs, 0); - rel_print_(sql, s, rel, 0, refs, 0); - mnstr_printf(s, "\n"); - res = buffer_get_buf(b); - -cleanup: - if(b) - buffer_destroy(b); - if(s) - close_stream(s); - return res; -} /* stub and remote function */ static int diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -348,6 +348,38 @@ exp_print(mvc *sql, stream *fout, sql_ex mnstr_printf(fout, ", "); } + +str +rel2str( mvc *sql, sql_rel *rel) +{ + buffer *b = NULL; + stream *s = NULL; + list *refs = NULL; + char *res = NULL; + + b = buffer_create(1024); + if(b == NULL) + goto cleanup; + s = buffer_wastream(b, "rel_dump"); + if(s == NULL) + goto cleanup; + refs = sa_list(sql->sa); + if (!refs) + goto cleanup; + + rel_print_refs(sql, s, rel, 0, refs, 0); + rel_print_(sql, s, rel, 0, refs, 0); + mnstr_printf(s, "\n"); + res = buffer_get_buf(b); + +cleanup: + if(b) + buffer_destroy(b); + if(s) + close_stream(s); + return res; +} + static void exps_print(mvc *sql, stream *fout, list *exps, int depth, list *refs, int alias, int brackets, int decorate) { diff --git a/sql/server/rel_dump.h b/sql/server/rel_dump.h --- a/sql/server/rel_dump.h +++ b/sql/server/rel_dump.h @@ -19,6 +19,7 @@ extern void rel_print_(mvc *sql, stream *fout, sql_rel *rel, int depth, list *refs, int decorate); extern void rel_print_refs(mvc *sql, stream* fout, sql_rel *rel, int depth, list *refs, int decorate); +extern str rel2str( mvc *sql, sql_rel *rel); extern sql_rel *rel_read(mvc *sql, char *ra, int *pos, list *refs); extern void exp_print(mvc *sql, stream *fout, sql_exp *e, int depth, list *refs, int comma, int alias, int decorate); diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c --- a/sql/server/rel_schema.c +++ b/sql/server/rel_schema.c @@ -370,36 +370,6 @@ foreign_key_check_types(sql_subtype *lt, return lt->type->localtype == rt->type->localtype; return lt->type->eclass == rt->type->eclass || (EC_VARCHAR(lt->type->eclass) && EC_VARCHAR(rt->type->eclass)); } -static str -rel2str( mvc *sql, sql_rel *rel) -{ - buffer *b = NULL; - stream *s = NULL; - list *refs = NULL; - char *res = NULL; - - b = buffer_create(1024); - if(b == NULL) - goto cleanup; - s = buffer_wastream(b, "rel_dump"); - if(s == NULL) - goto cleanup; - refs = sa_list(sql->sa); - if (!refs) - goto cleanup; - - rel_print_refs(sql, s, rel, 0, refs, 0); - rel_print_(sql, s, rel, 0, refs, 0); - mnstr_printf(s, "\n"); - res = buffer_get_buf(b); - -cleanup: - if(b) - buffer_destroy(b); - if(s) - close_stream(s); - return res; -} static key_type token2key_type(int token) { ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - clean up memory management
Changeset: 5291548294ef for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5291548294ef Modified Files: sql/backends/monet5/sql_gencode.c sql/server/rel_dump.c Branch: check Log Message: clean up memory management diffs (53 lines): diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -330,7 +330,7 @@ static int node *n; int i, q, v, res = -1, added_to_cache = 0, *lret, *rret; size_t len = 1024, nr, pwlen = 0; - char *lname = NULL, *buf = NULL, *mal_session_uuid, *err = NULL, *pwhash = NULL; + char *lname = NULL, *rel_str, *buf = NULL, *mal_session_uuid, *err = NULL, *pwhash = NULL; str username = NULL, password = NULL, msg = NULL; sql_rel *r = rel; @@ -487,23 +487,21 @@ static int pushInstruction(curBlk, o); p = pushArgument(curBlk, p, getArg(o,0)); - if (!(buf = rel2str(m, rel))) { + if (!(rel_str = rel2str(m, rel))) { freeInstruction(p); sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL); goto cleanup; } o = newFcnCall(curBlk, remoteRef, putRef); if (o == NULL) { - free(buf); freeInstruction(p); sql_error(m, 10, SQLSTATE(HY013) MAL_MALLOC_FAIL); goto cleanup; } o = pushArgument(curBlk, o, q); - o = pushStr(curBlk, o, buf);/* relational plan */ + o = pushStr(curBlk, o, rel_str);/* relational plan */ pushInstruction(curBlk, o); p = pushArgument(curBlk, p, getArg(o,0)); - free(buf); if (!(buf = sa_alloc(m->ta, len))) { freeInstruction(p); diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -377,7 +377,10 @@ cleanup: buffer_destroy(b); if(s) close_stream(s); - return res; + + char* fres = SA_STRDUP(sql->sa, res); + free (res); + return fres; } static void ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - add upgrade code for additional key types
Changeset: 102f4929b4fd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/102f4929b4fd Modified Files: sql/backends/monet5/sql_upgrades.c Branch: check Log Message: add upgrade code for additional key types diffs (31 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -7096,6 +7096,27 @@ sql_update_default(Client c, mvc *sql, s sa_destroy(sql->sa); } sql->sa = old_sa; + + if (err) + return err; + sql_table *t; + if ((t = mvc_bind_table(sql, s, "key_types")) != NULL) + t->system = 0; + err = SQLstatementIntern(c, + "DROP TABLE sys.key_types;\n" + "CREATE TABLE sys.key_types (\n" + " key_type_id SMALLINT NOT NULL PRIMARY KEY,\n" + " key_type_name VARCHAR(35) NOT NULL UNIQUE);\n" + "INSERT INTO sys.key_types VALUES\n" + "(0, 'Primary Key'),\n" + "(1, 'Unique Key'),\n" + "(2, 'Foreign Key'),\n" + "(3, 'Unique Key With Nulls Not Distinct'),\n" + "(4, 'Check Constraint');\n" + "ALTER TABLE sys.key_types SET READ ONLY;\n" + "GRANT SELECT ON sys.key_types TO PUBLIC;\n" + "UPDATE sys._tables SET system = true WHERE schema_id = 2000 AND name = 'key_types';\n" + , "update", true, false, NULL); return err; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: check - approve new upgrade test output
Changeset: 03c22628f0d1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/03c22628f0d1 Modified Files: sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 Branch: check Log Message: approve new upgrade test output diffs (96 lines): diff --git a/sql/test/emptydb/Tests/check.stable.out b/sql/test/emptydb/Tests/check.stable.out --- a/sql/test/emptydb/Tests/check.stable.out +++ b/sql/test/emptydb/Tests/check.stable.out @@ -1352,7 +1352,7 @@ select 'null in fkeys.delete_action', de [ "sys._columns", "sys", "index_types", "index_type_id", "smallint", 15, 0, NULL, false, 0, NULL, NULL] [ "sys._columns", "sys", "index_types", "index_type_name", "varchar", 25, 0, NULL, false, 1, NULL, NULL] [ "sys._columns", "sys", "key_types","key_type_id", "smallint", 15, 0, NULL, false, 0, NULL, NULL] -[ "sys._columns", "sys", "key_types","key_type_name", "varchar", 15, 0, NULL, false, 1, NULL, NULL] +[ "sys._columns", "sys", "key_types","key_type_name", "varchar", 35, 0, NULL, false, 1, NULL, NULL] [ "sys._columns", "sys", "keys", "id", "int", 31, 0, NULL, true, 0, NULL, NULL] [ "sys._columns", "sys", "keys", "table_id", "int", 31, 0, NULL, true, 1, NULL, NULL] [ "sys._columns", "sys", "keys", "type", "int", 31, 0, NULL, true, 2, NULL, NULL] @@ -1660,6 +1660,7 @@ select 'null in fkeys.delete_action', de [ "sys._columns", "tmp", "keys", "name", "varchar", 1024, 0, NULL, true, 3, NULL, NULL] [ "sys._columns", "tmp", "keys", "rkey", "int", 31, 0, NULL, true, 4, NULL, NULL] [ "sys._columns", "tmp", "keys", "action", "int", 31, 0, NULL, true, 5, NULL, NULL] +[ "sys._columns", "tmp", "keys", "check","varchar", 2048, 0, NULL, true, 6, NULL, NULL] [ "sys._columns", "tmp", "objects", "id", "int", 31, 0, NULL, true, 0, NULL, NULL] [ "sys._columns", "tmp", "objects", "name", "varchar", 1024, 0, NULL, true, 1, NULL, NULL] [ "sys._columns", "tmp", "objects", "nr", "int", 31, 0, NULL, true, 2, NULL, NULL] @@ -5444,9 +5445,11 @@ select 'null in fkeys.delete_action', de % %1, key_type_name # name % varchar, varchar # type % 13, 11 # length +[ "sys.key_types", "Check Constraint" ] [ "sys.key_types", "Foreign Key" ] [ "sys.key_types", "Primary Key" ] [ "sys.key_types", "Unique Key"] +[ "sys.key_types", "Unique Key With Nulls Not Distinct"] % .%1, .index_types # table_name % %1, index_type_name # name % varchar, varchar # type diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit b/sql/test/emptydb/Tests/check.stable.out.32bit --- a/sql/test/emptydb/Tests/check.stable.out.32bit +++ b/sql/test/emptydb/Tests/check.stable.out.32bit @@ -1352,7 +1352,7 @@ select 'null in fkeys.delete_action', de [ "sys._columns", "sys", "index_types", "index_type_id", "smallint", 15, 0, NULL, false, 0, NULL, NULL] [ "sys._columns", "sys", "index_types", "index_type_name", "varchar", 25, 0, NULL, false, 1, NULL, NULL] [ "sys._columns", "sys", "key_types","key_type_id", "smallint", 15, 0, NULL, false, 0, NULL, NULL] -[ "sys._columns", "sys", "key_types","key_type_name", "varchar", 15, 0, NULL, false, 1, NULL, NULL] +[ "sys._columns", "sys", "key_types","key_type_name", "varchar", 35, 0, NULL, false, 1, NULL, NULL] [ "sys._columns", "sys", "keys", "id", "int", 31, 0, NULL, true, 0, NULL, NULL] [ "sys._columns", "sys", "keys", "table_id", "int", 31, 0, NULL, true, 1, NULL, NULL] [ "sys._columns", "sys", "keys", "type", "int", 31, 0, NULL, true, 2, NULL, NULL] @@ -1660,6 +1660,7 @@ select 'null in fkeys.delete_action', de [ "sys._columns", "tmp", "keys", "name", "varchar", 1024, 0, NULL, true, 3, NULL, NULL] [ "sys._columns", "tmp", "keys", "rkey", "int", 31, 0, NULL, true, 4, NULL, NULL] [ "sys._columns", "tmp", "keys", "action", "int", 31, 0, NULL, true, 5, NULL, NULL] +[ "sys._columns", "tmp", "keys", "check","varchar", 2048, 0, NULL, true, 6, NULL, NULL
MonetDB: label - create label branch, ie better expression uniques
Changeset: 4424f1801849 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4424f1801849 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/rel_physical.c sql/backends/monet5/sql.c sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/backends/monet5/vaults/csv/csv.c sql/include/sql_relation.h sql/server/rel_basetable.c sql/server/rel_basetable.h sql/server/rel_dump.c sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_optimize_exps.c sql/server/rel_optimize_others.c sql/server/rel_optimize_proj.c sql/server/rel_optimize_sel.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_psm.c sql/server/rel_rel.c sql/server/rel_rel.h sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_semantic.c sql/server/rel_statistics.c sql/server/rel_unnest.c sql/server/rel_updates.c sql/server/sql_mvc.c sql/server/sql_mvc.h sql/test/BugTracker-2023/Tests/misc-crashes-7390.test sql/test/BugTracker-2024/Tests/atom_cmp-Bug-7477.test Branch: label Log Message: create label branch, ie better expression uniques diffs (truncated from 3922 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 @@ -246,6 +246,28 @@ bin_find_column(backend *be, stmt *sub, return list_find_column(be, sub->op4.lval, rname, name); } +static stmt * +list_find_column_nid(backend *be, list *l, int label) +{ + (void)be; + if (!l) + return NULL; + for (node *n = l->h; n; n = n->next) { + stmt *s = n->data; + + if (s->label == label) + return s; + } + return NULL; +} + +static stmt * +bin_find_column_nid(backend *be, stmt *sub, int label) +{ + list *l = sub->op4.lval; + return list_find_column_nid(be, l, label); +} + static list * bin_find_columns(backend *be, stmt *sub, const char *name) { @@ -354,11 +376,13 @@ row2cols(backend *be, stmt *sub) for (n = sub->op4.lval->h; n; n = n->next) { stmt *sc = n->data; + assert(sc->type == st_alias); const char *cname = column_name(be->mvc->sa, sc); const char *tname = table_name(be->mvc->sa, sc); + int label = sc->label; sc = column(be, sc); - list_append(l, stmt_alias(be, sc, tname, cname)); + list_append(l, stmt_alias(be, sc, label, tname, cname)); } sub = stmt_list(be, l); } @@ -428,14 +452,16 @@ subrel_project(backend *be, stmt *s, lis if (c->type != st_alias) { c = stmt_project(be, cand, c); } else if (c->op1->type == st_mirror && is_tid_chain(cand)) { /* alias with mirror (ie full row ids) */ - c = stmt_alias(be, cand, c->tname, c->cname); + //c = stmt_alias(be, cand, 0, c->tname, c->cname); + c = stmt_as(be, cand, c); } else { /* st_alias */ stmt *s = c->op1; if (s->nrcols == 0) s = stmt_const(be, cand, s); else s = stmt_project(be, cand, s); - c = stmt_alias(be, s, c->tname, c->cname); + //c = stmt_alias(be, s, c->flag, c->tname, c->cname); + c = stmt_as(be, s, c); } append(l, c); } @@ -1728,9 +1754,11 @@ exp_bin(backend *be, sql_exp *e, stmt *l } break; case e_column: { if (right) /* check relation names */ - s = bin_find_column(be, right, e->l, e->r); + //s = bin_find_column(be, right, e->l, e->r); + s = bin_find_column_nid(be, right, e->nid); if (!s && left) - s = bin_find_column(be, left, e->l, e->r); + //s = bin_find_column(be, left, e->l, e->r); + s = bin_find_column_nid(be, left, e->nid); if (s && grp) s = stmt_project(be, ext, s); if (!s && right) { @@ -2080,7 +2108,7 @@ rel2bin_sql_table(backend *be, sql_table const char *rnme = t->base.name; stmt *sc = dels?dels:stmt_tid(be, t, 0); - sc = stmt_alias(be, sc, rnme, TID); +
MonetDB: balanced_union - Prune munion members only if it's not ref
Changeset: 9fe2224d5195 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9fe2224d5195 Modified Files: sql/server/rel_statistics.c Branch: balanced_union Log Message: Prune munion members only if it's not ref diffs (12 lines): diff --git a/sql/server/rel_statistics.c b/sql/server/rel_statistics.c --- a/sql/server/rel_statistics.c +++ b/sql/server/rel_statistics.c @@ -893,7 +893,7 @@ rel_get_statistics_(visitor *v, sql_rel for (node *n = rel->exps->h ; n ; n = n->next, i++) rel_munion_get_statistics(v->sql, rel, nrels, n->data, i); - if (needs_pruning) { + if (needs_pruning && !rel_is_ref(rel)) { v->changes++; list *nl = sa_list(l->sa); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: label - only reference when needed.
Changeset: 259e84e5ed08 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/259e84e5ed08 Modified Files: sql/server/rel_exp.c sql/server/rel_optimize_proj.c sql/server/rel_optimize_sel.c sql/server/rel_select.c Branch: label Log Message: only reference when needed. diffs (75 lines): diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -807,13 +807,13 @@ exp_ref(mvc *sql, sql_exp *e) sql_exp * exp_ref_save(mvc *sql, sql_exp *e) { + if (e->type == e_column) + return e; if (is_atom(e->type)) return exp_copy(sql, e); - if (!exp_name(e) || is_convert(e->type)) + if (!e->alias.label || !exp_name(e)) exp_label(sql->sa, e, ++sql->label); - if (!e->alias.label) - exp_label(sql->sa, e, ++sql->label); - if (e->type != e_column) + if (e->type != e_column) /* ref as referenced within the (same) rank expression */ e->ref = 1; sql_exp *ne = exp_ref(sql, e); if (ne && is_freevar(e)) diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c --- a/sql/server/rel_optimize_proj.c +++ b/sql/server/rel_optimize_proj.c @@ -1590,7 +1590,7 @@ rel_simplify_sum(visitor *v, sql_rel *re /* a column reference can be prepended to the inner relation, add it after all the check type calls succeed */ if (prepend) - list_prepend(l->exps, exp_ref(v->sql, col)); + list_prepend(l->exps, col); /* the new generate function calls are valid, update relations */ /* we need a new relation for the multiplication and addition/subtraction */ diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c --- a/sql/server/rel_optimize_sel.c +++ b/sql/server/rel_optimize_sel.c @@ -1992,6 +1992,8 @@ find_fk( mvc *sql, list *rels, list *exp i = rel_find_column(sql, orr, l->l, iname); if (!t || !i) continue; + t->p = NULL; + i->p = NULL; je = exp_compare(sql->sa, i, t, cmp_equal); } else { sql_exp *s = je->r, *l = je->l; @@ -2000,6 +2002,8 @@ find_fk( mvc *sql, list *rels, list *exp i = rel_find_column(sql, olr, l->l, iname); if (!t || !i) continue; + t->p = NULL; + i->p = NULL; je = exp_compare(sql->sa, i, t, cmp_equal); } diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -1421,6 +1421,8 @@ rel_column_ref(sql_query *query, sql_rel else exp->card = CARD_ATOM; set_freevar(exp, i); + if (exp->alias.label == exp->nid) + exp->alias.label = -(sql->nid++); if (!is_sql_where(of) && !is_sql_aggr(of) && !is_sql_aggr(f) && !outer->grouped) set_outer(outer); } @@ -1517,6 +1519,8 @@ rel_column_ref(sql_query *query, sql_rel else exp->card = CARD_ATOM; set_freevar(exp, i); + if (exp->alias.label == exp->nid) + exp->alias.label = -(sql->nid++); if (!is_sql_where(of) && !is_sql_aggr(of) && !is_sql_aggr(f) && !outer->grouped) set_outer(outer); } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: label - we allow for table input on table functions
Changeset: a09880ee994f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a09880ee994f Modified Files: sql/server/rel_select.c Branch: label Log Message: we allow for table input on table functions diffs (12 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -735,6 +735,8 @@ rel_named_table_function(sql_query *quer exp_label(sql->sa, e, ++sql->label); //append(exps, e=exp_alias_or_copy(sql, tname, exp_name(e), NULL, e)); sql_exp *ne = exp_ref(sql, e); + /* allow for table functions with table input */ + ne->card = CARD_ATOM; exp_setname(sql, ne, tname, exp_name(e)); append(exps, ne); append(tl, exp_subtype(e)); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: odbc-tls - Improve windows setup dialog.
Changeset: fd0d15e466d2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/fd0d15e466d2 Modified Files: clients/odbc/winsetup/resource.h clients/odbc/winsetup/setup.c clients/odbc/winsetup/setup.rc Branch: odbc-tls Log Message: Improve windows setup dialog. diffs (276 lines): diff --git a/clients/odbc/winsetup/resource.h b/clients/odbc/winsetup/resource.h --- a/clients/odbc/winsetup/resource.h +++ b/clients/odbc/winsetup/resource.h @@ -40,7 +40,9 @@ #define IDC_EDIT_CLIENTKEY 2024 #define IDC_EDIT_CLIENTCERT 2025 -#define IDC_BUTTON_CANCEL 2031 +//#define IDC_BUTTON_CANCEL 2031 +#define IDC_BUTTON_TEST 2031 +#define IDC_BUTTON_HELP 2032 // Next default values for new objects // diff --git a/clients/odbc/winsetup/setup.c b/clients/odbc/winsetup/setup.c --- a/clients/odbc/winsetup/setup.c +++ b/clients/odbc/winsetup/setup.c @@ -328,44 +328,44 @@ ConfigDSN(HWND parent, WORD request, LPC return FALSE; } value++; - if (strncasecmp("dsn=", attributes, value - attributes) == 0) { + if (strncasecmp("DSN=", attributes, value - attributes) == 0) { dsn = value; data.dsn = strdup(value); - } else if (strncasecmp("description=", attributes, value - attributes) == 0) + } else if (strncasecmp("Description=", attributes, value - attributes) == 0) data.desc = strdup(value); - else if (strncasecmp("uid=", attributes, value - attributes) == 0) + else if (strncasecmp("UID=", attributes, value - attributes) == 0) data.uid = strdup(value); - else if (strncasecmp("pwd=", attributes, value - attributes) == 0) + else if (strncasecmp("PWD=", attributes, value - attributes) == 0) data.pwd = strdup(value); - else if (strncasecmp("host=", attributes, value - attributes) == 0) + else if (strncasecmp("Host=", attributes, value - attributes) == 0) data.host = strdup(value); - else if (strncasecmp("port=", attributes, value - attributes) == 0) + else if (strncasecmp("Port=", attributes, value - attributes) == 0) data.port = strdup(value); - else if (strncasecmp("database=", attributes, value - attributes) == 0) + else if (strncasecmp("Database=", attributes, value - attributes) == 0) data.database = strdup(value); - else if (strncasecmp("schema=", attributes, value - attributes) == 0) + else if (strncasecmp("Schema=", attributes, value - attributes) == 0) data.schema = strdup(value); - else if (strncasecmp("logintimeout=", attributes, value - attributes) == 0) + else if (strncasecmp("LoginTimeout=", attributes, value - attributes) == 0) data.logintimeout = strdup(value); - else if (strncasecmp("replytimeout=", attributes, value - attributes) == 0) + else if (strncasecmp("ReplyTimeout=", attributes, value - attributes) == 0) data.replytimeout = strdup(value); - else if (strncasecmp("replysize=", attributes, value - attributes) == 0) + else if (strncasecmp("ReplySize=", attributes, value - attributes) == 0) data.replysize = strdup(value); - else if (strncasecmp("autocommit=", attributes, value - attributes) == 0) + else if (strncasecmp("AutoCommit=", attributes, value - attributes) == 0) data.autocommit = strdup(value); - else if (strncasecmp("timezone=", attributes, value - attributes) == 0) + else if (strncasecmp("TimeZone=", attributes, value - attributes) == 0) data.timezone = strdup(value); - else if (strncasecmp("logfile=", attributes, value - attributes) == 0) + else if (strncasecmp("LogFile=", attributes, value - attributes) == 0) data.logfile = strdup(value); - else if (strncasecmp("tls=", attributes, value - attributes) == 0) + else if (strncasecmp("TLS=", attributes, value - attributes) == 0) data.use_tls = strdup(value); - else if (strncasecmp("cert=", attributes, value - attributes) == 0) + else if (strncasecmp("Cert=", attributes, value - attributes) == 0) data.servercert = strdup(value); - else if (strncasecmp("certhash=", attributes, value - attributes) == 0) + else if (strncasecmp("CertHash=", attributes, value - attributes) == 0)
MonetDB: odbc-tls - During install, make sure the default create...
Changeset: 2b8e844a0608 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2b8e844a0608 Modified Files: clients/odbc/winsetup/install.c Branch: odbc-tls Log Message: During install, make sure the default created Sytem DSN has set the mandatory attrs: AutoCommit and TLS to the correct default values. diffs (23 lines): diff --git a/clients/odbc/winsetup/install.c b/clients/odbc/winsetup/install.c --- a/clients/odbc/winsetup/install.c +++ b/clients/odbc/winsetup/install.c @@ -166,7 +166,7 @@ static void CreateAttributeString(char *attrs, size_t len, const char *dsn) { snprintf(attrs, len, - "DSN=%s;Server=localhost;Database=;UID=monetdb;PWD=monetdb;Logfile=;", + "DSN=%s;Server=localhost;Database=;UID=monetdb;PWD=monetdb;AutoCommit=on;TLS=off;", dsn); for (; *attrs; attrs++) @@ -230,9 +230,8 @@ Install(const char *driverpath, const ch } rc = InstallMyDriver(driverpath, drivername); - if (rc) { - /* after the driver is installed create the new DSN */ + /* after the driver is installed create the new System DSN */ rc = AddMyDSN(dsn, drivername); } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org