Re: Select (str)::FLOAT8 BUG

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Rafael Villalobos Prats" <rvillalobos(at)asapci(dot)es>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Select (str)::FLOAT8 BUG
Date: 2004-02-18 16:36:17
Message-ID: 24125.1077122177@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Rafael Villalobos Prats" <rvillalobos(at)asapci(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Troppmann 2004-02-19 18:16:42 Maybe a bug found with nextval() function
Previous Message Tom Lane 2004-02-18 16:05:41 Re: zlib directory in configure.