My guess would be... 

1000/5000/7::FLOAT8 is really 1000::INT/500::INT/7::FLOAT8 (int may be some other 
integer type) whereas (1000/500/7)::FLOAT8 is (1000::INT/500::INT/7::INT)::FLOAT8 i.e. 
the resultan integer is casted to type FLOAT8 after the maths has been done on 
integers. Thats what I'd expect.


Iain


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Rafael Villalobos
> Prats
> Sent: Wednesday, February 18, 2004 3:38 PM
> To: [EMAIL PROTECTED]
> Subject: [BUGS] Select (str)::FLOAT8 BUG
> 
> 
> Hi!,
> 
> I think i have found a bug.
> 
> I´ve tried it in PgSQL 7.3.5 & 7.4.1
> 
> When I do:
> 
> atisae_oct_1=# SELECT (1000/500/7)::FLOAT8 as v_numero;
>  v_numero
> ----------
>         0
> (1 row)
> 
> atisae_oct_1=# SELECT 1000/500/7::FLOAT8 as v_numero;
>      v_numero
> -------------------
>  0.285714285714286
> (1 row)
> 
> atisae_oct_1=# SELECT (1000/500/7)::NUMERIC as v_numero;
>  v_numero
> ----------
>         0
> (1 row)
> 
> atisae_oct_1=# SELECT 1000/500/7::NUMERIC as v_numero;
>         v_numero
> ------------------------
>  0.28571428571428571429
> (1 row)
> 
> 
> Why is different: 'SELECT (xxxxx)::FLOAT8' than 'SELECT xxxxx::FLOAT8'
> 
> Thanks in advance...
> 
> Rafa.
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to