Changeset: dfa255198028 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dfa255198028
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/server/rel_updates.c
Branch: Jan2022
Log Message:

merged wit jul2021


diffs (94 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
@@ -4294,7 +4294,7 @@ rel2bin_insert(backend *be, sql_rel *rel
 
        if (t->idxs) {
                idx_m = m;
-               for (n = ol_first_node(t->idxs); n && m; n = n->next) {
+               for (n = ol_first_node(t->idxs); n && m; n = n->next, m = 
m->next) {
                        stmt *is = m->data;
                        sql_idx *i = n->data;
 
@@ -4309,27 +4309,26 @@ rel2bin_insert(backend *be, sql_rel *rel
                        }
                        if (!insert)
                                insert = is;
-                       /* If the index doesn't hold delta structures, don't 
update the 'm' variable */
-                       m = m->next;
-               }
+               }
+               assert(!n && !m);
        }
 
        if (t->s) /* only not declared tables, need this */
                pos = stmt_claim(be, t, cnt);
 
-       if (t->idxs)
-       for (n = ol_first_node(t->idxs), m = idx_m; n && m; n = n->next) {
-               stmt *is = m->data;
-               sql_idx *i = n->data;
-
-               if (non_updatable_index(i->type)) /* Some indexes don't hold 
delta structures */
-                       continue;
-               if (hash_index(i->type) && list_length(i->columns) <= 1)
-                       is = NULL;
-               if (is)
-                       is = stmt_append_idx(be, i, pos, is);
-               /* If the index doesn't hold delta structures, don't update the 
'm' variable */
-               m = m->next;
+       if (t->idxs) {
+               for (n = ol_first_node(t->idxs), m = idx_m; n && m; n = 
n->next, m = m->next) {
+                       stmt *is = m->data;
+                       sql_idx *i = n->data;
+
+                       if (non_updatable_index(i->type)) /* Some indexes don't 
hold delta structures */
+                               continue;
+                       if (hash_index(i->type) && list_length(i->columns) <= 1)
+                               is = NULL;
+                       if (is)
+                               is = stmt_append_idx(be, i, pos, is);
+               }
+               assert(!n && !m);
        }
 
        int mvc_var = be->mvc_var;
diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c
--- a/sql/server/rel_updates.c
+++ b/sql/server/rel_updates.c
@@ -93,7 +93,7 @@ rel_insert_hash_idx(mvc *sql, const char
        sql_rel *ins = inserts->r;
 
        assert(is_project(ins->op) || ins->op == op_table);
-       if (list_length(i->columns) <= 1 || i->type == no_idx) {
+       if (list_length(i->columns) <= 1 || non_updatable_index(i->type)) {
                /* dummy append */
                inserts->r = ins = rel_project(sql->sa, ins, 
rel_projections(sql, ins, NULL, 1, 1));
                list_append(ins->exps, exp_label(sql->sa, exp_atom_lng(sql->sa, 
0), ++sql->label));
@@ -243,7 +243,7 @@ rel_insert_idxs(mvc *sql, sql_table *t, 
        for (node *n = ol_first_node(t->idxs); n; n = n->next) {
                sql_idx *i = n->data;
 
-               if (hash_index(i->type) || i->type == no_idx) {
+               if (hash_index(i->type) || non_updatable_index(i->type)) {
                        rel_insert_hash_idx(sql, alias, i, inserts);
                } else if (i->type == join_idx) {
                        rel_insert_join_idx(sql, alias, i, inserts);
@@ -691,7 +691,7 @@ rel_update_hash_idx(mvc *sql, const char
        sql_rel *ups = updates->r;
 
        assert(is_project(ups->op) || ups->op == op_table);
-       if (list_length(i->columns) <= 1 || i->type == no_idx) {
+       if (list_length(i->columns) <= 1 || non_updatable_index(i->type)) {
                h = exp_label(sql->sa, exp_atom_lng(sql->sa, 0), ++sql->label);
        } else {
                it = sql_bind_localtype("int");
@@ -889,7 +889,7 @@ rel_update_idxs(mvc *sql, const char *al
                 * Ie todo check for new indices.
                 */
 
-               if (hash_index(i->type) || i->type == no_idx) {
+               if (hash_index(i->type) || non_updatable_index(i->type)) {
                        rel_update_hash_idx(sql, alias, i, relup);
                } else if (i->type == join_idx) {
                        rel_update_join_idx(sql, alias, i, relup);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to