From: | "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> |
Cc: | <pgsql-bugs(at)postgresql(dot)org>,"Sam Mason" <sam(at)samason(dot)me(dot)uk> |
Subject: | Re: BUG #5028: CASE returns ELSE value always when type is"char" |
Date: | 2009-09-02 18:21:18 |
Message-ID: | 4A9E714E020000250002A8E8@gw.wicourts.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> A simple, self-contained example derived from the OP:
>
> test=# create table t (c "char");
> CREATE TABLE
> test=# insert into t values ('a');
> INSERT 0 1
> test=# select case when c = 'a' then 'Hey' else c end from t;
> c
> ---
> H
> (1 row)
>
> test=# select case when c = 'a' then 'Hey'::text else c end from t;
> c
> -----
> Hey
> (1 row)
And I'm not even sure how I'd explain the rules to someone. (I guess
that's because I don't understand them, really, but the other way
sounds better....)
test=# drop table t;
DROP TABLE
test=# create table t (c varchar(2));
CREATE TABLE
test=# insert into t values ('a');
INSERT 0 1
test=# select case when c = 'a' then 'Hey' else c end from t;
c
-----
Hey
(1 row)
test=# select case when c = 'a' then 'Hey'::text else c end from t;
c
-----
Hey
(1 row)
-Kevin
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2009-09-02 18:27:35 | Re: BUG #5028: CASE returns ELSE value always when type is"char" |
Previous Message | Sam Mason | 2009-09-02 18:18:53 | Re: BUG #5028: CASE returns ELSE value always when type is"char" |