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

From David G. Johnston
Subject Re: chr(3) and 3::text
Date
Msg-id CAKFQuwat0PxGdS5gjCYB7AmZrCXZQnBv5Wjw6WqhOEh_GuYyYw@mail.gmail.com
Whole thread Raw
In response to chr(3) and 3::text  (gmail Vladimir Koković <vladimir.kokovic@gmail.com>)
List pgsql-novice
On Sat, Mar 28, 2020 at 6:21 AM gmail Vladimir Koković <vladimir.kokovic@gmail.com> wrote:

Hi,

Why is chr(3) is different than 3::text ?


First place to start given two things you may or may not know what they are is the index in the documentation:

From there:
Definiton of chr()


Meaning of "::"


Knowing that your data is likely in UTF but that for lower numbers code points (below 256) it doesn't actually matter as it is standard ASCII assumes some level of knowledge too.

Examples:

replace(Filler,chr(3),'') WORKS

replace(Filler3::text,'') WRONG


You seem to know that "Fillter" is text so neither of these seems particularly useful.  If you want to replace the string '3' in Filler with the empty string just write: replace(filler, '3', ''').

David J.

pgsql-novice by date:

Previous
From: Ken Benson
Date:
Subject: RE: chr(3) and 3::text
Next
From: Bzzzz
Date:
Subject: Re: chr(3) and 3::text