summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonpath_gram.y
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2019-06-19 22:40:58 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2019-06-19 22:41:57 +0300
commit261a5c1928566f938cbda0f62dc16f6a2d1e871d (patch)
treeb8c8f249ab1d48bfa0bfe7b7b0d278f0ff572565 /src/backend/utils/adt/jsonpath_gram.y
parentd8594d123c155aeecd47fc2450f62f5100b2fbf0 (diff)
Support 'q' flag in jsonpath 'like_regex' predicate
SQL/JSON standard defines that jsonpath 'like_regex' predicate should support the same set of flags as XQuery/XPath. It appears that implementation of 'q' flag was missed. This commit fixes that. Discussion: https://postgr.es/m/CAPpHfdtyfPsxLYiTjp5Ov8T5xGsB5t3CwE5%2B3PS%3DLLwA%2BxTJog%40mail.gmail.com Author: Nikita Glukhov, Alexander Korotkov
Diffstat (limited to 'src/backend/utils/adt/jsonpath_gram.y')
-rw-r--r--src/backend/utils/adt/jsonpath_gram.y8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/utils/adt/jsonpath_gram.y b/src/backend/utils/adt/jsonpath_gram.y
index 22c2089f78f..a0a930ccf0c 100644
--- a/src/backend/utils/adt/jsonpath_gram.y
+++ b/src/backend/utils/adt/jsonpath_gram.y
@@ -510,6 +510,14 @@ makeItemLikeRegex(JsonPathParseItem *expr, JsonPathString *pattern,
v->value.like_regex.flags |= JSP_REGEX_WSPACE;
cflags |= REG_EXPANDED;
break;
+ case 'q':
+ v->value.like_regex.flags |= JSP_REGEX_QUOTE;
+ if (!(v->value.like_regex.flags & (JSP_REGEX_MLINE | JSP_REGEX_SLINE | JSP_REGEX_WSPACE)))
+ {
+ cflags &= ~REG_ADVANCED;
+ cflags |= REG_QUOTE;
+ }
+ break;
default:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),