Re: [General] Unable to identify an operator '=' for types 'numeric' and 'double precision' You will have to retype this query using and explicit cast - Mailing list pgsql-general

From Edmund Lim Chi Chung
Subject Re: [General] Unable to identify an operator '=' for types 'numeric' and 'double precision' You will have to retype this query using and explicit cast
Date
Msg-id 1015894694.3c8d52a6927d6@www.swopt.com
Whole thread Raw
In response to [General] Unable to identify an operator '=' for types 'numeric' and 'double precision' You will have to retype this query using and explicit cast  (Edmund Lim Chi Chung <edmund@swopt.com>)
List pgsql-general
引言 Andrew Sullivan <andrew@libertyrms.info>:

> On Mon, Mar 11, 2002 at 11:45:07AM +0800, Edmund Lim Chi Chung wrote:
> >
> > CREATE TABLE testdecimal ( decimal_value DECIMAL(6,2));
> > INSERT INTO testdecimal VALUES(1.0);
> > INSERT INTO testdecimal VALUES(1.1);
> > SELECT * FROM testdecimal WHERE decimal_value = 1.0;
> >
> > Error : Unable to identify an operator '=' for types 'numeric' and
> 'double
> > precision'
> >         You will have to retype this query using and explicit cast
>
> You'll need to recast, like it says.  Try
>
>     SELECT * FROM testdecimal WHERE decimal_value = 1.0::decimal;
>
> A
>
> --
> ----
> Andrew Sullivan                               87 Mowat Avenue
> Liberty RMS                           Toronto, Ontario Canada
> <andrew@libertyrms.info>                              M6K 3E3
>                                          +1 416 646 3304 x110
>
>


Found two more method:
      SELECT * FROM testdecimal WHERE decimal_value = '1.0';

      SELECT * FROM testdecimal WHERE decimal_value = CAST( 1.0 AS decimal );

pgsql-general by date:

Previous
From: "Peter Darley"
Date:
Subject: Re: Stale temp tables
Next
From: Tom Lane
Date:
Subject: Re: Stale temp tables