Skip to content

Commit deae165

Browse files
committed
Fix overly strict Assert in jsonpath code
This was failing for queries which try to get the .type() of a jpiLikeRegex. For example: select jsonb_path_query('["string", "string"]', '($[0] like_regex ".{7}").type()'); Reported-by: Alexander Kozhemyakin Bug: #18035 Discussion: https://postgr.es/m/18035-64af5cdcb5adf2a9@postgresql.org Backpatch-through: 12, where SQL/JSON path was added.
1 parent d3a3831 commit deae165

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/utils/adt/jsonpath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ jspGetNext(JsonPathItem *v, JsonPathItem *a)
10141014
v->type == jpiDouble ||
10151015
v->type == jpiDatetime ||
10161016
v->type == jpiKeyValue ||
1017-
v->type == jpiStartsWith);
1017+
v->type == jpiStartsWith ||
1018+
v->type == jpiLikeRegex);
10181019

10191020
if (a)
10201021
jspInitByBuffer(a, v->base, v->nextPos);

0 commit comments

Comments
 (0)