BUG #5028: CASE returns ELSE value always when type is "char" - Mailing list pgsql-bugs

From Joseph Shraibman
Subject BUG #5028: CASE returns ELSE value always when type is "char"
Date
Msg-id 200909011636.n81GaPm6010757@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5028: CASE returns ELSE value always when type is "char"  (Sam Mason <sam@samason.me.uk>)
Re: BUG #5028: CASE returns ELSE value always when type is "char"  (Joseph Shraibman <jks@selectacast.net>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5028
Logged by:          Joseph Shraibman
Email address:      jks@selectacast.net
PostgreSQL version: 8.3.7
Operating system:   Linux
Description:        CASE returns ELSE value always when type is "char"
Details:

[local]:playpen=> SELECT version();
                                                  version

----------------------------------------------------------------------------
-------------------------------
 PostgreSQL 8.3.7 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.1.2 20080704 (Red Hat 4.1.2-44)
(1 row)

Time: 1.658 ms
[local]:playpen=>
[local]:playpen=> select c.relkind, CASE c.relkind WHEN 'r' THEN 'table'
WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's'
THEN 'special' WHEN 'c' THEN 'composite type' WHEN 't' THEN 'toast' ELSE
c.relkind
playpen->  END from (select 'r'::"char" AS relkind) c;
 relkind | relkind
---------+---------
 r       | t
(1 row)

Time: 1.407 ms
[local]:playpen=>
[local]:playpen=> select c.relkind, CASE c.relkind WHEN 'r' THEN 'table'
WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's'
THEN 'special' WHEN 'c' THEN 'composite type' WHEN 't' THEN 'toast'
playpen->  END from (select 'r'::"char" AS relkind) c;
 relkind | case
---------+-------
 r       | table
(1 row)

Time: 0.426 ms
[local]:playpen=>
[local]:playpen=>
[local]:playpen=> select c.relkind, CASE c.relkind WHEN 'r' THEN 'table'
WHEN 'v' THEN 'view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's'
THEN 'special' WHEN 'c' THEN 'composite type' WHEN 't' THEN 'toast' ELSE
c.relkind
playpen->  END from (select 'r'::char AS relkind) c;
 relkind | relkind
---------+---------
 r       | table
(1 row)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.
Next
From: Merlin Moncure
Date:
Subject: Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.