Substring expression fails on single character input

Поиск
Список
Период
Сортировка
От Per-Åke Ling
Тема Substring expression fails on single character input
Дата
Msg-id CACCP6e-Zt8gSoH=PMCLHvGgi-CYYAAi9TE3FrfYcMUjO5BXG9Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: Substring expression fails on single character input  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
When using the expression '(\S.*\S)' to remove surrounding whitespace (including \t and \n) it returns NULL on single character surrounded by whitespace.

The following shows the unexpected result:

SELECT x, '|'||substring(x, '(\S.*\S)')||'|'
FROM (VALUES (' a'), (' ab'), ('  a b c '), (E' c\n'), (E' ab\n')) AS z (x);
    x     │ ?column?
──────────┼──────────
  a       │             <=== ERROR
  ab      │ |ab|
   a b c  │ |a b c|
  c      ↵│             <=== ERROR
          │
  ab     ↵│ |ab|

Regards,
Per-Åke Ling

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

Предыдущее
От: Alexander Lakhin
Дата:
Сообщение: Re: BUG #16329: Valgrind detects an invalid read when building a gistindex with buffering
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Substring expression fails on single character input