pg.ddx.io postgres@postgres.berkeley.edu mailing list archive
help / color / mirror / Atom feedFrom: Caroline M. Paxson <paxson@postgres.Berkeley.EDU>
To: postgres@postgres.berkeley.edu
Subject: Question
Date: Thu, 10 Jun 1993 18:00:00 -0700
Message-ID: <9306110058.AA11158@postgres.Berkeley.EDU> (raw)
You write:
I was testing a retrieve command on a class
Circle with x, and y cordinates as float8.
In retrieving an object with particular x I got this
error message
* retrieve (my_circle.all)\g
Query sent to backend is "retrieve (my_circle.all)"
- ---------------------------------------------------------
| center_y | center_x | color | radius |
- ---------------------------------------------------------
| 0 | 0 | (null) | 1 |
- ---------------------------------------------------------
| 0 | 0 | (null) | 2 |
- ---------------------------------------------------------
Go
* retrieve (my_circle.all) where my_circle.center_x = 0.0 \g
Query sent to backend is "retrieve (my_circle.all) where my_circle.center_x = 0.0 "
NOTICE:Jun 10 19:45:18:there is no operator = for types float4 and float8
NOTICE:Jun 10 19:45:18:You will either have to retype this query using an
NOTICE:Jun 10 19:45:18:explicit cast, or you will have to define the operator
WARN:Jun 10 19:45:18:= for float4 and float8 using DEFINE OPERATOR
I just tried your example and can't reproduce your problem. If,
however, I define center_x and center_y as float4's, I get the
problem. The constant 0.0 in your retrieve query is converted to
a float8 type by the parser. There is no = operator to compare
float4's and float8's. If you look at the reference manual, you
will notice that the = functions for float4 and float8 both take
two arguments of the same type. The error case occurs when a
float8 is compared to a float4.
To fix your problem, simply cast the 0.0 into the type you need:
retrieve (my_circle.all) where my_circle.center_x = 0.0::float4
Carol Paxson
paxson@cs.berkeley.edu
view thread (5+ messages)
Message-ID: <9306110058.AA11158@postgres.Berkeley.EDU>
Permalink: ../9306110058.AA11158@postgres.Berkeley.EDU/
Also on: postgresql.org/message-id/9306110058.AA11158@postgres.Berkeley.EDU
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: legacy@postgresql.org
Cc: paxson@postgres.Berkeley.EDU, postgres@postgres.berkeley.edu
Subject: Re: Question
In-Reply-To: <9306110058.AA11158@postgres.Berkeley.EDU>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox