Re: chr(3) and 3::text

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: gmail Vladimir Koković <vladimir(dot)kokovic(at)gmail(dot)com>
Cc: 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:41
Message-ID: CAKFQuwactR8-=cT8ENNYUQRvey9aQ6m832xozmbZF3ei9YU51Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Sat, Mar 28, 2020 at 8:39 AM gmail Vladimir Koković <
vladimir(dot)kokovic(at)gmail(dot)com> wrote:

> On 28.3.20. 16:25, David G. Johnston wrote:
>
> integer::text == text, but which character 0x03 or 0x33 ?
>
x33

Text should contain characters.
>
> Characters is from character set.
>
> Character 0x03 is valid in ASCII and UTF-8 character sets.
>
So is x33

Which one is more useful to the typical programmer (which given you concept
of works and wrong in the OP your problem space is probably not typical)?
Treating the integer value 3 as a code point reference or treating it as a
character in a given character set.

I hope you agree that the character interpretation is more useful, though
regardless of your agreement that is what happens. Everything else is just
an implementation detail.

Numbers > 9 are converted digit-by-digit into their character
representations and then concatenated together.

David J.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Chris Coutinho 2020-04-05 22:06:09 Tracking mutations in table data
Previous Message Tom Lane 2020-03-28 16:02:26 Re: chr(3) and 3::text