Re: chr(3) and 3::text

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: chr(3) and 3::text
Дата
Msg-id 5568.1585411346@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: chr(3) and 3::text  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-novice
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Sat, Mar 28, 2020 at 8:09 AM gmail Vladimir Koković <
> vladimir.kokovic@gmail.com> wrote:
>> Main question is, why is 3::text == '3' ?

> Its that way because :: is defined to make it that way.

More concretely: for most types, casting to text is defined to produce the
textual representation of the value.  An unadorned literal 3 starts life
as type integer, so what you've got here is an integer-to-text cast,
and that's going to convert the integer the same way it would be output.

            regards, tom lane



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

Предыдущее
От: gmail Vladimir Koković
Дата:
Сообщение: Re: chr(3) and 3::text
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: chr(3) and 3::text