Changeset: bbcc5033820c for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bbcc5033820c Modified Files: clients/Tests/All sql/backends/monet5/rest/rest_jsonstore_handle_get.c sql/backends/monet5/vaults/mseed.c sql/server/rel_optimizer.c sql/server/rel_updates.c sql/test/BugTracker-2015/Tests/All sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.sql sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.stable.out Branch: default Log Message:
Merge with Oct2014 branch. diffs (213 lines): diff --git a/clients/Tests/All b/clients/Tests/All --- a/clients/Tests/All +++ b/clients/Tests/All @@ -1,8 +1,8 @@ exports -HAVE_CFITSIO&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&HAVE_SAMTOOLS&HAVE_SPHINXCLIENT&!ENABLE_DATACELL?MAL-signatures_all -HAVE_CFITSIO&HAVE_GEOM&!HAVE_GSL&!HAVE_LIBR&!HAVE_SAMTOOLS&!HAVE_SPHINXCLIENT&!ENABLE_DATACELL?MAL-signatures_fits_geom -!HAVE_CFITSIO&HAVE_GEOM&!HAVE_GSL&!HAVE_LIBR&!HAVE_SAMTOOLS&!HAVE_SPHINXCLIENT&!ENABLE_DATACELL?MAL-signatures_geom -!HAVE_CFITSIO&!HAVE_GEOM&!HAVE_GSL&!HAVE_LIBR&!HAVE_SAMTOOLS&!HAVE_SPHINXCLIENT&!ENABLE_DATACELL?MAL-signatures_none +HAVE_CFITSIO&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&HAVE_SAMTOOLS&HAVE_SPHINXCLIENT&!ENABLE_DATACELL&!HAVE_JSONSTORE?MAL-signatures_all +HAVE_CFITSIO&HAVE_GEOM&!HAVE_GSL&!HAVE_LIBR&!HAVE_SAMTOOLS&!HAVE_SPHINXCLIENT&!ENABLE_DATACELL&!HAVE_JSONSTORE?MAL-signatures_fits_geom +!HAVE_CFITSIO&HAVE_GEOM&!HAVE_GSL&!HAVE_LIBR&!HAVE_SAMTOOLS&!HAVE_SPHINXCLIENT&!ENABLE_DATACELL&!HAVE_JSONSTORE?MAL-signatures_geom +!HAVE_CFITSIO&!HAVE_GEOM&!HAVE_GSL&!HAVE_LIBR&!HAVE_SAMTOOLS&!HAVE_SPHINXCLIENT&!ENABLE_DATACELL&!HAVE_JSONSTORE?MAL-signatures_none HAVE_GEOM&HAVE_GSL&HAVE_SAMTOOLS&!ENABLE_DATACELL&!BITS32?SQL-dump_all HAVE_GEOM&!HAVE_GSL&!HAVE_SAMTOOLS&!ENABLE_DATACELL?SQL-dump_geom !HAVE_GEOM&!HAVE_GSL&!HAVE_SAMTOOLS&!ENABLE_DATACELL&!BITS32?SQL-dump_none diff --git a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c --- a/sql/backends/monet5/rest/rest_jsonstore_handle_get.c +++ b/sql/backends/monet5/rest/rest_jsonstore_handle_get.c @@ -69,7 +69,7 @@ RESTsqlQuery(char **result, char * query be = (backend*)c->sqlcontext; be->output_format = OFMT_JSON; - qmsg = SQLstatementIntern(c, &query, "rest", TRUE, TRUE); + qmsg = SQLstatementIntern(c, &query, "rest", TRUE, TRUE, NULL); if (qmsg == MAL_SUCCEED) { resultstring = buffer_get_buf(resultbuffer); *result = GDKstrdup(resultstring); diff --git a/sql/backends/monet5/vaults/mseed.c b/sql/backends/monet5/vaults/mseed.c --- a/sql/backends/monet5/vaults/mseed.c +++ b/sql/backends/monet5/vaults/mseed.c @@ -112,7 +112,7 @@ #include "vault.h" #include "mtime.h" -str SQLstatementIntern(Client c, str *expr, str nme, int execute, bit output); +#include "sql_scenario.h" #define QRYinsertI "INSERT INTO mseedCatalog(mseed, seqno, dataquality, network, \ station, location, channel, starttime , samplerate, sampleindex, samplecnt, sampletype, minval,maxval) \ @@ -162,13 +162,13 @@ MseedImport(Client cntxt, MalBlkPtr mb, } else { if( strcmp(network,msr->network)) msg = createException(MAL,"mseed.import","network name is not stable"); - if( strcmp(station,msr->station)) + else if( strcmp(station,msr->station)) msg = createException(MAL,"mseed.import","station name is not stable"); - if( strcmp(location,msr->location)) + else if( strcmp(location,msr->location)) msg = createException(MAL,"mseed.import","location name is not stable"); - if( strcmp(channel,msr->channel)) + else if( strcmp(channel,msr->channel)) msg = createException(MAL,"mseed.import","channel name is not stable"); - if ( sampletype != msr->sampletype) + else if ( sampletype != msr->sampletype) msg = createException(MAL,"mseed.import","sample type is not stable"); if (msg) goto wrapup; } @@ -192,7 +192,7 @@ MseedImport(Client cntxt, MalBlkPtr mb, msg = createException(MAL,"mseed.import","data type not yet implemented"); goto wrapup; } - if ( ( msg =SQLstatementIntern(cntxt,&s,"mseed.import",TRUE,FALSE)) != MAL_SUCCEED) + if ( ( msg =SQLstatementIntern(cntxt,&s,"mseed.import",TRUE,FALSE,NULL)) != MAL_SUCCEED) break; sampleindex += msr->samplecnt; 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 @@ -6661,7 +6661,7 @@ exp_rename_up(mvc *sql, sql_exp *e, list break; case e_aggr: case e_func: { - list *l = e->l, *nl = NULL; + list *l = e->l, *nl = NULL, *r = e->r, *nr = NULL; if (!l) { return e; @@ -6670,10 +6670,19 @@ exp_rename_up(mvc *sql, sql_exp *e, list if (!nl) return NULL; } + if (e->r) { + nr = exps_rename_up(sql, r, aliases); + if (!nr) + return NULL; + } if (e->type == e_func) ne = exp_op(sql->sa, nl, e->f); else ne = exp_aggr(sql->sa, nl, e->f, need_distinct(e), need_no_nil(e), e->card, has_nil(e)); + if (ne && nr) { + ne->card = CARD_AGGR; + ne->r = nr; + } break; } case e_atom: 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 @@ -823,6 +823,7 @@ update_table(mvc *sql, dlist *qname, dli sql_rel *r = NULL; list *exps; dnode *n; + char *rname = NULL; if (t && !isTempTable(t) && STORE_READONLY) return sql_error(sql, 02, "UPDATE: update table '%s' not allowed in readonly mode", tname); @@ -851,7 +852,7 @@ update_table(mvc *sql, dlist *qname, dli } /* first create the project */ - e = exp_column(sql->sa, rel_name(r), TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1); + e = exp_column(sql->sa, rname = rel_name(r), TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1); exps = new_exp_list(sql->sa); append(exps, e); updates = table_update_array(sql, t); @@ -878,12 +879,15 @@ update_table(mvc *sql, dlist *qname, dli sql->session->status = status; if (single) { v = rel_value_exp(sql, &r, a, sql_sel, ek); - } else { - list *val_exps; + } else if (!rel_val && r) { r = rel_subquery(sql, r, a, ek, APPLY_JOIN); - val_exps = rel_projections(sql, r->r, NULL, 0, 1); - r = rel_project(sql->sa, r, rel_projections(sql, r, NULL, 1, 1)); - list_merge(r->exps, val_exps, (fdup)NULL); + if (r) { + list *val_exps = rel_projections(sql, r->r, NULL, 0, 1); + + r = rel_project(sql->sa, r, rel_projections(sql, r, NULL, 1, 1)); + if (r) + list_merge(r->exps, val_exps, (fdup)NULL); + } } } if ((single && !v) || (!single && !r)) { @@ -891,9 +895,9 @@ update_table(mvc *sql, dlist *qname, dli return NULL; } if (rel_val) { - if (!exp_name(v)) - exp_label(sql->sa, v, ++sql->label); if (single) { + if (!exp_name(v)) + exp_label(sql->sa, v, ++sql->label); rel_val = rel_project(sql->sa, rel_val, rel_projections(sql, rel_val, NULL, 0, 1)); rel_project_add_exp(sql, rel_val, v); } @@ -911,9 +915,9 @@ update_table(mvc *sql, dlist *qname, dli if (!rel_val) rel_val = r; if (!rel_val || !is_project(rel_val->op) || - dlist_length(cols) >= list_length(rel_val->exps)) { + dlist_length(cols) > list_length(rel_val->exps)) { rel_destroy(r); - return NULL; + return sql_error(sql, 02, "UPDATE: too many columns specified"); } nr = (list_length(rel_val->exps)-dlist_length(cols)); for(n=rel_val->exps->h; nr; nr--, n = n->next) @@ -923,6 +927,8 @@ update_table(mvc *sql, dlist *qname, dli sql_column *c = mvc_bind_column(sql, t, cname); sql_exp *v = n->data; + if (!exp_name(v)) + exp_label(sql->sa, v, ++sql->label); v = exp_column(sql->sa, exp_relname(v), exp_name(v), exp_subtype(v), v->card, has_nil(v), is_intern(v)); if (!v) { /* check for NULL */ v = exp_atom(sql->sa, atom_general(sql->sa, &c->type, NULL)); @@ -949,7 +955,7 @@ update_table(mvc *sql, dlist *qname, dli updates[c->colnr] = v; } } - e = exp_column(sql->sa, rel_name(r), TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1); + e = exp_column(sql->sa, rname, TID, sql_bind_localtype("oid"), CARD_MULTI, 0, 1); r = rel_project(sql->sa, r, append(new_exp_list(sql->sa),e)); r = rel_update(sql, bt, r, updates, exps); return r; diff --git a/sql/test/BugTracker-2015/Tests/All b/sql/test/BugTracker-2015/Tests/All --- a/sql/test/BugTracker-2015/Tests/All +++ b/sql/test/BugTracker-2015/Tests/All @@ -5,3 +5,5 @@ prepare_unop_crash.Bug-3653 and_or_in.Bug-3655 acidity2-fail.Bug-3635 inet-ordering.Bug-3660 +row-value-constructor-crash.Bug-3662 +incorrect-ROW_NUMBER.Bug-3663 diff --git a/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.sql b/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.sql --- a/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.sql +++ b/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.sql @@ -1,4 +1,6 @@ CREATE TABLE een (a INTEGER, b INTEGER, C integer); +insert into een values (1,1,1); UPDATE een SET (A,B,C) = (SELECT 2,2,2); SELECT * FROM een; +drop table een; diff --git a/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.stable.out b/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.stable.out --- a/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.stable.out +++ b/sql/test/BugTracker-2015/Tests/row-value-constructor-crash.Bug-3662.stable.out @@ -55,6 +55,8 @@ Ready. # 00:52:33 > #CREATE TABLE een (a INTEGER, b INTEGER, C integer); +#insert into een values (1,1,1); +[ 1 ] #UPDATE een SET (A,B,C) = (SELECT 2,2,2); [ 1 ] #SELECT * FROM een; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list