Subject: float4's

From: [email-masked] (Dean Huxley)
Date: Wed, 16 Dec 92 04:11:51 -0800

I am having a problem with doing anything with float4's.

Here is a script:

  % monitor -q testdb
  * create floattest (num = float4)\g
  CREATE
  * append floattest (num = -1.0)\g
  WARN:Dec 15 16:24:55:unequal type in tlist : num

  * retrieve (floattest.all) where floattest.num > 0.0\g
  NOTICE:Dec 15 16:26:24:there is no operator > for types float4 and float8
  NOTICE:Dec 15 16:26:24:You will either have to retype this query using an
  NOTICE:Dec 15 16:26:24:explicit cast, or you will have to define the operator
  WARN:Dec 15 16:26:24:> for float4 and float8 using DEFINE OPERATOR
  * \q

Similar results occur when using the libpq commands.

It appears that any floating point number passed to the backend is
interpreted as a float8.  In the warning notice for the retrieve, it
mentions explicit casting.  How do I accomplish this?  I have looked
through the manual and can find no mention of casting.

It appears as if I will have to define a bunch of float84* functions
similar to the int42* functions.  Has anyone done this before?

Any help will be greatly appreciated!

Dean Huxley ([email-masked])

---

From: <[email-masked]>
Date: Wed, 16 Dec 92 10:42:40 PST

In message <[email-masked]> you write:

>   NOTICE:Dec 15 16:26:24:explicit cast, or you will have to define the operat
  +or
> through the manual and can find no mention of casting.

you can say

    * retrieve (floattest.all) where floattest.num > "0.0"::float4\g

in general, "xxxx"::typename casts the value xxxx to type typename.

					mike