Обсуждение: Release Notes 9.0: substring() changes?

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

Release Notes 9.0: substring() changes?

От
"Erik Rijkers"
Дата:
In the 9.0devel release notes
 http://developer.postgresql.org/pgdocs/postgres/release-9-0.html

under
 E.1.2.3. String Handling

three changes are mentioned, and for the first two changes it is said that substring() is "affected":

------------8<------------
1 Properly treat ^ and $ as literals in SIMILAR TO patterns, to match the SQL standard (Tom Lane)
Previously these were treated using regular expression syntax. This change breaks backward
compatibility. This also affects substring()'s interpretation of regular expressions.

2 Process parentheses as literals in SIMILAR TO expressions; also make character class handling
more standards-compliant (Tom Lane) This also affects substring()'s handling of regular expressions.

3  Do not allow substring()  to have a negative third length, per the SQL standard (Tom Lane)
------------8<------------

In 9.0devel cvs, I can find & affirm the SIMILAR TO changes, but I cannot find any changes to
substring() (other than the one under point 3.)


# select current_setting('server_version_num');current_setting
-----------------90000

# select substring('The quick brown fox', E'^The (quick) brown');substring
-----------quick
(1 row)

This shows that both  ^ and parentheses are regex-interpreted, and not literally as the
release-note text would have one believe.

Perhaps those mentions of substring-change under point 1 and 2 can be removed?


thanks,

Erik Rijkers




Re: Release Notes 9.0: substring() changes?

От
Tom Lane
Дата:
"Erik Rijkers" <er@xs4all.nl> writes:
> In 9.0devel cvs, I can find & affirm the SIMILAR TO changes, but I cannot find any changes to
> substring() (other than the one under point 3.)

What's affected is the three-parameter form of SUBSTRING().  See
section 9.7.2.

The second of these is still wrong, though, since parentheses are *not*
literals in SIMILAR TO.  Will fix.
        regards, tom lane