Обсуждение: BUG #4580: select substring ('a' from '(b)?(a)') returns null

Поиск
Список
Период
Сортировка

BUG #4580: select substring ('a' from '(b)?(a)') returns null

От
"substring and regular expresssion"
Дата:
The following bug has been logged online:

Bug reference:      4580
Logged by:          substring and regular expresssion
Email address:      m.mamin@intershop.de
PostgreSQL version: 8.3.5
Operating system:   Linux
Description:        select substring ('a' from '(b)?(a)') returns null
Details:

Hello,

substring ('a' from '(b)?(a)') returns 'a' in version 8.2.x,
but null with 8.3.5.  Comparing this to the bug entry
http://archives.postgresql.org/pgsql-bugs/2008-11/msg00112.php I guess this
is not considered as a bug and can be fixed while surrounding the regexp
with parenthensis:
substring ('a' from '((b)?(a))')

What I really miss, is the possibility to use the regex_flavor configuration
to get the old behaviour back.
I'm currently preparing an upgrade from 8.2.4 to 8.3.5 and this issue will
probably require a very large code review for us.


Cheers,

Marc Mamin

Re: BUG #4580: select substring ('a' from '(b)?(a)') returns null

От
Tom Lane
Дата:
"substring and regular expresssion" <m.mamin@intershop.de> writes:
> substring ('a' from '(b)?(a)') returns 'a' in version 8.2.x,
> but null with 8.3.5.  Comparing this to the bug entry
> http://archives.postgresql.org/pgsql-bugs/2008-11/msg00112.php I guess this
> is not considered as a bug

No, the old behavior was a bug.  Using your example pattern,
substring ('ba' from '(b)?(a)') would return 'b' not 'ba',
so I can hardly see how you failed to notice that it wasn't
behaving consistently.

            regards, tom lane