| From: | Daniel Gustafsson <dgustafsson(at)pivotal(dot)io> |
|---|---|
| To: | auspex(at)rambler(dot)ru, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function |
| Date: | 2019-04-15 10:26:24 |
| Message-ID: | AB69E15A-AE09-4041-B0C1-01F2989C4014@pivotal.io |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
> On 15 Apr 2019, at 12:01, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote:
> 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’)"
When executing this in a shell, I believe you need to escape the quotes in the
query. The below commandline seems to work fine for me (tested in 9.4 and
current master):
$ ./bin/psql --command=“SELECT COALESCE(SUBSTRING('+380481234567' FROM '%#\"[0-9]{9}#\"' FOR '#'), 'NULL')" postgres
coalesce
-----------
481234567
(1 row)
cheers ./daniel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Francisco Olarte | 2019-04-15 10:30:33 | Re: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function |
| Previous Message | PG Bug reporting form | 2019-04-15 10:01:46 | BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function |