From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: auspex@rambler.ru
Subject: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function
Date: Mon, 15 Apr 2019 10:01:46 +0000
Message-ID: <15756-27768253d60f7e38@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15756
Logged by: Sergei Abramov
Email address: auspex@rambler.ru
PostgreSQL version: 9.5.16
Operating system: Linux, Windows
Description:
When statement SELECT SUBSTRING('+380481234567' FROM 5 FOR 9),
SUBSTRING('+380481234567' FROM '%#"[0-9]{9}#"' FOR '#') is issued in pgAdmin
III Query both functions give the same correct results which are expected
when psql command line tool is to be used:
psql --username=postgres --no-password --command="SELECT
SUBSTRING('+380481234567' FROM 5 FOR 9), SUBSTRING('+380481234567' FROM
'%#"[0-9]{9}#"' FOR '#')"
But here something strange occurs! The latter function invocation
permanently returns NULL value that can be easily seen when wrapped in
COALESCE:
psql --username=postgres --no-password --command="SELECT
COALESCE(SUBSTRING('+380481234567' FROM '%#"[0-9]{9}#"' FOR '#'), 'NULL')"
This behavior is reproduced in Windows XP 32-bit, Windows 7 32-bit (both
local PG-servers) and in Linux 64 bit (both local and remote PG-servers) for
PG versions 9.3.23, 9.4.9, and 9.5.16.
Thanks for your help!
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-bugs@postgresql.org
Cc: noreply@postgresql.org, auspex@rambler.ru
Subject: Re: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function
In-Reply-To: <15756-27768253d60f7e38@postgresql.org>
References: <15756-27768253d60f7e38@postgresql.org>
* 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