Re: [HACKERS] Weird type selection choice

2007-11-07 Thread Alvaro Herrera
Peter Eisentraut wrote: > Am Mittwoch, 7. November 2007 schrieb Heikki Linnakangas: > > Peter Eisentraut wrote: > > > I wrote: > > >> 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

Re: [HACKERS] Weird type selection choice

2007-11-07 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Am Mittwoch, 7. November 2007 schrieb Heikki Linnakangas: >> Why would you run a query like that in the first place? It seems like a >> useless query as it is. Is there a bigger story behind it? > The "1" is substituted from somewhere else. Seems lik

Re: [HACKERS] Weird type selection choice

2007-11-07 Thread Peter Eisentraut
Am Mittwoch, 7. November 2007 schrieb Heikki Linnakangas: > Peter Eisentraut wrote: > > I wrote: > >> 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

Re: [HACKERS] Weird type selection choice

2007-11-07 Thread Heikki Linnakangas
Peter Eisentraut wrote: I wrote: 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 ); ^ I suppose there will be little interest in including the obvio

Re: [HACKERS] Weird type selection choice

2007-11-07 Thread Peter Eisentraut
I wrote: > 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 ); >^ I suppose there will be little interest in including the obvious solution, nam

Re: [HACKERS] Weird type selection choice

2007-11-06 Thread Gregory Stark
"Peter Eisentraut" <[EMAIL PROTECTED]> writes: > The clarity stems from the fact that this is the variant that doesn't > lose data whereas the other one does. I think double has a wider range. So you get a choice between losing precision or not being able to store all values. > The expression

Re: [HACKERS] Weird type selection choice

2007-11-06 Thread Peter Eisentraut
Tom Lane wrote: > 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

Re: [HACKERS] Weird type selection choice

2007-11-06 Thread Tom Lane
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. Clearl

Re: [HACKERS] Weird type selection choice

2007-11-06 Thread Peter Eisentraut
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

Re: [HACKERS] Weird type selection choice

2007-11-06 Thread Bernd Helmle
--On Dienstag, November 06, 2007 16:31:05 +0100 Peter Eisentraut <[EMAIL PROTECTED]> wrote: 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

[HACKERS] Weird type selection choice

2007-11-06 Thread 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(n