Changeset: ccadc9d13b74 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ccadc9d13b74
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/server/rel_psm.c
Branch: Apr2019
Log Message:

More stack_pop_frame missing calls.


diffs (108 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4392,20 +4392,22 @@ sql_update_triggers(backend *be, sql_tab
                if(!stack_push_frame(sql, "OLD-NEW"))
                        return 0;
                if (trigger->event == 2 && trigger->time == time) {
-                       stmt *s = NULL;
-       
                        /* add name for the 'inserted' to the stack */
                        const char *n = trigger->new_name;
                        const char *o = trigger->old_name;
-       
+
                        if (!n) n = "new"; 
                        if (!o) o = "old"; 
 
-                       if(!sql_stack_add_updated(sql, o, n, t, tids, updates))
+                       if(!sql_stack_add_updated(sql, o, n, t, tids, updates)) 
{
+                               stack_pop_frame(sql);
                                return 0;
-                       s = sql_parse(be, sql->sa, trigger->statement, 
m_instantiate);
-                       if (!s) 
+                       }
+
+                       if (!sql_parse(be, sql->sa, trigger->statement, 
m_instantiate)) {
+                               stack_pop_frame(sql);
                                return 0;
+                       }
                }
                stack_pop_frame(sql);
        }
@@ -4661,19 +4663,20 @@ sql_delete_triggers(backend *be, sql_tab
                if(!stack_push_frame(sql, "OLD-NEW"))
                        return 0;
                if (trigger->event == firing_type && trigger->time == time) {
-                       stmt *s = NULL;
-
                        /* add name for the 'deleted' to the stack */
                        const char *o = trigger->old_name;
 
                        if (!o) o = "old";
 
-                       if(!sql_stack_add_deleted(sql, o, t, tids, 
internal_type))
+                       if(!sql_stack_add_deleted(sql, o, t, tids, 
internal_type)) {
+                               stack_pop_frame(sql);
                                return 0;
-                       s = sql_parse(be, sql->sa, trigger->statement, 
m_instantiate);
-
-                       if (!s) 
+                       }
+
+                       if (!sql_parse(be, sql->sa, trigger->statement, 
m_instantiate)) {
+                               stack_pop_frame(sql);
                                return 0;
+                       }
                }
                stack_pop_frame(sql);
        }
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -1249,16 +1249,16 @@ create_trigger(mvc *sql, dlist *qname, i
 
        if (!instantiate) {
                t = mvc_bind_table(sql, ss, tname);
-               if(!stack_push_frame(sql, "OLD-NEW"))
+               if (!stack_push_frame(sql, "OLD-NEW"))
                        return sql_error(sql, 02, SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
                /* we need to add the old and new tables */
-               if (!instantiate && new_name) {
-                       if(!_stack_push_table(sql, new_name, t))
-                               return sql_error(sql, 02, SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+               if (new_name && !_stack_push_table(sql, new_name, t)) {
+                       stack_pop_frame(sql);
+                       return sql_error(sql, 02, SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
                }
-               if (!instantiate && old_name) {
-                       if(!_stack_push_table(sql, old_name, t))
-                               return sql_error(sql, 02, SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
+               if (old_name && !_stack_push_table(sql, old_name, t)) {
+                       stack_pop_frame(sql);
+                       return sql_error(sql, 02, SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
                }
        }
        if (condition) {
@@ -1270,8 +1270,11 @@ create_trigger(mvc *sql, dlist *qname, i
                        rel = stack_find_rel_view(sql, old_name);
                if (rel)
                        rel = rel_logical_exp(sql, rel, condition, sql_where);
-               if (!rel)
+               if (!rel) {
+                       if (!instantiate)
+                               stack_pop_frame(sql);
                        return NULL;
+               }
                /* transition tables */
                /* insert: rel_select(table [new], searchcondition) */
                /* delete: rel_select(table [old], searchcondition) */
@@ -1284,6 +1287,8 @@ create_trigger(mvc *sql, dlist *qname, i
        sq = sequential_block(sql, NULL, NULL, stmts, NULL, 1);
        r = rel_psm_block(sql->sa, sq);
 
+       if (!instantiate)
+               stack_pop_frame(sql);
        /* todo trigger_columns */
        (void)columns;
        return r;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to