Re: BUG #18035: Assertion failure in jsonb_path_query
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Date: 2023-07-25T14:55:51Z
Lists: pgsql-bugs
Attachments
- add_missing_jpiLikeRegex_to_assert.patch (text/plain) patch
On Tue, 25 Jul 2023 at 22:01, PG Bug reporting form
<noreply@postgresql.org> wrote:
> On REL_16_BETA2 the following query: select jsonb_path_query('{}', '($[0]
> like_regex "").type()');
> produces assert for me:
I'm no json path expert, but from what I can tell, this Assert is just
missing a condition for jpiLikeRegex.
With that added, it seems to properly determine that the regex test
returns boolean.
postgres=# select jsonb_path_query($$["string", "string"]$$, '($[0]
like_regex ".{5}")');
jsonb_path_query
------------------
true
(1 row)
postgres=# select jsonb_path_query($$["string", "string"]$$, '($[0]
like_regex ".{7}")');
jsonb_path_query
------------------
false
(1 row)
postgres=# select jsonb_path_query($$["string", "string"]$$, '($[0]
like_regex ".{7}").type()');
jsonb_path_query
------------------
"boolean"
(1 row)
The only other enum value missing from that Assert is jpiSubscript.
David
Commits
-
Fix overly strict Assert in jsonpath code
- 668990980f15 12.16 landed
- 74a5bf1b676f 13.12 landed
- f457f2ef140a 14.9 landed
- 67f3a697ba83 15.4 landed
- b25acc302524 16.0 landed
- deae1657ee6d 17.0 landed