Changeset: efe5b9e9ef51 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=efe5b9e9ef51
Modified Files:
        sql/server/rel_optimizer.c
Branch: Mar2018
Log Message:

fixes for bug 6576


diffs (26 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -2832,16 +2832,22 @@ exp_simplify_math( mvc *sql, sql_exp *e,
                if (!f->func->s && !strcmp(f->func->base.name, "sql_mul") && 
list_length(l) == 2) {
                        sql_exp *le = l->h->data;
                        sql_exp *re = l->h->next->data;
+                       sql_subtype *et = exp_subtype(e);
+
                        /* 0*a = 0 */
                        if (exp_is_atom(le) && exp_is_zero(sql, le) && 
exp_is_atom(re) && exp_is_not_null(sql, re)) {
                                (*changes)++;
                                exp_setname(sql->sa, le, exp_relname(e), 
exp_name(e));
+                               if (subtype_cmp(et, exp_subtype(le)) != 0)
+                                       le = exp_convert(sql->sa, le, 
exp_subtype(le), et);
                                return le;
                        }
                        /* a*0 = 0 */
                        if (exp_is_atom(re) && exp_is_zero(sql, re) && 
exp_is_atom(le) && exp_is_not_null(sql, le)) {
                                (*changes)++;
                                exp_setname(sql->sa, re, exp_relname(e), 
exp_name(e));
+                               if (subtype_cmp(et, exp_subtype(re)) != 0)
+                                       re = exp_convert(sql->sa, re, 
exp_subtype(re), et);
                                return re;
                        }
                        /* 1*a = a
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to