Thread: Can't compare decimal columns???

Can't compare decimal columns???

From
"Brett W. McCoy"
Date:
Why isn't there a >= or <= operator defined for floating point datatypes?

As an example:

bmccoy=> select * from account where balance between 20.00 and 99.00;
ERROR:  Unable to identify an operator '>=' for types 'numeric' and 'float8'
        You will have to retype this query using an explicit cast

Is this standard?

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Experience is what you get when you were expecting something else.


Re: Can't compare decimal columns???

From
Stephan Szabo
Date:
On Sun, 14 Jan 2001, Brett W. McCoy wrote:

> Why isn't there a >= or <= operator defined for floating point datatypes?
>
> As an example:
>
> bmccoy=> select * from account where balance between 20.00 and 99.00;
> ERROR:  Unable to identify an operator '>=' for types 'numeric' and 'float8'
>         You will have to retype this query using an explicit cast

I believe there was discussion about these things on -hackers a while
back.  The type promotion and which type a constant is seen as is kind of
wierd right now.  The query will probably work with explicit typecast to
numeric for the constants.


Re: Can't compare decimal columns???

From
"Brett W. McCoy"
Date:
On Sun, 14 Jan 2001, Stephan Szabo wrote:

> I believe there was discussion about these things on -hackers a while
> back.  The type promotion and which type a constant is seen as is kind of
> wierd right now.  The query will probably work with explicit typecast to
> numeric for the constants.

Yes, I got it to work with CAST(? as NUMERIC).  Was just curious about the
operator issue.

-- Brett
                                     http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
Success is in the minds of Fools.
        -- William Wrenshaw, 1578