Changeset: 8c7fdd4c286f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8c7fdd4c286f
Modified Files:
        sql/src/server/rel_select.mx
Branch: Jun2010
Log Message:

fixed problem in binary function resolution.
We now
        first check for full types
        then oo version (first arg should match) (with but not for numeric 
values)
        then both args are upcasted to a single super type, then function 
resolution
        then again the oo version (but now for numeric values)
        last resort is a lookup just on function name, and after the function 
is found
        convert the types


diffs (40 lines):

diff -r c6c48b0fd781 -r 8c7fdd4c286f sql/src/server/rel_select.mx
--- a/sql/src/server/rel_select.mx      Wed Aug 11 19:02:02 2010 +0200
+++ b/sql/src/server/rel_select.mx      Wed Aug 11 19:04:39 2010 +0200
@@ -3193,6 +3193,36 @@
                r = or;
                ol = exp_dup(l);
                or = exp_dup(r);
+               t1 = exp_subtype(l);
+               t2 = exp_subtype(r);
+
+               if ((f = sql_bind_member(s, fname, t1, 2)) != NULL &&
+                  (table_func || !f->res.comp_type)) {
+                       /* try finding function based on first argument */
+                       node *m = f->func->ops->h;
+                       sql_arg *a = m->data;
+
+                       l = rel_check_type(sql, &a->type, l, type_equal);
+                       a = m->next->data;
+                       r = rel_check_type(sql, &a->type, r, type_equal);
+                       if (l && r) {
+                               exp_destroy(ol);
+                               exp_destroy(or);
+                               return exp_binop(l, r, f);
+                       }
+               }
+               /* reset error */
+               sql->session->status = 0;
+               sql->errstr[0] = '\0';
+
+               if (l)
+                       exp_destroy(l);
+               if (r)
+                       exp_destroy(r);
+               l = ol;
+               r = or;
+               ol = exp_dup(l);
+               or = exp_dup(r);
 
                /* everything failed, fall back to bind on function name only */
                if ((f = sql_find_func(s, fname, 2)) != NULL &&
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to