Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored
Date: 2022-11-27 22:47:53
Message-ID: 8B76CFDC-830C-4DF0-9958-CAED05E40133@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Nov 24, 2022, at 12:55, David E. Wheeler <david(at)justatheory(dot)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(at)home(dot)com"';
?column?
----------
t

Works properly with `@@`, though:

david=# select '{}' @@ '$.emails.work == "hi(at)home(dot)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 required for @@, but it doesn’t say it doesn’t apply to @? But the `?()` filter syntax works as expected with @?:

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

Wondering if I should avoid `(at)?`(dot) Frankly I don’t understand the difference between `@@` and `(at)?`(dot)

Best,

David

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2022-11-28 05:07:17 Re: BUG #17695: Failed Assert in logical replication snapbuild.
Previous Message houzj.fnst@fujitsu.com 2022-11-27 12:42:51 RE: Incorrect messages emitted from pgoutput when using column lists