Peter Eisentraut <[EMAIL PROTECTED]> writes:
> It apparently casts the 1 to double precision to pick the variant
> trunc(dp)=>dp instead of trunc(numeric)=>numeric.  I was under the impression
> that we didn't want to cast integers to float types implicitly because this
> loses information.  Clearly, the numeric variant should be preferred anyway.

There's nothing "clear" about that at all.  float8 is the preferred type
in the numeric category, so preferring trunc(dp) over trunc(numeric) is
exactly what I'd expect to happen.  This is not something that can be
readily changed, because if we made numeric the preferred type we'd be
violating the SQL spec.  The result of, for example, float8 + numeric
has to be float8:

         2) If the declared type of either operand of a dyadic arithmetic
            operator is approximate numeric, then the declared type of the
            result is approximate numeric.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to