Re: Weird type selection choice

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Weird type selection choice
Date: 2007-11-06 15:50:08
Message-ID: 200711061650.09188.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Am Dienstag, 6. November 2007 schrieb Peter Eisentraut:
> I noticed this problem in 8.2 and 8.3:
>
> pei=# select mod( trunc( 1 ), 2 );
> ERROR: 42883: function mod(double precision, integer) does not exist
> LINE 1: select mod( trunc( 1 ), 2 );
> ^
>
> 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.

Well, duh, of course we can't disallow casting integer to float. But can we
make it prefer numeric as a target if available?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-11-06 16:01:13 Re: Weird type selection choice
Previous Message Bernd Helmle 2007-11-06 15:44:16 Re: Weird type selection choice