Changeset: 3a64dad1c21a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3a64dad1c21a
Modified Files:
        sql/server/rel_updates.c
        sql/test/sciql/Tests/04_insert_01.stable.out
        sql/test/sciql/Tests/All
Branch: sciql
Log Message:

Fix SQL plan generation for some INSERT INTO ary queries
This should fix the problem that some INSERT INTO queries do not have effect.

rel_updates.c: for each insert expression (ins->exps->...), if it is not a NULL
(indicating a column not being inserted), we rename it with a Label.  Then we
join the resulting colum (eNew) with the original column (eOld) from the
table/array.

Approved stable.out due to changes in the testing query.

All: enable a test query that now runs and add reasons to some test queries why
they are disabled.


diffs (54 lines):

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
@@ -339,14 +339,10 @@ rel_insert_array(mvc *sql, sql_table *t,
                sql_column *c = m->data; /* column from base array */
                sql_exp *eOld = NULL, *eNew = NULL, *e = n->data; /* column exp 
in INSERT stmt */
 
-               if(!exp_relname(e))
+               if (!(e->type == e_atom && (e->l && ((atom*)e->l)->isnull))) {
                        exp_label(sql->sa, e, ++sql->label);
-               if (!(e->type == e_atom && !e->name && ((atom*)e->l)->isnull)) {
-                       eOld = exp_column(sql->sa, c->t->base.name, 
c->base.name, &c->type, CARD_MULTI, 0, 0);
-                       eNew = exp_column(sql->sa, exp_relname(e), exp_name(e), 
exp_subtype(e), ins->card, has_nil(e), is_intern(e));
-                       if(!exp_relname(eNew))
-                               exp_label(sql->sa, eNew, ++sql->label);
-
+                       eOld = exp_column(sql->sa, c->t->base.name, 
c->base.name, &c->type, CARD_MULTI, c->null, 0);
+                       eNew = exp_column(sql->sa, NULL, exp_name(e), 
exp_subtype(e), ins->card, has_nil(e), is_intern(e));
                        if (c->dim) {
                                rel_join_add_exp(sql->sa, jn, 
exp_compare(sql->sa, eOld, eNew, cmp_equal));
                        } else {
diff --git a/sql/test/sciql/Tests/04_insert_01.stable.out 
b/sql/test/sciql/Tests/04_insert_01.stable.out
--- a/sql/test/sciql/Tests/04_insert_01.stable.out
+++ b/sql/test/sciql/Tests/04_insert_01.stable.out
@@ -71,8 +71,8 @@ Ready.
 [ 3,   3,      600     ]
 #INSERT INTO matrix SELECT x-1, y, v FROM matrix WHERE x > 2;
 [ 4    ]
-#SELECT * FROM matrix;
-% sys.matrix,  sys.matrix,     sys.matrix # table_name
+#SELECT * FROM matrix_0401;
+% sys.matrix_0401,     sys.matrix_0401,        sys.matrix_0401 # table_name
 % x,   y,      v # name
 % int, int,    double # type
 % 1,   1,      24 # length
diff --git a/sql/test/sciql/Tests/All b/sql/test/sciql/Tests/All
--- a/sql/test/sciql/Tests/All
+++ b/sql/test/sciql/Tests/All
@@ -36,11 +36,11 @@ 02_update_01
 
 03_delete_01
 
-#04_insert_01
+04_insert_01
 04_insert_02
-#04_insert_03
-#04_insert_04
-#04_insert_05
+#04_insert_03 # check in column DEFAULT not implemented yet.
+#04_insert_04 # check in column DEFAULT not implemented yet.
+#04_insert_05 # dimensions of type timestamp not implemented yet.
 04_insert_06
 04_insert_07
 
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to