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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 05:56:26
Message-ID: 20287.983426186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

pgsql-bugs(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Justin Clift 2001-03-01 06:42:45 Oops... sorry about that
Previous Message pgsql-bugs 2001-03-01 04:48:18 Wrong output for 7.0.3 from NULL fields in CASE statement