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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: aa2@bigpond.net.au, pgsql-bugs@postgresql.org
Date: 2001-03-01T05:56:26Z
Lists: pgsql-bugs
pgsql-bugs@postgresql.org writes:
> foobar=# select text(CASE WHEN (cashback = NULL or cashback = 0) THEN '0' ELSE cashback END) from transaction_payments where 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