From: David Rowley Date: Tue, 1 Aug 2023 13:41:21 +0000 (+1200) Subject: Fix overly strict Assert in jsonpath code X-Git-Tag: REL_14_9~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f457f2ef140a9a218ded6befed6d7dc625aac3ec;p=thirdparty%2Fpostgresql.git 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. --- diff --git a/src/backend/utils/adt/jsonpath.c b/src/backend/utils/adt/jsonpath.c index fa22546f22d..178e210d81f 100644 --- a/src/backend/utils/adt/jsonpath.c +++ b/src/backend/utils/adt/jsonpath.c @@ -978,7 +978,8 @@ jspGetNext(JsonPathItem *v, JsonPathItem *a) v->type == jpiDouble || v->type == jpiDatetime || v->type == jpiKeyValue || - v->type == jpiStartsWith); + v->type == jpiStartsWith || + v->type == jpiLikeRegex); if (a) jspInitByBuffer(a, v->base, v->nextPos);