From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | gmail Vladimir Koković <vladimir(dot)kokovic(at)gmail(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>, Ken Benson <Ken(at)infowerks(dot)com> |
Subject: | Re: chr(3) and 3::text |
Date: | 2020-03-28 16:02:26 |
Message-ID: | 5568.1585411346@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Sat, Mar 28, 2020 at 8:09 AM gmail Vladimir Koković <
> vladimir(dot)kokovic(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2020-03-28 16:02:41 | Re: chr(3) and 3::text |
Previous Message | gmail Vladimir Koković | 2020-03-28 15:39:51 | Re: chr(3) and 3::text |