Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored - Mailing list pgsql-bugs

From David E. Wheeler
Subject Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored
Date
Msg-id 8B76CFDC-830C-4DF0-9958-CAED05E40133@justatheory.com
Whole thread Raw
In response to Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-bugs
On Nov 24, 2022, at 12:55, David E. Wheeler <david@justatheory.com> wrote:

> Yeah, this doesn’t seem right, either:
>
> david=# select jsonb_path_exists('{"foo": {"bar": true}}', '$path', '{"path": "$.foo.bax"}');
> jsonb_path_exists
> —————————
> t


david=# select '{}' @? '$.emails.work == "hi@home.com"';
 ?column?
----------
 t

Works properly with `@@`, though:

david=# select '{}' @@ '$.emails.work == "hi@home.com"';
 ?column?
----------
 f

Have to admit I find this pretty weird. I see that the docs say that this Postgres-specific boolean predicate syntax is
requiredfor @@, but it doesn’t say it doesn’t apply to @? But the `?()` filter syntax works as expected with @?: 

david=# select '{}' @? '$.emails.work ?(@ == "hi@home.com")';
 ?column?
----------
 f

Wondering if I should avoid `@?`. Frankly I don’t understand the difference between `@@` and `@?`.

Best,

David


Attachment

pgsql-bugs by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Incorrect messages emitted from pgoutput when using column lists
Next
From: Masahiko Sawada
Date:
Subject: Re: BUG #17695: Failed Assert in logical replication snapbuild.