Re: Wrong output for 7.0.3 from NULL fields in CASE statement - Mailing list pgsql-bugs

From Thomas Lockhart
Subject Re: Wrong output for 7.0.3 from NULL fields in CASE statement
Date
Msg-id 3A9DF334.4664859D@alumni.caltech.edu
Whole thread Raw
In response to Wrong output for 7.0.3 from NULL fields in CASE statement  (pgsql-bugs@postgresql.org)
List pgsql-bugs
> I am getting output that doesn't make sense from a simple SQL statement.
> I am expecting to get a '0'::text returned by this statement, but
> instead I'm getting very, very small numbers, or other weird things.
> It's a catch for NULL values and isn't interpreting them correctly when
> it gets them.

For a float8 field "d", I can reproduce this with a slightly simpler
case:

lockhart=# select case when (d = null) then 0 else d end from t1;
 text
------
 0
(1 row)

lockhart=# select case when (d = null) then '0' else d end from t1;
         text
-----------------------
 1.11784577978351e+253
(1 row)

I haven't tracked it down, but I'll guess that the automatic type
conversion logic is getting confused with the stringy form of zero.

I do not see the symptom in the current development tree.

                    - Thomas

pgsql-bugs by date:

Previous
From: Justin Clift
Date:
Subject: Oops... sorry about that
Next
From: Nat Howard
Date:
Subject: jdbc1 compile problem still present in beta5 (java 1.1.8/freebsd 4.2-STABLE)