Changeset: 596bd2644bcf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=596bd2644bcf
Modified Files:
        clients/Tests/exports.stable.out
        monetdb5/optimizer/opt_prelude.c
        monetdb5/optimizer/opt_prelude.h
        monetdb5/optimizer/opt_support.c
        sql/test/miscellaneous/Tests/declared_tables.sql
        sql/test/miscellaneous/Tests/declared_tables.stable.out
Branch: Jun2020
Log Message:

Fixed isUpdateInstruction with the update instructions at sql and bat modules. 
Fixed code generation for updates in declared tables in UDFs. Removed 
references for obsolete "inplace" MAL function


diffs (124 lines):

diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -2246,7 +2246,6 @@ void initParser(void);
 void initProfiler(void);
 str initQlog(void);
 int inlineMALblock(MalBlkPtr mb, int pc, MalBlkPtr mc);
-str inplaceRef;
 void insertSymbol(Module scope, Symbol prg);
 str instruction2str(MalBlkPtr mb, MalStkPtr stl, InstrPtr p, int hidden);
 str intRef;
diff --git a/monetdb5/optimizer/opt_prelude.c b/monetdb5/optimizer/opt_prelude.c
--- a/monetdb5/optimizer/opt_prelude.c
+++ b/monetdb5/optimizer/opt_prelude.c
@@ -152,7 +152,6 @@ str ifthenelseRef;
 str ilikeRef;
 str ilikeselectRef;
 str ilikethetaselectRef;
-str inplaceRef;
 str intersectcandRef;
 str intersectRef;
 str intRef;
@@ -457,7 +456,6 @@ void optimizerInit(void)
        ilikeRef = putName("ilike");
        ilikeselectRef = putName("ilikeselect");
        ilikethetaselectRef = putName("ilikethetaselect");
-       inplaceRef = putName("inplace");
        intersectcandRef= putName("intersectcand");
        intersectRef = putName("intersect");
        intRef = putName("int");
diff --git a/monetdb5/optimizer/opt_prelude.h b/monetdb5/optimizer/opt_prelude.h
--- a/monetdb5/optimizer/opt_prelude.h
+++ b/monetdb5/optimizer/opt_prelude.h
@@ -150,7 +150,6 @@ mal_export  str ilikeRef;
 mal_export  str ilikeselectRef;
 mal_export  str ilikethetaselectRef;
 mal_export  str ilikeuselectRef;
-mal_export  str inplaceRef;
 mal_export  str intersectcandRef;
 mal_export  str intersectRef;
 mal_export  str intRef;
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -295,22 +295,19 @@ safetyBarrier(InstrPtr p, InstrPtr q)
        return FALSE;
 }
 
-
 inline int
 isUpdateInstruction(InstrPtr p){
        if ( getModuleId(p) == sqlRef &&
-          ( getFunctionId(p) == inplaceRef ||
-               getFunctionId(p) == appendRef ||
+          ( getFunctionId(p) == appendRef ||
                getFunctionId(p) == updateRef ||
-               getFunctionId(p) == replaceRef ||
+               getFunctionId(p) == deleteRef ||
+               getFunctionId(p) == growRef ||
                getFunctionId(p) == clear_tableRef))
                        return TRUE;
        if ( getModuleId(p) == batRef &&
-          ( getFunctionId(p) == inplaceRef ||
-               getFunctionId(p) == appendRef ||
-               getFunctionId(p) == updateRef ||
+          ( getFunctionId(p) == appendRef ||
                getFunctionId(p) == replaceRef ||
-               getFunctionId(p) == clear_tableRef))
+               getFunctionId(p) == deleteRef))
                        return TRUE;
        return FALSE;
 }
diff --git a/sql/test/miscellaneous/Tests/declared_tables.sql 
b/sql/test/miscellaneous/Tests/declared_tables.sql
--- a/sql/test/miscellaneous/Tests/declared_tables.sql
+++ b/sql/test/miscellaneous/Tests/declared_tables.sql
@@ -33,15 +33,3 @@ SELECT testtruncate();
 SELECT testtruncate();
 
 DROP FUNCTION testtruncate;
-
-
-CREATE OR REPLACE FUNCTION testtruncate() RETURNS INT 
-BEGIN
-    DECLARE TABLE z (a int);
-    INSERT INTO z VALUES (1);
-    UPDATE z SET a = 2 WHERE a = 1;
-    TRUNCATE z;
-    INSERT INTO z VALUES (3);
-    DELETE FROM z WHERE a = 3;
-    RETURN SELECT a FROM z;
-END;
diff --git a/sql/test/miscellaneous/Tests/declared_tables.stable.out 
b/sql/test/miscellaneous/Tests/declared_tables.stable.out
--- a/sql/test/miscellaneous/Tests/declared_tables.stable.out
+++ b/sql/test/miscellaneous/Tests/declared_tables.stable.out
@@ -133,6 +133,29 @@ end user.s20_0;
 % int # type
 % 1 # length
 [ NULL ]
+#CREATE OR REPLACE FUNCTION testtruncate() RETURNS INT 
+#BEGIN
+#    DECLARE TABLE z (a int);
+#    INSERT INTO z VALUES (1);
+#    UPDATE z SET a = 2 WHERE a = 1;
+#    TRUNCATE z;
+#    INSERT INTO z VALUES (3);
+#    DELETE FROM z WHERE a = 3;
+#    RETURN SELECT a FROM z;
+#END;
+#SELECT testtruncate();
+% . # table_name
+% %1 # name
+% int # type
+% 1 # length
+[ NULL ]
+#SELECT testtruncate();
+% . # table_name
+% %1 # name
+% int # type
+% 1 # length
+[ NULL ]
+#DROP FUNCTION testtruncate;
 
 # 14:29:33 >  
 # 14:29:33 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to