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> |
Subject: | Re: chr(3) and 3::text |
Date: | 2020-03-28 14:57:50 |
Message-ID: | CAKFQuwat0PxGdS5gjCYB7AmZrCXZQnBv5Wjw6WqhOEh_GuYyYw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Sat, Mar 28, 2020 at 6:21 AM gmail Vladimir Koković <
vladimir(dot)kokovic(at)gmail(dot)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()
https://www.postgresql.org/docs/12/functions-string.html
Meaning of "::"
https://www.postgresql.org/docs/12/sql-expressions.html#SQL-SYNTAX-TYPE-CASTS
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bzzzz | 2020-03-28 14:59:50 | Re: chr(3) and 3::text |
Previous Message | Ken Benson | 2020-03-28 14:39:09 | RE: chr(3) and 3::text |