Re: Inconsistent cast to "char"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Inconsistent cast to "char"
Дата
Msg-id 2120116.1638473263@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Inconsistent cast to "char"  ("Ian R. Campbell" <ian.campbell@thepathcentral.com>)
Ответы Re: Inconsistent cast to "char"  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
"Ian R. Campbell" <ian.campbell@thepathcentral.com> writes:
> It makes sense that "char" is not part of the string family. After all,
> "char" != char.

If it allowed more than one byte, maybe you could call it a "string",
but it seems hard to justify without that.

> In the scenarios I give, one would expect the same output for all integer
> width casting inputs, so you have my vote on the change you suggested.

To be clear, the change I'm thinking of would result in errors, not in
silently applying the int4 cast.  As a quick-n-dirty test:

regression=# update pg_type set typcategory = 'x' where typname = 'char';
UPDATE 1
regression=# select 1::int8::"char", 1::int4::"char", 1::int2::"char";
ERROR:  cannot cast type bigint to "char"
LINE 1: select 1::int8::"char", 1::int4::"char", 1::int2::"char";
                      ^

            regards, tom lane



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #17305: to_timestamp accept dates rejected by timestamptz cast
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Inconsistent cast to "char"