pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Andreas Joseph Krogh <andreas@visena.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Sv: Re: Sv: Re: regex match and special characters
Date: Thu, 16 Aug 2018 08:13:40 -0700
Message-ID: <abb828a5-3483-c595-4316-a9ee48837e86@aklaver.com> (raw )
In-Reply-To: <VisenaEmail.3c.a2f490fd2f459412.1654333b814@tc7-visena >
References: <VisenaEmail.3c.a2f490fd2f459412.1654333b814@tc7-visena >
On 08/16/2018 07:47 AM, Andreas Joseph Krogh wrote:
> På torsdag 16. august 2018 kl. 16:32:40, skrev Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>>:
>
> On 08/16/2018 07:04 AM, Andreas Joseph Krogh wrote:
>
> > char(2006) produces the wrong character as 2006 is the hex-value. You
> > have to use 8198:
> > andreak@[local]:543310.4 andreak=# select version();
> >
> ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
> > │ version
> > │
> >
> ├────────────────────────────────────────────────────────────────────────────────────────────────┤
> > │ PostgreSQL 10.4 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
> > 7.3.0-16ubuntu3) 7.3.0, 64-bit │
> >
> └────────────────────────────────────────────────────────────────────────────────────────────────┘
> > (1 row)
> >
> > andreak@[local]:543310.4 andreak=# select 'abcd'||chr(8198) ~
> 'abcd\s';
> > ┌──────────┐
> > │ ?column? │
> > ├──────────┤
> > │ t │
> > └──────────┘
> > (1 row)
>
> Argh, read the wrong line. Thanks for the correction. Still:
>
> test=# select version();
> version
>
> ------------------------------------------------------------------------------------
> PostgreSQL 10.5 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux)
> 4.8.5, 64-bit
> (1 row)
>
>
> test=# select 'abcd'||chr(8198) ~ E'abcd\s';
> ?column?
> ----------
> f
> (1 row)
>
> When using E-syntax you need to double the backslash for escaping:
> andreak@[local]:543310.4 andreak=# select 'abcd'||chr(8198) ~ E'abcd\\s';
> ┌──────────┐
> │ ?column? │
> ├──────────┤
> │ t │
> └──────────┘
> (1 row)
Hmm:
test=# show standard_conforming_strings;
standard_conforming_strings
-----------------------------
off
(1 row)
test=# show escape_string_warning;
escape_string_warning
-----------------------
on
(1 row)
test=# select 'abcd'||chr(8198) ~ 'abcd\s';
WARNING: nonstandard use of escape in a string literal
LINE 1: select 'abcd'||chr(8198) ~ 'abcd\s';
^
HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
?column?
----------
f
(1 row)
test=# select 'abcd'||chr(8198) ~ 'abcd\\s';
WARNING: nonstandard use of \\ in a string literal
LINE 1: select 'abcd'||chr(8198) ~ 'abcd\\s';
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
?column?
----------
t
(1 row)
test=# set escape_string_warning = 'off';
SET
test=# show escape_string_warning;
escape_string_warning
-----------------------
off
(1 row)
test=# select 'abcd'||chr(8198) ~ 'abcd\s';
?column?
----------
f
(1 row)
test=# set standard_conforming_strings = 'on';
SET
test=# show standard_conforming_strings;
standard_conforming_strings
-----------------------------
on
(1 row)
test=# select 'abcd'||chr(8198) ~ 'abcd\s';
?column?
----------
t
(1 row)
Wonder if the OP has standard_conforming_strings='off' and
escape_string_warning='off'?
> --
> *Andreas Joseph Krogh*
> CTO / Partner - Visena AS
> Mobile: +47 909 56 963
> andreas@visena.com <mailto:andreas@visena.com>
> www.visena.com <https://www.visena.com ;
> <https://www.visena.com ;
--
Adrian Klaver
adrian.klaver@aklaver.com
view thread (5+ messages) latest in thread
Message-ID: <abb828a5-3483-c595-4316-a9ee48837e86@aklaver.com>
Permalink: ../abb828a5-3483-c595-4316-a9ee48837e86@aklaver.com/
Also on: postgresql.org/message-id/abb828a5-3483-c595-4316-a9ee48837e86@aklaver.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, andreas@visena.com
Subject: Re: regex match and special characters
In-Reply-To: <abb828a5-3483-c595-4316-a9ee48837e86@aklaver.com>
References: <VisenaEmail.3c.a2f490fd2f459412.1654333b814@tc7-visena> <abb828a5-3483-c595-4316-a9ee48837e86@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox