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

From: Edmund Lim Chi Chung <edmund(at)swopt(dot)com>
To: Andrew Sullivan <andrew(at)libertyrms(dot)info>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
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: 2002-03-12 00:58:14
Message-ID: 1015894694.3c8d52a6927d6@www.swopt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

引言 Andrew Sullivan <andrew(at)libertyrms(dot)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(at)libertyrms(dot)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 );

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-03-12 01:42:48 Re: Stale temp tables
Previous Message Peter Darley 2002-03-12 00:49:08 Re: Stale temp tables