Re: Select (str)::FLOAT8 BUG - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Select (str)::FLOAT8 BUG
Date
Msg-id 24125.1077122177@sss.pgh.pa.us
Whole thread Raw
In response to Select (str)::FLOAT8 BUG  ("Rafael Villalobos Prats" <rvillalobos@asapci.es>)
List pgsql-bugs
"Rafael Villalobos Prats" <rvillalobos@asapci.es> writes:
> Why is different: 'SELECT (xxxxx)::FLOAT8' than 'SELECT xxxxx::FLOAT8'

The :: operator binds more tightly than most other operators.  As Iain
replied, most of your divisions are going to be integer divisions that
discard the fractional part.  You can either add casts or add ".0" to
your numbers to cause them to be considered non-integers.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: zlib directory in configure.
Next
From: "Roopali Sharma"
Date:
Subject: pg_restore problems