Re: chr(3) and 3::text - Mailing list pgsql-novice

From David G. Johnston
Subject Re: chr(3) and 3::text
Date
Msg-id CAKFQuwactR8-=cT8ENNYUQRvey9aQ6m832xozmbZF3ei9YU51Q@mail.gmail.com
Whole thread Raw
In response to Re: chr(3) and 3::text  (gmail Vladimir Koković <vladimir.kokovic@gmail.com>)
List pgsql-novice
On Sat, Mar 28, 2020 at 8:39 AM gmail Vladimir Koković <vladimir.kokovic@gmail.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.

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: chr(3) and 3::text
Next
From: Chris Coutinho
Date:
Subject: Tracking mutations in table data