Changeset: 7a9d6f66042f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7a9d6f66042f
Modified Files:
        monetdb5/optimizer/opt_pushselect.c
Branch: Oct2014
Log Message:

make sure we don't over write tids after an update


diffs (38 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
@@ -114,6 +114,21 @@ subselect_find_subselect( subselect_t *s
        return -1;
 }
 
+
+/* check for updates inbetween assignment to variables newv and oldv */
+static int 
+no_updates(InstrPtr *old, int *vars, int oldv, int newv) 
+{
+       while(newv > oldv) {
+               InstrPtr q = old[vars[newv]];
+
+               if (isUpdateInstruction(q)) 
+                       return 0;
+               newv = getArg(q, 1);
+       }
+       return 1;
+}
+
 int
 OPTpushselectImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci)
 {
@@ -169,9 +184,10 @@ OPTpushselectImplementation(Client cntxt
                                InstrPtr q = old[vars[subselects.tid[s]]];
                                int Qsname = getArg(q, 2), Qtname = getArg(q, 
3);
 
-                               if ((sname == Qsname && tname == Qtname) ||
+                               if (no_updates(old, vars, getArg(q,1), 
getArg(p,1)) &&
+                                   ((sname == Qsname && tname == Qtname) ||
                                    (0 && strcmp(getVarConstant(mb, 
sname).val.sval, getVarConstant(mb, Qsname).val.sval) == 0 &&
-                                    strcmp(getVarConstant(mb, tname).val.sval, 
getVarConstant(mb, Qtname).val.sval) == 0)) {
+                                    strcmp(getVarConstant(mb, tname).val.sval, 
getVarConstant(mb, Qtname).val.sval) == 0))) {
                                        clrFunction(p);
                                        p->retc = 1;
                                        p->argc = 2;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to