Re: Wrong output for 7.0.3 from NULL fields in CASE statement

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: aa2(at)bigpond(dot)net(dot)au, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Wrong output for 7.0.3 from NULL fields in CASE statement
Date: 2001-03-01 06:59:00
Message-ID: 3A9DF334.4664859D@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Olivier PRENANT 2001-03-01 12:00:57 Re: Re: int8 beta5 broken?
Previous Message Justin Clift 2001-03-01 06:42:45 Oops... sorry about that