"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