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

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: BUG #5028: CASE returns ELSE value always when type is"char"
Дата
Msg-id 4A9E7950020000250002A92C@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: BUG #5028: CASE returns ELSE value always when type is"char"  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #5028: CASE returns ELSE value always when type is"char"  (Sam Mason <sam@samason.me.uk>)
Список pgsql-bugs
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>> And I'm not even sure how I'd explain the rules to someone.
>
> text is preferred to "char" which is preferred to unknown.
>
> This particular example would be less confusing if 'Hey'::"char"
> threw an error, but that behavior is the result of an ancient
> (bad?) decision in the input function of one legacy datatype.
> It's not, IMNSHO, evidence of an overall failure of the type system
> as a whole.

So the behavior of the "char" type is anomalous in this regard?  Other
character-based types behave like varchar (which has the behavior I
would expect here)?  That is encouraging.  Why isn't the behavior of
"char" in this regard considered a bug to be fixed?

I'm not sure I'm exactly understanding why the varchar(2) worked,
though.  Perhaps it would be more clear if I grasped why *that* one
does what I would think is the right thing.  At this point my first
guess would be that it discards the length for a varchar, and just
treats it as text (or some other "neutral" character-based type).  If
so, perhaps "char" should do the same?

-Kevin

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5028: CASE returns ELSE value always when type is"char"
Следующее
От: Sam Mason
Дата:
Сообщение: Re: BUG #5028: CASE returns ELSE value always when type is"char"