diff options
author | David Rowley <drowley@postgresql.org> | 2023-08-02 01:44:31 +1200 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2023-08-02 01:44:31 +1200 |
commit | 668990980f15e204abad3ed015466514483ab7ab (patch) | |
tree | 0788acd8ef435cac55b07c93b12a93b3e34991ea /src | |
parent | 9edf72aa76441716ce62d1f1787988e160da8115 (diff) | |
download | postgresql-668990980f15e204abad3ed015466514483ab7ab.tar.gz postgresql-668990980f15e204abad3ed015466514483ab7ab.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/adt/jsonpath.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/utils/adt/jsonpath.c b/src/backend/utils/adt/jsonpath.c index 7f322485e7b..bc2168cf926 100644 --- a/src/backend/utils/adt/jsonpath.c +++ b/src/backend/utils/adt/jsonpath.c @@ -962,7 +962,8 @@ jspGetNext(JsonPathItem *v, JsonPathItem *a) v->type == jpiCeiling || v->type == jpiDouble || v->type == jpiKeyValue || - v->type == jpiStartsWith); + v->type == jpiStartsWith || + v->type == jpiLikeRegex); if (a) jspInitByBuffer(a, v->base, v->nextPos); |