Re: Select (str)::FLOAT8 BUG

From: "Rafael Villalobos Prats" <rvillalobos(at)asapci(dot)es>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Select (str)::FLOAT8 BUG
Date: 2004-02-18 15:59:32
Message-ID: DAE20F19E91DDA47B74F76B7BC07C243211DB4@server01.asapci.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ok, that's right.

Many thanks....

Rafa-.

-----Mensaje original-----
De: pgsql-bugs-owner(at)postgresql(dot)org
[mailto:pgsql-bugs-owner(at)postgresql(dot)org] En nombre de Fothergill, Iain
Enviado el: miércoles, 18 de febrero de 2004 16:31
Para: pgsql-bugs(at)postgresql(dot)org
Asunto: Re: [BUGS] Select (str)::FLOAT8 BUG

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: pgsql-bugs-owner(at)postgresql(dot)org
> [mailto:pgsql-bugs-owner(at)postgresql(dot)org]On Behalf Of Rafael Villalobos
> Prats
> Sent: Wednesday, February 18, 2004 3:38 PM
> To: pgsql-bugs(at)postgresql(dot)org
> 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 majordomo(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

Attachment Content-Type Size
winmail.dat application/ms-tnef 3.1 KB

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-02-18 16:05:41 Re: zlib directory in configure.
Previous Message Rafael Villalobos Prats 2004-02-18 15:37:44 Select (str)::FLOAT8 BUG