Update of /cvsroot/monetdb/sql/src/common
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27679/src/common

Modified Files:
        sql_types.mx 
Log Message:
sql_bind_func_result also needed handling of ANY types
(in the sql optimizer we look for min and max (t,t) -> t,
which didn't work after the introduction of the ANY types)


Index: sql_types.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/common/sql_types.mx,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- sql_types.mx        4 May 2007 14:24:15 -0000       1.86
+++ sql_types.mx        22 May 2007 20:23:44 -0000      1.87
@@ -855,7 +855,7 @@
 
                if (!f->res.type)
                        continue;
-               if (strcmp(f->base.name, name) == 0 && is_subtype(&f->res, res) 
&& list_cmp(f->ops, ops, (fcmp) &arg_subtype_cmp) == 0) {
+               if (strcmp(f->base.name, name) == 0 && (is_subtype(&f->res, 
res) || f->res.type->eclass == EC_ANY) && list_cmp(f->ops, ops, (fcmp) 
&arg_subtype_cmp) == 0) {
                        unsigned int scale = 0;
                        sql_subfunc *fres = NEW(sql_subfunc);
 
@@ -869,9 +869,22 @@
                                if (a && a->scale > scale)
                                        scale = a->scale;
                        }
-                       sql_init_subtype(&fres->res, f->res.type, 
f->res.digits, scale);
-                       if (f->res.comp_type) 
-                               fres->res.comp_type = f->res.comp_type;
+                       /* same type as the first input */
+                       if (f->res.type->eclass == EC_ANY) {
+                               node *m;
+                               sql_subtype *a = NULL;
+                               for (n = ops->h, m = f->ops->h; n; n = n->next, 
m = m->next) {
+                                       sql_arg *s = m->data;
+                                       if (s->type.type->eclass == EC_ANY) {
+                                               a = n->data;
+                                       }
+                               }
+                               sql_init_subtype(&fres->res, a->type, 
f->res.digits, scale);
+                       } else {
+                               sql_init_subtype(&fres->res, f->res.type, 
f->res.digits, scale);
+                               if (f->res.comp_type) 
+                                       fres->res.comp_type = f->res.comp_type;
+                       }
                        return fres;
                }
                n = n->next;


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to