Tom:
> One way to address this is to never allow Postgres to "demote" a type;
> i.e. Postgres would be allowed to promote arguments to a "higher" type
> (e.g. int->float) but never allowed to demote arguments (e.g.
> float->int). But this would severely restrict type matching. I wanted to
> try the more flexible case first to see whether it really does the
> "wrong thing"; in the case of factorial, the only recourse for someone
> wanting to calculate a factorial from a float is to convert to an int
> first anyway.
I think that never demoting is the best way to procede here. If the type
resolution search is too "thorough" it can be very confusing (see c++ for
example). As it is the interaction of SQL and the type system can create
surprises. Promoting both "up" and "down" is likely to make it very hard
to figure out what any given query will do.
-dg
David Gould dg@illustra.com 510.628.3783 or 510.305.9468
Informix Software (No, really) 300 Lakeside Drive Oakland, CA 94612
"Of course, someone who knows more about this will correct me if I'm wrong,
and someone who knows less will correct me if I'm right."
--David Palmer (palmer@tybalt.caltech.edu)