BUG #5028: CASE returns ELSE value always when type is "char"

From: "Joseph Shraibman" <jks(at)selectacast(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5028: CASE returns ELSE value always when type is "char"
Date: 2009-09-01 16:36:25
Message-ID: 200909011636.n81GaPm6010757@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5028
Logged by: Joseph Shraibman
Email address: jks(at)selectacast(dot)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)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Merlin Moncure 2009-09-01 16:39:50 Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.
Previous Message Tom Lane 2009-09-01 15:06:35 Re: BUG #5025: Aggregate function with subquery in 8.3 and 8.4.