BUG #2866: cast varchar to decimal failure

From: "john lyssy" <jlyssy(at)missiontitle(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2866: cast varchar to decimal failure
Date: 2006-12-26 20:00:23
Message-ID: 200612262000.kBQK0Nlx040726@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2866
Logged by: john lyssy
Email address: jlyssy(at)missiontitle(dot)com
PostgreSQL version: 8.2
Operating system: Windows XP
Description: cast varchar to decimal failure
Details:

This cast returns:ERROR: invalid input syntax for type numeric: ""
SQL state: 22P02

select string1 from adfields where
(cast (string1 as decimal (6,2)) >= 0.0) and (string1 != '' )

The cast works:
select string1 from adfields where
(string1 != '' ) and (cast (string1 as decimal (6,2)) >= 0.0)

The only thing changed is the order of where clause expressions!

Note: string1 is a varchar (50) which i am casting to decimal... e.g.
character '0' is casted to decimal 0, etc...

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-12-26 21:38:06 Re: server process exited with exit code -1073741819 on 8.2 Windows
Previous Message Tom Lane 2006-12-26 19:28:41 Re: BUG #2839: after record with NULL field, query result is wrong