Re: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(stringFROM pattern FOR escape) function

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(stringFROM pattern FOR escape) function
Дата
Msg-id AB69E15A-AE09-4041-B0C1-01F2989C4014@pivotal.io
обсуждение исходный текст
Ответ на BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
> On 15 Apr 2019, at 12:01, PG Bug reporting form <noreply@postgresql.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


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(string FROM pattern FOR escape) function
Следующее
От: Francisco Olarte
Дата:
Сообщение: Re: BUG #15756: Seemingly inconsistent behavior of SUBSTRING(stringFROM pattern FOR escape) function