Re: Define jsonpath functions as stable
Chapman Flack <chap@anastigmatix.net>
From: Chapman Flack <chap@anastigmatix.net>
To: Tom Lane <tgl@sss.pgh.pa.us>, "Jonathan S. Katz" <jkatz@postgresql.org>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2019-09-16T23:11:13Z
Lists: pgsql-hackers
On 09/16/19 17:10, Tom Lane wrote: > I was initially troubled > by the fact that XML Schema regexps are implicitly anchored, ie must > match the whole string; that's a huge difference from POSIX. However, > 19075-6 says that jsonpath like_regex works the same as the LIKE_REGEX > predicate in SQL; and SQL:2011 "9.18 XQuery regular expression matching" > defines LIKE_REGEX to work exactly like XQuery's fn:matches function, > except for some weirdness around newline matching; and that spec > clearly says that fn:matches treats its pattern argument as NOT anchored. Yeah, it's a layer cake. XML Schema regexps[1] are implicitly anchored and don't have any metacharacters devoted to anchoring. XQuery regexps layer onto[2] XML Schema regexps, adding ^ and $ anchors, rescinding the implicit anchored-ness, adding reluctant quantifiers, capturing groups, and back-references, and defining flags. Then ISO SQL adds a third layer changing the newline semantics, affecting ^, $, ., \s, and \S. Regards, -Chap [1] https://www.w3.org/TR/xmlschema-2/#regexs [2] https://www.w3.org/TR/xpath-functions-31/#regex-syntax
Commits
-
Fix some minor spec-compliance issues in jsonpath lexer.
- e56cad84d542 13.0 landed
- 5f3bec0769c1 12.0 landed
-
Doc: improve documentation around jsonpath regular expressions.
- b9cf94c8c249 12.0 landed
- 0a97edb12ec4 13.0 landed
-
Fix bogus handling of XQuery regex option flags.
- d5b90cd64855 13.0 landed
- 148881454208 12.0 landed