On Fri, Sep 4, 2009 at 11:59 AM, Kevin
Grittner<Kevin.Grittner@wicourts.gov> wrote:
> Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> I certainly don't want to have "char" emulate the misbegotten
>> decision to have explicit and implicit coercions behave differently.
>> So it looks to me like the argument to make "char" work like char(1)
>> doesn't actually help us much to decide if an error should be thrown
>> here or not. =A0On the whole, throwing an error seems better from a
>> usability perspective.
>
> I feel that the behavior of "char" in at least this case should match
> char(1) (or just plain char):
>
> test=3D# select case when true then 'xxx' else 'a'::"char" end from t;
> =A0case
> ------
> =A0x
> (1 row)
>
> test=3D# select case when true then 'xxx' else 'a'::char(1) end from t;
> =A0case
> ------
> =A0xxx
> (1 row)
>
> test=3D# select case when true then 'xxx' else 'a'::char end from t;
> =A0case
> ------
> =A0xxx
> (1 row)
>
> Much as the reason for the behavior of "char" may seem clear when
> inside the code looking out, it is astonishing for someone writing
> application code.
>
> -Kevin
Yeah, I agree. That's really confusing.
...Robert