Subject: negative floats

From: John Peter Lee <[email-masked]>
Date: Thu, 18 Nov 1993 15:13:18 -0500 (EST)

Hi:

   I've noticed what could amount to be a big problem in Postgres 4.0.1,
   as I indicated in an earlier posting. This session should make it
   clear what the problem is:

Welcome to the C POSTGRES terminal monitor

Go 
* create foo (name = text, val = float4)\g

Query sent to backend is "create foo (name = text, val = float4)"
CREATE
Go 
* append foo(name = "jp", val = 1.0)\g

Query sent to backend is "append foo(name = "jp", val = 1.0)"
APPEND 152686
Go 
* append foo(name = "dave", val = -1.0)\g

Query sent to backend is "append foo(name = "dave", val = -1.0)"
WARN:Nov 18 15:05:54:unequal type in tlist : val 

It seems that Postgres cannot handle negative floating point numbers.
Is this true, and is it fixed in 4.1 (or in 5.0), or how can we fix
it ourselves? This is a very important part of the application that uses 
Postgres .

Please help.

thanks,

jp

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JP Lee               Institute for Visualization and Perception Research	
[email-masked]                    University of Massachusetts at Lowell 
(508) 934-3384			      1 University Ave. Lowell, MA 01854

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---

From: Jolly Chen <[email-masked]>
Date: Thu, 18 Nov 93 12:39:29 -0800

> it ourselves? This is a very important part of the application that uses 

Postgres does handle negative floating point numbers, but our parser
doesn't handle negative floating point constants very well.  To get
around your problem, use double-quotes around your constant.  For
example,

* append foo(name = "dave", val = "-1.0")\g

It wouldn't hurt to cast it to the right type, either, and you should
definitely explictly cast any constants of user-defined types. 

- Jolly Chen