Re: chr(3) and 3::text

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

David,

Sorry for copy/paste error:replace(Filler,3::text,'') WRONG !

Character 0x03 is valid in ASCII and UTF-8 character sets.

Main question is, why is 3::text == '3' ?

The convention here is to bottom or inline post, trimming unnecessary content.

Its that way because :: is defined to make it that way. 
 
3 has a type of integer
'3' has a type of text
::<type> is the PostgreSQL type casting operator that casts its left to to <type> (see the documentation I linked to)

So:

integer::text == text

cast(integer as text) == text

is the SQL Standard equivalent expression

David J.

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

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