[PATCH] fix references to like_regex
Hi,
Since we have the regexp_like operator I have found that there is two
references in the documentation about PostgreSQL lacking of LIKE_REGEX
implementation. Here is a patch to fix the documentation. I simply
remove the reference to non exist of LIKE_REGEX in PostgreSQL in chapter
"9.7.3.8 Differences from XQuery" And try to modify chapter "9.16.2.3.
SQL/JSON Regular Expressions" to mention the REGEXP_LIKE operator. For
the second fix there should be better wording.
Best regards,
--
Gilles Darold
Attachments:
0001-like_regex-doc-fix-v1.patchtext/x-patch; charset=UTF-8; name=0001-like_regex-doc-fix-v1.patchDownload
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 4b49dff2ff..cf3b2cc827 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -7353,26 +7353,12 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
<!-- end re_syntax.n man page -->
<sect3 id="posix-vs-xquery">
- <title>Differences from XQuery (<literal>LIKE_REGEX</literal>)</title>
-
- <indexterm zone="posix-vs-xquery">
- <primary><literal>LIKE_REGEX</literal></primary>
- </indexterm>
+ <title>Differences from XQuery</title>
<indexterm zone="posix-vs-xquery">
<primary>XQuery regular expressions</primary>
</indexterm>
- <para>
- Since SQL:2008, the SQL standard includes
- a <literal>LIKE_REGEX</literal> operator that performs pattern
- matching according to the XQuery regular expression
- standard. <productname>PostgreSQL</productname> does not yet
- implement this operator, but you can get very similar behavior using
- the <function>regexp_match()</function> function, since XQuery
- regular expressions are quite close to the ARE syntax described above.
- </para>
-
<para>
Notable differences between the existing POSIX-based
regular-expression feature and XQuery regular expressions include:
@@ -17456,11 +17442,11 @@ $[*] ? (@ like_regex "^[aeiou]" flag "i")
<para>
The SQL/JSON standard borrows its definition for regular expressions
from the <literal>LIKE_REGEX</literal> operator, which in turn uses the
- XQuery standard. PostgreSQL does not currently support the
- <literal>LIKE_REGEX</literal> operator. Therefore,
- the <literal>like_regex</literal> filter is implemented using the
- POSIX regular expression engine described in
- <xref linkend="functions-posix-regexp"/>. This leads to various minor
+ XQuery standard. PostgreSQL supports the <literal>REGEX_LIKE</literal>
+ operator which is the equivalent minus some differences described in
+ <xref linkend="posix-vs-xquery"/>. The <literal>like_regex</literal>
+ filter is implemented using the POSIX regular expression engine, see
+ <xref linkend="functions-posix-regexp"/>. This leads to various minor
discrepancies from standard SQL/JSON behavior, which are cataloged in
<xref linkend="posix-vs-xquery"/>.
Note, however, that the flag-letter incompatibilities described there
Gilles Darold <gilles@migops.com> writes:
Since we have the regexp_like operator I have found that there is two
references in the documentation about PostgreSQL lacking of LIKE_REGEX
implementation. Here is a patch to fix the documentation. I simply
remove the reference to non exist of LIKE_REGEX in PostgreSQL in chapter
"9.7.3.8 Differences from XQuery" And try to modify chapter "9.16.2.3.
SQL/JSON Regular Expressions" to mention the REGEXP_LIKE operator. For
the second fix there should be better wording.
I don't think we should change these (yet). regexp_like() is *not*
LIKE_REGEX, precisely because it's using a slightly different
regular-expression language than what the spec calls for.
At some point we may provide a skin for the regexp engine that
duplicates the spec's definition, and then we can implement
LIKE_REGEX for real.
regards, tom lane
Le 02/11/2021 à 16:50, Tom Lane a écrit :
Gilles Darold <gilles@migops.com> writes:
Since we have the regexp_like operator I have found that there is two
references in the documentation about PostgreSQL lacking of LIKE_REGEX
implementation. Here is a patch to fix the documentation. I simply
remove the reference to non exist of LIKE_REGEX in PostgreSQL in chapter
"9.7.3.8 Differences from XQuery" And try to modify chapter "9.16.2.3.
SQL/JSON Regular Expressions" to mention the REGEXP_LIKE operator. For
the second fix there should be better wording.I don't think we should change these (yet). regexp_like() is *not*
LIKE_REGEX, precisely because it's using a slightly different
regular-expression language than what the spec calls for.
At some point we may provide a skin for the regexp engine that
duplicates the spec's definition, and then we can implement
LIKE_REGEX for real.
Thanks for clarifying, I thought it was an oversight.
Regards
--
Gilles Darold