Changeset: 7018c1058588 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7018c1058588
Modified Files:
        monetdb5/optimizer/opt_emptybind.c
Branch: default
Log Message:

Avoid removal of sql.bind operations
Empty persistent table operations should only be removed when
there are no other updates within the same transaction

addressing bug #6261


diffs (77 lines):

diff --git a/monetdb5/optimizer/opt_emptybind.c 
b/monetdb5/optimizer/opt_emptybind.c
--- a/monetdb5/optimizer/opt_emptybind.c
+++ b/monetdb5/optimizer/opt_emptybind.c
@@ -183,28 +183,6 @@ OPTemptybindImplementation(Client cntxt,
                                        }
                                }
                        }
-                       if( empty[getArg(p,0)]){
-                int tpe;
-                               actions++;
-                               if( p->retc == 2){
-                                       tpe = 
getBatType(getVarType(mb,getArg(p,1)));
-                                       q= newInstruction(0, batRef, newRef);
-                                       q = pushType(mb,q,tpe);
-                                       getArg(q,0)= getArg(p,1);
-                                       setVarFixed(mb, getArg(p,0));
-                                       pushInstruction(mb,q);
-                                       empty[getArg(q,0)]= i;
-                               }
-
-                tpe = getBatType(getVarType(mb,getArg(p,0)));
-                clrFunction(p);
-                setModuleId(p,batRef);
-                setFunctionId(p,newRef);
-                p->argc = p->retc = 1;
-                p = pushType(mb,p,tpe);
-                               setVarFixed(mb, getArg(p,0));
-                               empty[getArg(p,0)]= i;
-                       }
                        continue;
                }
 
@@ -243,28 +221,6 @@ OPTemptybindImplementation(Client cntxt,
                                        }
                                }
                        }
-                       if( empty[getArg(p,0)]){
-                               int tpe;
-                               actions++;
-                               if( p->retc == 2){
-                                       tpe = 
getBatType(getVarType(mb,getArg(p,1)));
-                                       q= newInstruction(0, batRef, newRef);
-                                       q = pushType(mb,q,tpe);
-                                       getArg(q,0)= getArg(p,1);
-                                       setVarFixed(mb,getArg(q,0));
-                                       pushInstruction(mb,q);
-                                       empty[getArg(q,0)]= i;
-                               }
-                               
-                               tpe = getBatType(getVarType(mb,getArg(p,0)));
-                               clrFunction(p);
-                               setModuleId(p,batRef);
-                               setFunctionId(p,newRef);
-                               p->argc = p->retc = 1;
-                               p = pushType(mb,p,tpe);
-                               setVarFixed(mb, getArg(p,0));
-                               empty[getArg(p,0)]= i;
-                       }
                        continue;
                }
 
@@ -318,6 +274,15 @@ OPTemptybindImplementation(Client cntxt,
                                }
                        }
                }
+               if( getModuleId(p) == batstrRef){
+                       if( empty[getArg(p,1)] || empty[getArg(p,2)] ){
+#ifdef DEBUG_OPT_EMPTYBIND
+                               fprintf(stderr, "#empty string operation  pc %d 
var %d\n",i , getArg(p,0) );
+#endif
+                               actions++;
+                               emptyresult(0);
+                       }
+               }
                if (getModuleId(p)== batRef && isUpdateInstruction(p)){
                        if( empty[getArg(p,1)] && empty[getArg(p,2)]){
                                emptyresult(0);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to