Re: [HACKERS] case bug?

From: Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)uk>
To: hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] case bug?
Date: 1999-09-18 16:39:46
Message-ID: 199909181639.RAA28704@mtcc.demon.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
>
>Following case statement is legal but fails in 6.5.1.
>
>drop table t1;
>DROP
>create table t1(i int);
>CREATE
>insert into t1 values(-1);
>INSERT 4047465 1
>insert into t1 values(0);
>INSERT 4047466 1
>insert into t1 values(1);
>INSERT 4047467 1
>
>select i,
> case
> when i < 0 then 'minus'
> when i = 0 then 'zero'
> when i > 0 then 'plus'
> else null
> end
>from t1;
>ERROR: Unable to locate type oid 0 in catalog

I'd kept this as an example of case usage and tried it on
the latest source, where it worked fine.

Then I tried inserting a NULL into the table, which the
case statement then treated as 0 and not null.

insert into t1 values(null);
INSERT 150412 1
select i,
case
when i < 0 then 'minus'
when i = 0 then 'zero'
when i > 0 then 'plus'
else null
end
from t1;
i|case
--+-----
-1|minus
0|zero
1|plus
|zero
(4 rows)

Was this discussed?

Keith.

Browse pgsql-hackers by date

  From Date Subject
Next Message Adriaan Joubert 1999-09-18 17:20:37 Patches for alpha w. cc
Previous Message Ryan Kirkpatrick 1999-09-18 16:11:44 Linux/Alpha patches for Postgresql 6.5.2