Add current substring regular expression syntax
authorPeter Eisentraut <peter@eisentraut.org>
Mon, 29 Jun 2020 09:04:42 +0000 (11:04 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Mon, 29 Jun 2020 09:05:00 +0000 (11:05 +0200)
commit78c887679d7632c1211f85eb95723f3226bf1b46
tree7c333d0f5f4c6238ea74bc44038564a179882107
parentaafefb4dcbf79e8cb1439e888a9cdb3dfefa7657
Add current substring regular expression syntax

SQL:1999 had syntax

    SUBSTRING(text FROM pattern FOR escapechar)

but this was replaced in SQL:2003 by the more clear

    SUBSTRING(text SIMILAR pattern ESCAPE escapechar)

but this was never implemented in PostgreSQL.  This patch adds that
new syntax as an alternative in the parser, and updates documentation
and tests to indicate that this is the preferred alternative now.

Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Vik Fearing <vik@postgresfriends.org>
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
Discussion: https://www.postgresql.org/message-id/flat/a15db31c-d0f8-8ce0-9039-578a31758adb%402ndquadrant.com
contrib/citext/expected/citext.out
contrib/citext/expected/citext_1.out
contrib/citext/sql/citext.sql
doc/src/sgml/func.sgml
src/backend/catalog/information_schema.sql
src/backend/parser/gram.y
src/test/regress/expected/strings.out
src/test/regress/sql/strings.sql