MonetDB: default - Reverted some changes
Changeset: 06ddd1f8412e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=06ddd1f8412e Modified Files: sql/server/rel_schema.c sql/server/sql_parser.y Branch: default Log Message: Reverted some changes diffs (60 lines): 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 @@ -409,16 +409,17 @@ column_option( if (e && is_atom(e->type)) { atom *a = exp_value(sql, e, sql->args, sql->argc); - if(!atom_cast(sql->sa, a, &cs->type)) { - (void) sql_error(sql, 02, "42000!could not cast the default value to the column type\n"); - return SQL_ERR; + if (atom_null(a)) { + mvc_default(sql, cs, NULL); + res = SQL_OK; + break; } } /* reset error */ sql->session->status = 0; sql->errstr[0] = '\0'; } - r = symbol2string(sql, s->data.sym, &err); + r = symbol2string(sql, s->data.sym, &err); if (!r) { (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); @@ -737,22 +738,11 @@ table_element(mvc *sql, symbol *s, sql_s char *cname = l->h->data.sval; symbol *sym = l->h->next->data.sym; sql_column *c = mvc_bind_column(sql, t, cname); - sql_exp *e = NULL; if (!c) { sql_error(sql, 02, "42S22!ALTER TABLE: no such column '%s'\n", cname); return SQL_ERR; } - e = rel_logical_value_exp(sql, NULL, sym, sql_sel); - - if (e && is_atom(e->type)) { - atom *a = exp_value(sql, e, sql->args, sql->argc); - - if(!atom_cast(sql->sa, a, &c->type)) { - (void) sql_error(sql, 02, "42S22!ALTER TABLE: could not cast the default value to the column type\n"); - return SQL_ERR; - } - } r = symbol2string(sql, sym, &err); if (!r) { (void) sql_error(sql, 02, "42S22!ALTER TABLE: incorrect default value '%s'\n", err?err:""); diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -1550,7 +1550,7 @@ default: ; default_value: -atom { $$ = $1; } +simple_scalar_exp { $$ = $1; } ; column_constraint: ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: default - Merge with Jul2017 branch.
Changeset: 296b342f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=296b342f Modified Files: gdk/gdk_hash.c gdk/gdk_imprints.c sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql sql/test/BugTracker-2012/Tests/aggregate_vs_positional_column_crash.Bug-3085.sql sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.sql sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out sql/test/BugTracker-2014/Tests/select-having.Bug-3458.sql sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.sql sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.stable.out sql/test/bugs/Tests/crash_order_by.sql sql/test/bugs/Tests/simple_view.sql sql/test/bugs/insert_delete-bug-sf-904025.sql Branch: default Log Message: Merge with Jul2017 branch. diffs (truncated from 337 to 300 lines): diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -202,17 +202,16 @@ BATcheckhash(BAT *b) Hash *h; Heap *hp; const char *nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "thash" : "hhash"; int fd; b->thash = NULL; if ((hp = GDKzalloc(sizeof(*hp))) != NULL && (hp->farmid = BBPselectfarm(b->batRole, b->ttype, hashheap)) >= 0 && (hp->filename = GDKmalloc(strlen(nme) + 12)) != NULL) { - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.thash", nme); /* check whether a persisted hash can be found */ - if ((fd = GDKfdlocate(hp->farmid, nme, "rb+", ext)) >= 0) { + if ((fd = GDKfdlocate(hp->farmid, nme, "rb+", "thash")) >= 0) { size_t hdata[HASH_HEADER_SIZE]; struct stat st; @@ -226,7 +225,7 @@ BATcheckhash(BAT *b) hdata[4] == (size_t) BATcount(b) && fstat(fd, &st) == 0 && st.st_size >= (off_t) (hp->size = hp->free = (hdata[1] + hdata[2]) * hdata[3] + HASH_HEADER_SIZE * SIZEOF_SIZE_T) && - HEAPload(hp, nme, ext, 0) == GDK_SUCCEED) { + HEAPload(hp, nme, "thash", 0) == GDK_SUCCEED) { h->lim = (BUN) hdata[1]; h->type = ATOMtype(b->ttype); h->mask = (BUN) (hdata[2] - 1); @@ -260,7 +259,7 @@ BATcheckhash(BAT *b) GDKfree(h); close(fd); /* unlink unusable file */ - GDKunlink(hp->farmid, BATDIR, nme, ext); + GDKunlink(hp->farmid, BATDIR, nme, "thash"); } GDKfree(hp->filename); } @@ -338,7 +337,6 @@ BAThash(BAT *b, BUN masksize) Hash *h = NULL; Heap *hp; const char *nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "thash" : "hhash"; BATiter bi = bat_iterator(b); ALGODEBUG fprintf(stderr, "#BAThash: create hash(%s#" BUNFMT ");\n", BATgetId(b), BATcount(b)); @@ -350,7 +348,7 @@ BAThash(BAT *b, BUN masksize) return GDK_FAIL; } hp->dirty = TRUE; - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.thash", nme); /* cnt = 0, hopefully there is a proper capacity from * which we can derive enough information */ diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -208,7 +208,6 @@ BATcheckimprints(BAT *b) Imprints *imprints; Heap *hp; str nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "timprints" : "himprints"; b->timprints = NULL; if ((hp = GDKzalloc(sizeof(Heap))) != NULL && @@ -216,10 +215,10 @@ BATcheckimprints(BAT *b) (hp->filename = GDKmalloc(strlen(nme) + 12)) != NULL) { int fd; - sprintf(hp->filename, "%s.%s", nme, ext); +
MonetDB: Jul2017 - Merge with Dec2016 branch.
Changeset: 806358d956a4 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=806358d956a4 Modified Files: gdk/gdk_hash.c gdk/gdk_imprints.c sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql sql/test/BugTracker-2012/Tests/aggregate_vs_positional_column_crash.Bug-3085.sql sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.sql sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out sql/test/BugTracker-2014/Tests/select-having.Bug-3458.sql sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.sql sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.stable.out sql/test/bugs/Tests/crash_order_by.sql sql/test/bugs/Tests/simple_view.sql sql/test/bugs/insert_delete-bug-sf-904025.sql Branch: Jul2017 Log Message: Merge with Dec2016 branch. diffs (truncated from 337 to 300 lines): diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -202,17 +202,16 @@ BATcheckhash(BAT *b) Hash *h; Heap *hp; const char *nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "thash" : "hhash"; int fd; b->thash = NULL; if ((hp = GDKzalloc(sizeof(*hp))) != NULL && (hp->farmid = BBPselectfarm(b->batRole, b->ttype, hashheap)) >= 0 && (hp->filename = GDKmalloc(strlen(nme) + 12)) != NULL) { - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.thash", nme); /* check whether a persisted hash can be found */ - if ((fd = GDKfdlocate(hp->farmid, nme, "rb+", ext)) >= 0) { + if ((fd = GDKfdlocate(hp->farmid, nme, "rb+", "thash")) >= 0) { size_t hdata[HASH_HEADER_SIZE]; struct stat st; @@ -226,7 +225,7 @@ BATcheckhash(BAT *b) hdata[4] == (size_t) BATcount(b) && fstat(fd, &st) == 0 && st.st_size >= (off_t) (hp->size = hp->free = (hdata[1] + hdata[2]) * hdata[3] + HASH_HEADER_SIZE * SIZEOF_SIZE_T) && - HEAPload(hp, nme, ext, 0) == GDK_SUCCEED) { + HEAPload(hp, nme, "thash", 0) == GDK_SUCCEED) { h->lim = (BUN) hdata[1]; h->type = ATOMtype(b->ttype); h->mask = (BUN) (hdata[2] - 1); @@ -260,7 +259,7 @@ BATcheckhash(BAT *b) GDKfree(h); close(fd); /* unlink unusable file */ - GDKunlink(hp->farmid, BATDIR, nme, ext); + GDKunlink(hp->farmid, BATDIR, nme, "thash"); } GDKfree(hp->filename); } @@ -338,7 +337,6 @@ BAThash(BAT *b, BUN masksize) Hash *h = NULL; Heap *hp; const char *nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "thash" : "hhash"; BATiter bi = bat_iterator(b); ALGODEBUG fprintf(stderr, "#BAThash: create hash(%s#" BUNFMT ");\n", BATgetId(b), BATcount(b)); @@ -350,7 +348,7 @@ BAThash(BAT *b, BUN masksize) return GDK_FAIL; } hp->dirty = TRUE; - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.thash", nme); /* cnt = 0, hopefully there is a proper capacity from * which we can derive enough information */ diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -208,7 +208,6 @@ BATcheckimprints(BAT *b) Imprints *imprints; Heap *hp; str nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "timprints" : "himprints"; b->timprints = NULL; if ((hp = GDKzalloc(sizeof(Heap))) != NULL && @@ -216,10 +215,10 @@ BATcheckimprints(BAT *b) (hp->filename = GDKmalloc(strlen(nme) + 12)) != NULL) { int fd; - sprintf(hp->filename, "%s.%s", nme, ext); +
MonetDB: Dec2016 - Fix tests: a quote character cannot occur by ...
Changeset: fcc49f6b24f6 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fcc49f6b24f6 Modified Files: sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql sql/test/BugTracker-2012/Tests/aggregate_vs_positional_column_crash.Bug-3085.sql sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.sql sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.stable.out sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out sql/test/BugTracker-2014/Tests/select-having.Bug-3458.sql sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.sql sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.stable.out sql/test/bugs/Tests/crash_order_by.sql sql/test/bugs/Tests/simple_view.sql sql/test/bugs/insert_delete-bug-sf-904025.sql Branch: Dec2016 Log Message: Fix tests: a quote character cannot occur by itself in a CSV file. diffs (173 lines): diff --git a/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql b/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql --- a/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql +++ b/sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql @@ -47,7 +47,7 @@ 5717 "queue" 2000"create view sys.queue 6368 "storage" 2000"create view sys.storage as select * from sys.storage();" 1 true0 false 0 6380 "storagemodelinput" 2000NULL0 true0 false 0 6428 "storagemodel" 2000"create view sys.storagemodel as select * from sys.storagemodel();" 1 true0 false 0 -6438 "tablestoragemodel" 2000"-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum("imprints") as "imprints",\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() group by ""schema"",""table"";" 1 true0 false 0 +6438 "tablestoragemodel" 2000"-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum(""imprints"") as ""imprints"",\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() group by ""schema"",""table"";" 1 true0 false 0 6453 "statistics"2000NULL0 true0 false 0 6616 "systemfunctions" 2000NULL0 true0 false 0 diff --git a/sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql b/sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql --- a/sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql +++ b/sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql @@ -47,7 +47,7 @@ 5717 "queue" 2000"create view sys.queue 6368 "storage" 2000"create view sys.storage as select * from sys.storage();" 1 true0 false 0 6380 "storagemodelinput" 2000NULL0 true0 false 0 6428 "storagemodel" 2000"create view sys.storagemodel as select * from sys.storagemodel();" 1 true0 false 0 -6438 "tablestoragemodel" 2000"-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum("imprints") as "imprints",\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() group by ""schema"",""table"";" 1 true0 false 0 +6438 "tablestoragemodel" 2000"-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n
MonetDB: Dec2016 - Fix test: a quote character cannot occur by i...
Changeset: 23fdff11e9d7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=23fdff11e9d7 Modified Files: sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out Branch: Dec2016 Log Message: Fix test: a quote character cannot occur by itself in a CSV file. diffs (33 lines): diff --git a/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql b/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql --- a/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql +++ b/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql @@ -47,7 +47,7 @@ 5717 "queue" 2000"create view sys.queue 6368 "storage" 2000"create view sys.storage as select * from sys.storage();" 1 true0 false 0 6380 "storagemodelinput" 2000NULL0 true0 false 0 6428 "storagemodel" 2000"create view sys.storagemodel as select * from sys.storagemodel();" 1 true0 false 0 -6438 "tablestoragemodel" 2000"-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum("imprints") as "imprints",\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() group by ""schema"",""table"";" 1 true0 false 0 +6438 "tablestoragemodel" 2000"-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select ""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum(""imprints"") as ""imprints"",\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() group by ""schema"",""table"";" 1 true0 false 0 6453 "statistics"2000NULL0 true0 false 0 6616 "systemfunctions" 2000NULL0 true0 false 0 diff --git a/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out b/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out --- a/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out +++ b/sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out @@ -51,7 +51,7 @@ Ready. % sys.tbls,sys.tbls, sys.tbls, sys.tbls, sys.tbls, sys.tbls, sys.tbls, sys.tbls # table_name % name,schema_id, query, type, system, commit_action, readonly, temporary # name % varchar, int,varchar,smallint, boolean, smallint, boolean,smallint # type -% 17, 4, 379,1, 5, 1, 5, 1 # length +% 17, 4, 526,1, 5, 1, 5, 1 # length [ "schemas", 2000, NULL, 0, true, 0, false, 0 ] [ "types", 2000, NULL, 0, true, 0, false, 0 ] [ "functions", 2000, NULL, 0, true, 0, false, 0 ] @@ -89,7 +89,7 @@ Ready. [ "storage", 2000, "create view sys.storage as select * from sys.storage();", 1, true, 0, false, 0 ] [ "storagemodelinput", 2000, NULL, 0, true, 0, false, 0 ] [ "storagemodel", 2000, "create view sys.storagemodel as select * from sys.storagemodel();",1, true, 0, false, 0 ] -[ "tablestoragemodel", 2000, "-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select \"schema\",\"table\",max(count) as \"count\",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum(", 1, true, 0, false, 0 ] +[ "tablestoragemodel", 2000, "-- A summary of the table storage requirement is is available as a table view.\n-- The auxiliary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select \"schema\",\"table\",max(count) as \"count\",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as hashes,\n\tsum(\"imprints\") as \"imprints\",\n\tsum(case when sorted = false then 8 * count else 0 end) as auxiliary\nfrom sys.storagemodel() gr
MonetDB: Dec2016 - Removed some leftovers from the pre-headless ...
Changeset: aab25b035755 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aab25b035755 Modified Files: gdk/gdk_hash.c gdk/gdk_imprints.c Branch: Dec2016 Log Message: Removed some leftovers from the pre-headless age. diffs (140 lines): diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c --- a/gdk/gdk_hash.c +++ b/gdk/gdk_hash.c @@ -202,17 +202,16 @@ BATcheckhash(BAT *b) Hash *h; Heap *hp; const char *nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "thash" : "hhash"; int fd; b->thash = NULL; if ((hp = GDKzalloc(sizeof(*hp))) != NULL && (hp->farmid = BBPselectfarm(b->batRole, b->ttype, hashheap)) >= 0 && (hp->filename = GDKmalloc(strlen(nme) + 12)) != NULL) { - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.thash", nme); /* check whether a persisted hash can be found */ - if ((fd = GDKfdlocate(hp->farmid, nme, "rb+", ext)) >= 0) { + if ((fd = GDKfdlocate(hp->farmid, nme, "rb+", "thash")) >= 0) { size_t hdata[HASH_HEADER_SIZE]; struct stat st; @@ -226,7 +225,7 @@ BATcheckhash(BAT *b) hdata[4] == (size_t) BATcount(b) && fstat(fd, &st) == 0 && st.st_size >= (off_t) (hp->size = hp->free = (hdata[1] + hdata[2]) * hdata[3] + HASH_HEADER_SIZE * SIZEOF_SIZE_T) && - HEAPload(hp, nme, ext, 0) == GDK_SUCCEED) { + HEAPload(hp, nme, "thash", 0) == GDK_SUCCEED) { h->lim = (BUN) hdata[1]; h->type = ATOMtype(b->ttype); h->mask = (BUN) (hdata[2] - 1); @@ -260,7 +259,7 @@ BATcheckhash(BAT *b) GDKfree(h); close(fd); /* unlink unusable file */ - GDKunlink(hp->farmid, BATDIR, nme, ext); + GDKunlink(hp->farmid, BATDIR, nme, "thash"); } GDKfree(hp->filename); } @@ -338,7 +337,6 @@ BAThash(BAT *b, BUN masksize) Hash *h = NULL; Heap *hp; const char *nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "thash" : "hhash"; BATiter bi = bat_iterator(b); ALGODEBUG fprintf(stderr, "#BAThash: create hash(%s#" BUNFMT ");\n", BATgetId(b), BATcount(b)); @@ -350,7 +348,7 @@ BAThash(BAT *b, BUN masksize) return GDK_FAIL; } hp->dirty = TRUE; - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.thash", nme); /* cnt = 0, hopefully there is a proper capacity from * which we can derive enough information */ @@ -581,7 +579,7 @@ HASHdestroy(BAT *b) GDKunlink(BBPselectfarm(b->batRole, b->ttype, hashheap), BATDIR, BBP_physical(b->batCacheid), - b->batCacheid > 0 ? "thash" : "hhash"); + "thash"); } else if (b->thash) { bat p = VIEWtparent(b); BAT *hp = NULL; diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c --- a/gdk/gdk_imprints.c +++ b/gdk/gdk_imprints.c @@ -208,7 +208,6 @@ BATcheckimprints(BAT *b) Imprints *imprints; Heap *hp; str nme = BBP_physical(b->batCacheid); - const char *ext = b->batCacheid > 0 ? "timprints" : "himprints"; b->timprints = NULL; if ((hp = GDKzalloc(sizeof(Heap))) != NULL && @@ -216,10 +215,10 @@ BATcheckimprints(BAT *b) (hp->filename = GDKmalloc(strlen(nme) + 12)) != NULL) { int fd; - sprintf(hp->filename, "%s.%s", nme, ext); + sprintf(hp->filename, "%s.timprints", nme); /* check whether a persisted imprints index * can be found */ - if ((fd = GDKfdlocate(hp->farmid, nme, "rb", ext)) >= 0) { + if ((fd = GDKfdlocate(hp->farmid, nme, "rb", "timprints")) >= 0) { size_t hdata[4]; struct stat st; size_t pages; @@ -240,7 +239,7 @@ BATcheckimprints(BAT *b)
MonetDB: default - Reapproved tests: they have one more line of ...
Changeset: f47ed8756087 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f47ed8756087 Modified Files: sql/test/BugTracker/Tests/explain.SF-1739353.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out Branch: default Log Message: Reapproved tests: they have one more line of output. diffs (truncated from 322 to 300 lines): diff --git a/sql/test/BugTracker/Tests/explain.SF-1739353.stable.out b/sql/test/BugTracker/Tests/explain.SF-1739353.stable.out --- a/sql/test/BugTracker/Tests/explain.SF-1739353.stable.out +++ b/sql/test/BugTracker/Tests/explain.SF-1739353.stable.out @@ -1,94 +1,39 @@ stdout of test 'explain.SF-1739353` in directory 'sql/test/BugTracker` itself: -# 15:15:36 > -# 15:15:36 > mserver5 "--config=/ufs/manegold/_/scratch0/Monet/Testing/Candidate/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/manegold/_/scratch0/Monet/Testing/Candidate/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/lib64/MonetDB5:/ufs/manegold/_/scratch0/Monet/Testing/Candidate/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/lib64/MonetDB5/lib:/ufs/manegold/_/scratch0/Monet/Testing/Candidate/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/lib64/MonetDB5/bin" --set "gdk_dbfarm=/ufs/manegold/_/scratch0/Monet/Testing/Candidate/prefix.--enable-strict_--disable-optimize_--enable-debug_--enable-assert/var/MonetDB5/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=33159 --set xrpc_port=45591 --set monet_prompt= --trace "--dbname=mTests_src_test_BugTracker" --set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over.. -# 15:15:36 > +# 15:11:17 > +# 15:11:17 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33800" "--set" "mapi_usock=/var/tmp/mtest-7180/.s.monetdb.33800" "--set" "monet_prompt=" "--forcemito" "--dbpath=/ufs/sjoerd/@Monet-virgin/var/MonetDB/mTests_sql_test_BugTracker" +# 15:11:17 > -# 12:04:36 > -# 12:04:36 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=39801" "--set" "mapi_usock=/var/tmp/mtest-31630/.s.monetdb.39801" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_test_BugTracker" "--set" "embedded_r=yes" "--set" "embedded_py=true" -# 12:04:36 > - -# MonetDB 5 server v11.24.0 +# MonetDB 5 server v11.28.0 (hg id: 623015a562d3) # This is an unreleased version # Serving database 'mTests_sql_test_BugTracker', using 8 threads # Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers -# Found 15.589 GiB available main-memory. +# Found 62.701 GiB available main-memory. # Copyright (c) 1993-July 2008 CWI. -# Copyright (c) August 2008-2016 MonetDB B.V., all rights reserved -# Visit http://www.monetdb.org/ for further information -# Listening for connection requests on mapi:monetdb://toulouse.da.cwi.nl:39801/ -# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-31630/.s.monetdb.39801 +# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://methuselah.da.cwi.nl:33800/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-7180/.s.monetdb.33800 # MonetDB/GIS module loaded # MonetDB/SQL module loaded -# MonetDB/Python module loaded -# MonetDB/R module loaded Ready. -# SQL catalog created, loading sql scripts once -# loading sql script: 09_like.sql -# loading sql script: 10_math.sql -# loading sql script: 11_times.sql -# loading sql script: 12_url.sql -# loading sql script: 13_date.sql -# loading sql script: 14_inet.sql -# loading sql script: 15_querylog.sql -# loading sql script: 16_tracelog.sql -# loading sql script: 17_temporal.sql -# loading sql script: 18_index.sql -# loading sql script: 20_vacuum.sql -# loading sql script: 21_dependency_functions.sql -# loading sql script: 22_clients.sql -# loading sql script: 23_skyserver.sql -# loading sql script: 25_debug.sql -# loading sql script: 26_sysmon.sql -# loading sql script: 27_rejects.sql -# loading sql script: 39_analytics.sql -# loading sql script: 39_analytics_hge.sql -# loading sql script: 40_geom.sql -# loading sql script: 40_json.sql -# loading sql script: 40_json_hge.sql -# loading sql script: 41_md5sum.sql -# loading sql script: 45_uuid.sql -# loading sql script: 46_gsl.sql -# loading sql script: 46_profiler.sql -# loading sql script: 51_sys_schema_extension.sql -# loading sql script: 72_fits.sql -# loading sql script: 74_netcdf.sql -# loading sql script: 75_lidar.sql -# loading sql script: 75_shp.sql -# loading sql script: 75_storagemodel.sql -# loading sql script: 80_statistics.sql -# loading sql script: 80_udf.sql -# load
MonetDB: default - Merge with Jul2017 branch, but keeping the ch...
Changeset: 1a376dc76222 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1a376dc76222 Modified Files: sql/server/rel_schema.c sql/server/rel_updates.c sql/server/sql_parser.y sql/test/BugTracker-2017/Tests/All Branch: default Log Message: Merge with Jul2017 branch, but keeping the changes to add DEFAULT to INSERT. ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2017 - Merge with Dec2016 branch.
Changeset: 344b0c2c61eb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=344b0c2c61eb Removed Files: sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.sql sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.stable.err sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.stable.out Modified Files: sql/server/rel_schema.c sql/server/rel_updates.c sql/server/sql_parser.y sql/test/BugTracker-2017/Tests/All Branch: Jul2017 Log Message: Merge with Dec2016 branch. diffs (truncated from 319 to 300 lines): 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 @@ -409,16 +409,17 @@ column_option( if (e && is_atom(e->type)) { atom *a = exp_value(sql, e, sql->args, sql->argc); - if(!atom_cast(sql->sa, a, &cs->type)) { - (void) sql_error(sql, 02, "42000!could not cast the default value to the column type\n"); - return SQL_ERR; + if (atom_null(a)) { + mvc_default(sql, cs, NULL); + res = SQL_OK; + break; } } /* reset error */ sql->session->status = 0; sql->errstr[0] = '\0'; } - r = symbol2string(sql, s->data.sym, &err); + r = symbol2string(sql, s->data.sym, &err); if (!r) { (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); @@ -737,25 +738,14 @@ table_element(mvc *sql, symbol *s, sql_s char *cname = l->h->data.sval; symbol *sym = l->h->next->data.sym; sql_column *c = mvc_bind_column(sql, t, cname); - sql_exp *e = NULL; if (!c) { sql_error(sql, 02, "42S22!ALTER TABLE: no such column '%s'\n", cname); return SQL_ERR; } - e = rel_logical_value_exp(sql, NULL, sym, sql_sel); - - if (e && is_atom(e->type)) { - atom *a = exp_value(sql, e, sql->args, sql->argc); - - if(!atom_cast(sql->sa, a, &c->type)) { - (void) sql_error(sql, 02, "42S22!ALTER TABLE: could not cast the default value to the column type\n"); - return SQL_ERR; - } - } r = symbol2string(sql, sym, &err); if (!r) { - (void) sql_error(sql, 02, "42S22!ALTER TABLE: incorrect default value '%s'\n", err?err:""); + (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); return SQL_ERR; } diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/server/rel_updates.c @@ -23,12 +23,6 @@ insert_value(mvc *sql, sql_column *c, sq { if (s->token == SQL_NULL) { return exp_atom(sql->sa, atom_general(sql->sa, &c->type, NULL)); - } else if (s->token == SQL_DEFAULT) { - if (c->def) { - return rel_parse_val(sql, sa_message(sql->sa, "select CAST(%s AS %s);", c->def, c->type.type->sqlname), sql->emode); - } else { - return sql_error(sql, 02, "INSERT INTO: column '%s' has no valid default value", c->base.name); - } } else { int is_last = 0; exp_kind ek = {type_value, card_value, FALSE}; @@ -977,19 +971,11 @@ update_table(mvc *sql, dlist *qname, dli int status = sql->session->status; exp_kind ek = {type_value, (single)?card_column:card_relation, FALSE}; - if(single && a->token == SQL_DEFAULT) { - char *colname = assignment->h->next->data.sval; - sql_column *col = mvc_bind_column(sql, t, colname); - if (col->def) { - v = rel_parse_val(sql, sa_message(sql->sa, "select CAST(%s AS %s);", col->def, col->type.type->sqlname), sql->emode); - } else { - return sql_error(sql, 02, "UPDATE: column '%s' has no valid default value", col->base.name); - } -
MonetDB: Dec2016 - Backed out changes to add DEFAULT keyword to ...
Changeset: a3820230b7b7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a3820230b7b7 Removed Files: sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.sql sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.stable.err sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.stable.out Modified Files: sql/server/rel_schema.c sql/server/rel_updates.c sql/server/sql_parser.y sql/test/BugTracker-2017/Tests/All Branch: Dec2016 Log Message: Backed out changes to add DEFAULT keyword to INSERT INTO query. These changes belong in the default branch. Backed out changesets f4b67f9daddb, 955f7a5b847c, 24d1f738cf7c. diffs (truncated from 319 to 300 lines): 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 @@ -408,16 +408,17 @@ column_option( if (e && is_atom(e->type)) { atom *a = exp_value(sql, e, sql->args, sql->argc); - if(!atom_cast(sql->sa, a, &cs->type)) { - (void) sql_error(sql, 02, "42000!could not cast the default value to the column type\n"); - return SQL_ERR; + if (atom_null(a)) { + mvc_default(sql, cs, NULL); + res = SQL_OK; + break; } } /* reset error */ sql->session->status = 0; sql->errstr[0] = '\0'; } - r = symbol2string(sql, s->data.sym, &err); + r = symbol2string(sql, s->data.sym, &err); if (!r) { (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); @@ -736,25 +737,14 @@ table_element(mvc *sql, symbol *s, sql_s char *cname = l->h->data.sval; symbol *sym = l->h->next->data.sym; sql_column *c = mvc_bind_column(sql, t, cname); - sql_exp *e = NULL; if (!c) { sql_error(sql, 02, "42S22!ALTER TABLE: no such column '%s'\n", cname); return SQL_ERR; } - e = rel_logical_value_exp(sql, NULL, sym, sql_sel); - - if (e && is_atom(e->type)) { - atom *a = exp_value(sql, e, sql->args, sql->argc); - - if(!atom_cast(sql->sa, a, &c->type)) { - (void) sql_error(sql, 02, "42S22!ALTER TABLE: could not cast the default value to the column type\n"); - return SQL_ERR; - } - } r = symbol2string(sql, sym, &err); if (!r) { - (void) sql_error(sql, 02, "42S22!ALTER TABLE: incorrect default value '%s'\n", err?err:""); + (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); return SQL_ERR; } diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/server/rel_updates.c @@ -23,12 +23,6 @@ insert_value(mvc *sql, sql_column *c, sq { if (s->token == SQL_NULL) { return exp_atom(sql->sa, atom_general(sql->sa, &c->type, NULL)); - } else if (s->token == SQL_DEFAULT) { - if (c->def) { - return rel_parse_val(sql, sa_message(sql->sa, "select CAST(%s AS %s);", c->def, c->type.type->sqlname), sql->emode); - } else { - return sql_error(sql, 02, "INSERT INTO: column '%s' has no valid default value", c->base.name); - } } else { int is_last = 0; exp_kind ek = {type_value, card_value, FALSE}; @@ -977,19 +971,11 @@ update_table(mvc *sql, dlist *qname, dli int status = sql->session->status; exp_kind ek = {type_value, (single)?card_column:card_relation, FALSE}; - if(single && a->token == SQL_DEFAULT) { - char *colname = assignment->h->next->data.sval; - sql_column *col = mvc_bind_column(sql, t, colname); - if (col->def) { - v = rel_parse_val(sql, sa_message(sql->sa, "select CAST(%s AS %s);", col->def, col->type.type->sqlname), sql->emode); - } else { - return
MonetDB: default - Merge with Jul2017 branch.
Changeset: 7a05d785c825 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7a05d785c825 Added Files: sql/backends/monet5/Tests/pyapi34.sql sql/backends/monet5/Tests/pyapi34.stable.err sql/backends/monet5/Tests/pyapi34.stable.out sql/test/BugTracker-2017/Tests/crash-dce.Bug-6330.stable.out.int128 sql/test/BugTracker-2017/Tests/crash-select_after_MAL_error.Bug-6332.stable.out.int128 sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.stable.err sql/test/BugTracker-2017/Tests/default-insert-update.Bug-6249.stable.out Modified Files: sql/backends/monet5/Tests/All sql/backends/monet5/UDF/pyapi/connection.c sql/backends/monet5/UDF/pyapi/conversion.c sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_gencode.c sql/server/rel_dump.c sql/server/rel_schema.c sql/server/sql_parser.y sql/storage/store.c sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.out sql/test/BugTracker-2009/Tests/use_order_column_first.SF-2686008.stable.out sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out sql/test/BugTracker-2010/Tests/ORDER_BY_over_UNION_EXCEPT_INTERSECT.Bug-2606.stable.out sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out sql/test/BugTracker-2011/Tests/crash_on_alias.Bug-2798.stable.out.int128 sql/test/BugTracker-2013/Tests/rangejoin_optimizer.Bug-3411.stable.out sql/test/BugTracker-2015/Tests/crash.Bug-3736.stable.out sql/test/BugTracker-2015/Tests/large_join.Bug-3809.stable.out sql/test/BugTracker-2015/Tests/quantile_function_resolution.Bug-3773.stable.out sql/test/BugTracker-2015/Tests/schema_view.Bug-3708.stable.out sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.stable.out sql/test/BugTracker-2016/Tests/merge_project.Bug-3955.stable.out sql/test/BugTracker-2017/Tests/All sql/test/BugTracker-2017/Tests/crash-dce.Bug-6330.stable.out sql/test/BugTracker-2017/Tests/crash-select_after_MAL_error.Bug-6332.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out sql/test/Tests/order_by_complex_exp.stable.out sql/test/leaks/Tests/check1.stable.out.int128 sql/test/mergetables/Tests/part-elim.stable.out sql/test/pg_regress/Tests/alter_table.stable.err sql/test/pg_regress/Tests/alter_table.stable.out sql/test/pg_regress/Tests/insert.stable.err tools/merovingian/client/monetdb.c tools/merovingian/daemon/merovingian.c tools/merovingian/utils/properties.c Branch: default Log Message: Merge with Jul2017 branch. diffs (truncated from 2988 to 300 lines): diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All --- a/sql/backends/monet5/Tests/All +++ b/sql/backends/monet5/Tests/All @@ -53,6 +53,7 @@ HAVE_LIBPY?pyapi29 HAVE_LIBPY?pyapi30 HAVE_LIBPY?pyapi32 HAVE_LIBPY?pyapi33 +HAVE_LIBPY?pyapi34 HAVE_LIBPY?pyloader01 HAVE_LIBPY?pyloader02 diff --git a/sql/backends/monet5/Tests/pyapi34.sql b/sql/backends/monet5/Tests/pyapi34.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/Tests/pyapi34.sql @@ -0,0 +1,18 @@ + +START TRANSACTION; + +CREATE TABLE booleans(a BOOLEAN); +INSERT INTO booleans VALUES (1), (0), (1); + +CREATE FUNCTION pyapi34a(inp BOOLEAN) RETURNS BOOLEAN LANGUAGE PYTHON { + results = _conn.execute(u'SELECT * FROM booleans;') + return {'result': numpy.logical_xor(inp, results['a']) }; +}; + +CREATE FUNCTION pyapi34b(inp BOOLEAN) RETURNS BOOLEAN LANGUAGE PYTHON { + return {'result': inp}; +}; + +SELECT a, pyapi34a(a), pyapi34b(a) FROM booleans; + +ROLLBACK; diff --git a/sql/backends/monet5/Tests/pyapi34.stable.err b/sql/backends/monet5/Tests/pyapi34.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/Tests/pyapi34.stable.err @@ -0,0 +1,35 @@ +stderr of test 'pyapi34` in directory 'sql/backends/monet5` itself: + + +# 11:20:10 > +# 11:20:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=37278" "--set" "mapi_usock=/var/tmp/mtest-61818/.s.monetdb.37278" "--set" "monet_prompt=" "--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5" "--set" "embedded_py=true" +# 11:20:10 > + +# builtin opt gdk_dbpath = /Users/myth/opt/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 = 37278 +# cmdline opt mapi_usock = /var/tmp/mtest-61818/
MonetDB: Jul2017 - Merge with Dec2016 branch.
Changeset: a16bc49e2568 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a16bc49e2568 Modified Files: sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_gencode.c sql/server/rel_schema.c sql/server/sql_parser.y Branch: Jul2017 Log Message: Merge with Dec2016 branch. diffs (95 lines): diff --git a/sql/backends/monet5/sql_execute.c b/sql/backends/monet5/sql_execute.c --- a/sql/backends/monet5/sql_execute.c +++ b/sql/backends/monet5/sql_execute.c @@ -869,13 +869,9 @@ RAstatement2(Client cntxt, MalBlkPtr mb, } refs = sa_list(m->sa); rel = rel_read(m, *expr, &pos, refs); - if (!rel) + if (!rel || monet5_create_relational_function(m, *mod, *nme, rel, NULL, ops, 0) < 0) throw(SQL, "sql.register", "Cannot register %s", buf); - if (rel) { - monet5_create_relational_function(m, *mod, *nme, rel, NULL, ops, 0); - rel_destroy(rel); - } + rel_destroy(rel); sqlcleanup(m, 0); return msg; } - 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 @@ -364,6 +364,8 @@ static int sql_subtype *t = tail_type(op); const char *nme = (op->op3)?op->op3->op4.aval->data.val.sval:op->cname; + if ((nr + 100) > len) + buf = GDKrealloc(buf, len*=2); nr += snprintf(buf+nr, len-nr, "%s %s(%u,%u)%c", nme, t->type->sqlname, t->digits, t->scale, n->next?',':' '); } s = buf; 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 @@ -409,17 +409,16 @@ column_option( if (e && is_atom(e->type)) { atom *a = exp_value(sql, e, sql->args, sql->argc); - if (atom_null(a)) { - mvc_default(sql, cs, NULL); - res = SQL_OK; - break; + if(!atom_cast(sql->sa, a, &cs->type)) { + (void) sql_error(sql, 02, "42000!could not cast the default value to the column type\n"); + return SQL_ERR; } } /* reset error */ sql->session->status = 0; sql->errstr[0] = '\0'; } - r = symbol2string(sql, s->data.sym, &err); + r = symbol2string(sql, s->data.sym, &err); if (!r) { (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); @@ -738,14 +737,25 @@ table_element(mvc *sql, symbol *s, sql_s char *cname = l->h->data.sval; symbol *sym = l->h->next->data.sym; sql_column *c = mvc_bind_column(sql, t, cname); + sql_exp *e = NULL; if (!c) { sql_error(sql, 02, "42S22!ALTER TABLE: no such column '%s'\n", cname); return SQL_ERR; } + e = rel_logical_value_exp(sql, NULL, sym, sql_sel); + + if (e && is_atom(e->type)) { + atom *a = exp_value(sql, e, sql->args, sql->argc); + + if(!atom_cast(sql->sa, a, &c->type)) { + (void) sql_error(sql, 02, "42S22!ALTER TABLE: could not cast the default value to the column type\n"); + return SQL_ERR; + } + } r = symbol2string(sql, sym, &err); if (!r) { - (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); + (void) sql_error(sql, 02, "42S22!ALTER TABLE: incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); return SQL_ERR; } diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -1550,7 +1550,7 @@ default: ; default_value: -simple_scalar_exp { $$ = $1; } +atom { $$ = $1; } ; column_constraint: ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Dec2016 - Allow only atoms in the creation of a default...
Changeset: f4b67f9daddb for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4b67f9daddb Modified Files: sql/server/rel_schema.c sql/server/sql_parser.y Branch: Dec2016 Log Message: Allow only atoms in the creation of a default value for a column. Also validate it correctly by casting to the column type diffs (64 lines): 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 @@ -408,17 +408,16 @@ column_option( if (e && is_atom(e->type)) { atom *a = exp_value(sql, e, sql->args, sql->argc); - if (atom_null(a)) { - mvc_default(sql, cs, NULL); - res = SQL_OK; - break; + if(!atom_cast(sql->sa, a, &cs->type)) { + (void) sql_error(sql, 02, "42000!could not cast the default value to the column type\n"); + return SQL_ERR; } } /* reset error */ sql->session->status = 0; sql->errstr[0] = '\0'; } - r = symbol2string(sql, s->data.sym, &err); + r = symbol2string(sql, s->data.sym, &err); if (!r) { (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); @@ -737,14 +736,25 @@ table_element(mvc *sql, symbol *s, sql_s char *cname = l->h->data.sval; symbol *sym = l->h->next->data.sym; sql_column *c = mvc_bind_column(sql, t, cname); + sql_exp *e = NULL; if (!c) { sql_error(sql, 02, "42S22!ALTER TABLE: no such column '%s'\n", cname); return SQL_ERR; } + e = rel_logical_value_exp(sql, NULL, sym, sql_sel); + + if (e && is_atom(e->type)) { + atom *a = exp_value(sql, e, sql->args, sql->argc); + + if(!atom_cast(sql->sa, a, &c->type)) { + (void) sql_error(sql, 02, "42S22!ALTER TABLE: could not cast the default value to the column type\n"); + return SQL_ERR; + } + } r = symbol2string(sql, sym, &err); if (!r) { - (void) sql_error(sql, 02, "42000!incorrect default value '%s'\n", err?err:""); + (void) sql_error(sql, 02, "42S22!ALTER TABLE: incorrect default value '%s'\n", err?err:""); if (err) _DELETE(err); return SQL_ERR; } diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -1517,7 +1517,7 @@ default: ; default_value: -simple_scalar_exp { $$ = $1; } +atom { $$ = $1; } ; column_constraint: ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2017 - Allow unicode loopback queries in Python 2.
Changeset: d64bf688bd70 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d64bf688bd70 Modified Files: sql/backends/monet5/Tests/pyapi34.sql sql/backends/monet5/UDF/pyapi/connection.c Branch: Jul2017 Log Message: Allow unicode loopback queries in Python 2. diffs (67 lines): diff --git a/sql/backends/monet5/Tests/pyapi34.sql b/sql/backends/monet5/Tests/pyapi34.sql --- a/sql/backends/monet5/Tests/pyapi34.sql +++ b/sql/backends/monet5/Tests/pyapi34.sql @@ -5,7 +5,7 @@ CREATE TABLE booleans(a BOOLEAN); INSERT INTO booleans VALUES (1), (0), (1); CREATE FUNCTION pyapi34a(inp BOOLEAN) RETURNS BOOLEAN LANGUAGE PYTHON { - results = _conn.execute('SELECT * FROM booleans;') + results = _conn.execute(u'SELECT * FROM booleans;') return {'result': numpy.logical_xor(inp, results['a']) }; }; diff --git a/sql/backends/monet5/UDF/pyapi/connection.c b/sql/backends/monet5/UDF/pyapi/connection.c --- a/sql/backends/monet5/UDF/pyapi/connection.c +++ b/sql/backends/monet5/UDF/pyapi/connection.c @@ -19,28 +19,40 @@ CREATE_SQL_FUNCTION_PTR(str, create_tabl static PyObject *_connection_execute(Py_ConnectionObject *self, PyObject *args) { - if (!PyString_CheckExact(args)) { + char *query = NULL; +#ifndef IS_PY3K + if (PyUnicode_CheckExact(args)) { + PyObject* str = PyUnicode_AsUTF8String(args); + if (!str) { + PyErr_Format(PyExc_Exception, "Unicode failure."); + return NULL; + } + query = GDKstrdup(((PyStringObject *)str)->ob_sval); + Py_DECREF(str); + } else +#endif + if (PyString_CheckExact(args)) { +#ifndef IS_PY3K + query = GDKstrdup(((PyStringObject *)args)->ob_sval); +#else + query = GDKstrdup(PyUnicode_AsUTF8(args)); +#endif + } else { PyErr_Format(PyExc_TypeError, "expected a query string, but got an object of type %s", Py_TYPE(args)->tp_name); return NULL; } + if (!query) { + PyErr_Format(PyExc_Exception, "%s", MAL_MALLOC_FAIL); + return NULL; + } if (!self->mapped) { // This is not a mapped process, so we can just directly execute the // query here PyObject *result; res_table *output = NULL; char *res = NULL; - char *query; -#ifndef IS_PY3K - query = GDKstrdup(((PyStringObject *)args)->ob_sval); -#else - query = GDKstrdup(PyUnicode_AsUTF8(args)); -#endif - if (!query) { - PyErr_Format(PyExc_Exception, MAL_MALLOC_FAIL); - return NULL; - } Py_BEGIN_ALLOW_THREADS; res = _connection_query(self->cntxt, query, &output); Py_END_ALLOW_THREADS; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2017 - Release the GIL during loopback queries.
Changeset: a144c611 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a144c611 Modified Files: sql/backends/monet5/UDF/pyapi/connection.c Branch: Jul2017 Log Message: Release the GIL during loopback queries. diffs (25 lines): diff --git a/sql/backends/monet5/UDF/pyapi/connection.c b/sql/backends/monet5/UDF/pyapi/connection.c --- a/sql/backends/monet5/UDF/pyapi/connection.c +++ b/sql/backends/monet5/UDF/pyapi/connection.c @@ -33,12 +33,18 @@ static PyObject *_connection_execute(Py_ char *res = NULL; char *query; #ifndef IS_PY3K - query = ((PyStringObject *)args)->ob_sval; + query = GDKstrdup(((PyStringObject *)args)->ob_sval); #else - query = PyUnicode_AsUTF8(args); + query = GDKstrdup(PyUnicode_AsUTF8(args)); #endif - + if (!query) { + PyErr_Format(PyExc_Exception, MAL_MALLOC_FAIL); + return NULL; + } +Py_BEGIN_ALLOW_THREADS; res = _connection_query(self->cntxt, query, &output); +Py_END_ALLOW_THREADS; + GDKfree(query); if (res != MAL_SUCCEED) { PyErr_Format(PyExc_Exception, "SQL Query Failed: %s", (res ? res : "")); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2017 - Support boolean types in loopback queries.
Changeset: 8f19f442c63c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8f19f442c63c Added Files: sql/backends/monet5/Tests/pyapi34.sql sql/backends/monet5/Tests/pyapi34.stable.err sql/backends/monet5/Tests/pyapi34.stable.out Modified Files: sql/backends/monet5/Tests/All sql/backends/monet5/UDF/pyapi/conversion.c Branch: Jul2017 Log Message: Support boolean types in loopback queries. diffs (178 lines): diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All --- a/sql/backends/monet5/Tests/All +++ b/sql/backends/monet5/Tests/All @@ -53,6 +53,7 @@ HAVE_LIBPY?pyapi29 HAVE_LIBPY?pyapi30 HAVE_LIBPY?pyapi32 HAVE_LIBPY?pyapi33 +HAVE_LIBPY?pyapi34 HAVE_LIBPY?pyloader01 HAVE_LIBPY?pyloader02 diff --git a/sql/backends/monet5/Tests/pyapi34.sql b/sql/backends/monet5/Tests/pyapi34.sql new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/Tests/pyapi34.sql @@ -0,0 +1,18 @@ + +START TRANSACTION; + +CREATE TABLE booleans(a BOOLEAN); +INSERT INTO booleans VALUES (1), (0), (1); + +CREATE FUNCTION pyapi34a(inp BOOLEAN) RETURNS BOOLEAN LANGUAGE PYTHON { + results = _conn.execute('SELECT * FROM booleans;') + return {'result': numpy.logical_xor(inp, results['a']) }; +}; + +CREATE FUNCTION pyapi34b(inp BOOLEAN) RETURNS BOOLEAN LANGUAGE PYTHON { + return {'result': inp}; +}; + +SELECT a, pyapi34a(a), pyapi34b(a) FROM booleans; + +ROLLBACK; diff --git a/sql/backends/monet5/Tests/pyapi34.stable.err b/sql/backends/monet5/Tests/pyapi34.stable.err new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/Tests/pyapi34.stable.err @@ -0,0 +1,35 @@ +stderr of test 'pyapi34` in directory 'sql/backends/monet5` itself: + + +# 11:20:10 > +# 11:20:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=37278" "--set" "mapi_usock=/var/tmp/mtest-61818/.s.monetdb.37278" "--set" "monet_prompt=" "--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5" "--set" "embedded_py=true" +# 11:20:10 > + +# builtin opt gdk_dbpath = /Users/myth/opt/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 = 37278 +# cmdline opt mapi_usock = /var/tmp/mtest-61818/.s.monetdb.37278 +# cmdline opt monet_prompt = +# cmdline opt gdk_dbpath = /Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5 +# cmdline opt embedded_py = true +# cmdline opt gdk_debug = 536870922 + +# 11:20:10 > +# 11:20:10 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-61818" "--port=37278" +# 11:20:10 > + + +# 11:20:10 > +# 11:20:10 > "Done." +# 11:20:10 > + diff --git a/sql/backends/monet5/Tests/pyapi34.stable.out b/sql/backends/monet5/Tests/pyapi34.stable.out new file mode 100644 --- /dev/null +++ b/sql/backends/monet5/Tests/pyapi34.stable.out @@ -0,0 +1,86 @@ +stdout of test 'pyapi34` in directory 'sql/backends/monet5` itself: + + +# 11:20:10 > +# 11:20:10 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=37278" "--set" "mapi_usock=/var/tmp/mtest-61818/.s.monetdb.37278" "--set" "monet_prompt=" "--forcemito" "--dbpath=/Users/myth/opt/var/MonetDB/mTests_sql_backends_monet5" "--set" "embedded_py=true" +# 11:20:10 > + +# MonetDB 5 server v11.27.0 +# This is an unreleased version +# Serving database 'mTests_sql_backends_monet5', using 4 threads +# Compiled for x86_64-apple-darwin15.6.0/64bit with 128bit integers +# Found 8.000 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://dhcp-21.eduroam.cwi.nl:37278/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-61818/.s.monetdb.37278 +# MonetDB/SQL module loaded +# MonetDB/Python2 module loaded + +Ready. +# SQL catalog created, loading sql scripts once +# loading sql script: 09_like.sql +# loading sql script: 10_math.sql +# loading sql script: 11_times.sql +# loading sql script: 12_url.sql +# loading sql script: 13_date.sql +# loading sql script: 14_inet.sql +# loading sql script: 15_querylog.sql +# loading sql script: 16_tracelog.sql +# loading sql script: 17_temporal.sql +# loading sql script: 18_index.sql +# loading sql script: 20_vacuum.sql +# loading sql script: 21_dependency_functions.sql +# loading sql script: 22_clients.sql +# loading sql script: 23_skyserver.sql +# loading sql script: 25_debug.sql +# loading sql script: 26_sysmon.sql +# loading sql script: 27_rej
MonetDB: stratified_sampling - Fix dll linkage issue.
Changeset: 65ad22367605 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=65ad22367605 Modified Files: common/utils/mtwist.h Branch: stratified_sampling Log Message: Fix dll linkage issue. diffs (12 lines): diff --git a/common/utils/mtwist.h b/common/utils/mtwist.h --- a/common/utils/mtwist.h +++ b/common/utils/mtwist.h @@ -32,7 +32,7 @@ #define _SEEN_MTWIST_H 1 #ifdef NATIVE_WIN32 -#if !defined(LIBMUTILS) && !defined(LIBGDK) && !defined(LIBMEROUTIL) +#if !defined(LIBMTWIST) && !defined(LIBMUTILS) && !defined(LIBGDK) && !defined(LIBMEROUTIL) #define mtwist_export extern __declspec(dllimport) #else #define mtwist_export extern __declspec(dllexport) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list