Re: Correction: Working on "SELECT * WHERE numeric_col = 2001.2" problem?

From: J Smith <dark_panda(at)hushmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Correction: Working on "SELECT * WHERE numeric_col = 2001.2" problem?
Date: 2001-12-14 18:56:10
Message-ID: 9vdi7t$iq6$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


That sort of query works fine on my install, Pg 7.2b3. If you're having
problems with the conversion, you could try using the round function on the
float to get it down to zero decimal places thusly:

select * from whatever where numeric_col = round(2001.2);

or you would try casting numeric_col like so:

select * from whatever where numeric_col::float = 2001.1;

J

Bob Jones wrote:

> I would like to correct a misprint on my original post. Earlier I stated:
>
> ... an error stating that the '-' operator is unidentified for numeric and
> float8 types....
>
> The "unidentified operator" should be the "=" operator (as shown correctly
> in the SQL query example of my original post), not the "-" operator as
> previously mentioned.
>
> My apologies,
> Bob

In response to

Browse pgsql-general by date

  From Date Subject
Next Message colm ennis 2001-12-14 19:54:21 Re: slow queries on large syslog table
Previous Message Francisco Reyes 2001-12-14 18:39:15 Re: How to increase shared mem for PostgreSQL on FreeBSD