Обсуждение: BUG #3788: POSIX regexp seems doesn't work for '(?!re) ' pattern

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

BUG #3788: POSIX regexp seems doesn't work for '(?!re) ' pattern

От
"Vitaly"
Дата:
The following bug has been logged online:

Bug reference:      3788
Logged by:          Vitaly
Email address:      vitaly.yakunin@gmail.com
PostgreSQL version: 8.3-beta3
Operating system:   WinXP
Description:        POSIX regexp seems doesn't work for '(?!re) ' pattern
Details:

SELECT author, type
  FROM books WHERE "type" ~ '(?!novel)';

This select work incorrect. It returns all types.

Work around:
SELECT author, type
  FROM books WHERE not ("type" ~ '(?=novel)');

Re: BUG #3788: POSIX regexp seems doesn't work for '(?!re) ' pattern

От
Tom Lane
Дата:
"Vitaly" <vitaly.yakunin@gmail.com> writes:
> SELECT author, type
>   FROM books WHERE "type" ~ '(?!novel)';

> This select work incorrect. It returns all types.

Certainly.  That's a negative-lookahead pattern and is therefore
guaranteed to match somewhere in every string (at the end, if
nowhere else).

            regards, tom lane