Changeset: 1591d642835e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1591d642835e
Modified Files:
        monetdb5/optimizer/opt_pushselect.c
        sql/backends/monet5/sql_execute.c
        sql/backends/monet5/sql_gencode.c
Branch: default
Log Message:

merged with Jun2016


diffs (109 lines):

diff --git a/monetdb5/optimizer/opt_pushselect.c 
b/monetdb5/optimizer/opt_pushselect.c
--- a/monetdb5/optimizer/opt_pushselect.c
+++ b/monetdb5/optimizer/opt_pushselect.c
@@ -516,13 +516,14 @@ OPTpushselectImplementation(Client cntxt
                        int var = getArg(p, 1);
                        InstrPtr r = old[vars[var]];
                        
-                       if (isSlice(r) && rslices[getArg(p,1)] != 0 && 
getArg(r, 0) == getArg(p, 1)) {
+                       if (r && isSlice(r) && rslices[getArg(p,1)] != 0 && 
getArg(r, 0) == getArg(p, 1)) {
                                InstrPtr q = newAssignment(mb);
 
                                getArg(q, 0) = getArg(p, 0); 
                                (void) pushArgument(mb, q, getArg(p, 2));
                                actions++;
                                freeInstruction(p);
+                               old[i] = NULL;
                                continue;
                        }
                } else if (p->argc >= 2 && slices[getArg(p, 1)] != 0) {
@@ -586,6 +587,7 @@ OPTpushselectImplementation(Client cntxt
                                u->typechk = TYPE_UNKNOWN;
                                pushInstruction(mb,u);  
                                freeInstruction(p);
+                               old[i] = NULL;
                                continue;
                        }
                }
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
@@ -567,6 +567,11 @@ SQLengineIntern(Client c, backend *be)
 #endif
 
        if (c->curprg->def->stop == 1) {
+               if (mvc_status(m)) {
+                       if (*m->errstr)
+                               msg = createException(PARSE, "SQLparser", "%s", 
m->errstr);
+                       goto cleanup_engine;
+               }
                sqlcleanup(be->mvc, 0);
                return MAL_SUCCEED;
        }
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
@@ -2848,8 +2848,6 @@ backend_dumpproc(backend *be, Client c, 
        node *n;
 
        backup = c->curprg;
-
-       /* later we change this to a factory ? */
        if (cq)
                c->curprg = newFunction(userRef, putName(cq->name), 
FUNCTIONsymbol);
        else
@@ -2875,8 +2873,9 @@ backend_dumpproc(backend *be, Client c, 
                        snprintf(arg, IDLENGTH, "A%d", argc);
                        a->varid = varid = newVariable(mb, arg,strlen(arg), 
type);
                        curInstr = pushArgument(mb, curInstr, varid);
-                       if (curInstr == NULL)
-                               return NULL;
+                       assert(curInstr);
+                       if (curInstr == NULL) 
+                               goto cleanup;
                        setVarType(mb, varid, type);
                        setVarUDFtype(mb, 0);
                }
@@ -2890,15 +2889,16 @@ backend_dumpproc(backend *be, Client c, 
                        snprintf(arg, IDLENGTH, "A%d", argc);
                        varid = newVariable(mb, arg,strlen(arg), type);
                        curInstr = pushArgument(mb, curInstr, varid);
-                       if (curInstr == NULL)
-                               return NULL;
+                       assert(curInstr);
+                       if (curInstr == NULL) 
+                               goto cleanup;
                        setVarType(mb, varid, type);
                        setVarUDFtype(mb, varid);
                }
        }
 
-       if (backend_dumpstmt(be, mb, s, 1, 1) < 0)
-               return NULL;
+       if (backend_dumpstmt(be, mb, s, 1, 1) < 0) 
+               goto cleanup;
 
        // Always keep the SQL query around for monitoring
        // if (m->history || QLOGisset()) {
@@ -2917,7 +2917,7 @@ backend_dumpproc(backend *be, Client c, 
                q = newStmt(mb, querylogRef, defineRef);
                if (q == NULL) {
                        GDKfree(tt);
-                       return NULL;
+                       goto cleanup;
                }
                q->token = REMsymbol;   // will be patched
                setVarType(mb, getArg(q, 0), TYPE_void);
@@ -2933,6 +2933,12 @@ backend_dumpproc(backend *be, Client c, 
        if (backup)
                c->curprg = backup;
        return curPrg;
+
+cleanup:
+       freeSymbol(curPrg);
+       if (backup)
+               c->curprg = backup;
+       return NULL;
 }
 
 void
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to