PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15756
PG Version9.5.16
OSLinux, Windows
Opened2019-04-15 10:01:46+00
Reported bySergei Abramov
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15756
Logged by:          Sergei Abramov
Email address:      (redacted)
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!

Messages

DateAuthorSubject
2019-04-15 10:01:46+00PG Bug reporting formBUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function
2019-04-15 10:26:24+00Daniel GustafssonRe: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function
2019-04-15 10:30:33+00Francisco OlarteRe: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function