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

From Tom Lane
Subject Re: Wrong output for 7.0.3 from NULL fields in CASE statement
Date
Msg-id 20287.983426186@sss.pgh.pa.us
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
pgsql-bugs@postgresql.org writes:
> foobar=# select text(CASE WHEN (cashback = NULL or cashback = 0) THEN '0' ELSE cashback END) from
transaction_paymentswhere idnum = 139 and payment_type = 6; 
>          text
> -----------------------
>  1.01855797968803e-312
> (1 row)

Try not quoting the '0'.  For reasons that I don't recall at the moment,
7.0 has a problem coercing unknown-type literals to the proper datatype
in CASE expressions.  It seems to work OK in 7.1 though.

            regards, tom lane

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Wrong output for 7.0.3 from NULL fields in CASE statement
Next
From: Justin Clift
Date:
Subject: Oops... sorry about that