Changeset: 942a9594e434 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=942a9594e434
Modified Files:
        monetdb5/optimizer/opt_centipede.c
        sql/backends/monet5/sql_optimizer.c
        sql/backends/monet5/sql_scenario.c
Branch: Feb2013
Log Message:

check the return value of optimizeMALBlock() and propagate exceptions as 
necessary

Thus, changeset 2663022e4670 finally has a (visible) effect,
except from the case where runScenarioBody() silently swallows exceptions
(cf., bug 3256).


diffs (68 lines):

diff --git a/monetdb5/optimizer/opt_centipede.c 
b/monetdb5/optimizer/opt_centipede.c
--- a/monetdb5/optimizer/opt_centipede.c
+++ b/monetdb5/optimizer/opt_centipede.c
@@ -57,6 +57,7 @@ OPTexecController(Client cntxt, MalBlkPt
        char nme[BUFSIZ], *plan, *stub;
        int barrier, x, i, j, k, *alias, nrpack;
        InstrPtr ret, p, q, *pack;
+       str msg = 0;
 
        /* define the query controller */
        snprintf(nme, BUFSIZ, "%s_plan"OIDFMT, getFunctionId( 
getInstrPtr(mb,0)), plantag);
@@ -244,7 +245,14 @@ OPTexecController(Client cntxt, MalBlkPt
 
        pushEndInstruction(cmb);
 
-       optimizeMALBlock(cntxt, cmb);
+       msg = optimizeMALBlock(cntxt, cmb);
+       if (msg != MAL_SUCCEED) {
+               showScriptException(cntxt->fdout, cmb, 0, MAL, "%s", msg);
+               GDKfree(alias);
+               GDKfree(pack);
+               return 0;
+       }
+
        chkProgram(cntxt->fdout, cntxt->nspace, cmb);
        GDKfree(alias);
        GDKfree(pack);
diff --git a/sql/backends/monet5/sql_optimizer.c 
b/sql/backends/monet5/sql_optimizer.c
--- a/sql/backends/monet5/sql_optimizer.c
+++ b/sql/backends/monet5/sql_optimizer.c
@@ -261,6 +261,7 @@ addQueryToCache(Client c)
        mvc *m;
        ValRecord *val;
        backend *be;
+       str msg = 0;
 
        be = (backend *) c->sqlcontext;
        assert( be && be->mvc );        /* SQL clients should always have their 
state set */
@@ -294,7 +295,12 @@ addQueryToCache(Client c)
        SQLgetStatistics(c,m,mb);
        if ( m->emod & mod_debug )
                addtoMalBlkHistory(mb,"getStatistics");
-       optimizeMALBlock(c,mb);
+
+       msg = optimizeMALBlock(c,mb);
+       if (msg != MAL_SUCCEED) {
+               showScriptException(c->fdout, mb, 0, MAL, "%s", msg);
+               return;
+       }
 
        /* time to execute the optimizers */
        if( c->debug)
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1688,7 +1688,11 @@ SQLparser(Client c)
                                mb = c->curprg->def;
                                chkProgram(c->fdout, c->nspace, mb);
                                addOptimizerPipe(c, mb, "minimal_pipe");
-                               optimizeMALBlock(c, mb);
+                               msg = optimizeMALBlock(c, mb);
+                               if (msg != MAL_SUCCEED) {
+                                       sqlcleanup(m, err);
+                                       goto finalize;
+                               }
                                c->curprg->def = mb;
                        } else {
                                err = 1;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to