Re: ❓ JSON Path Dot Precedence - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: ❓ JSON Path Dot Precedence
Date
Msg-id 9C7ABA9C-EEE6-4C04-8F26-5D456468DDF4@justatheory.com
Whole thread Raw
In response to Re: ❓ JSON Path Dot Precedence  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-hackers
Hi, following up on some old threads.

> On Apr 10, 2024, at 16:44, David E. Wheeler <david@justatheory.com> wrote:
>
> That makes sense, thanks. It’s just a little odd to me that the resulting path isn’t a query at all. To Erik’s point:
whatpath can `'0x2.p10` even select? 

I’m wondering whether the jsonpath parser should be updated to reject cases like this. I think it will always return no
results.AFAICT, there’s no way to navigate to an object identifier immediately after a number: 

david=# select '0x2.p10'::jsonpath;
 jsonpath
-----------
 (2)."p10"
(1 row)

david=# select jsonb_path_query(target => '[0, 1, {"p10": true}]', path => '0x2.p10');
 jsonb_path_query
------------------
(0 rows)

david=# select jsonb_path_query(target => '{"0x2": {"p10": true}}', path => '0x2.p10');
 jsonb_path_query
------------------
(0 rows)


It’s just inherently meaningless. BTW, it’s not limited to hex numbers:

david=# select '(2).p10'::jsonpath;
 jsonpath
-----------
 (2)."p10"

OTOH, maybe that’s a corner case we can live with.

Best,

David




pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: 回复: An implementation of multi-key sort
Next
From: Matthias van de Meent
Date:
Subject: Re: Parallel CREATE INDEX for GIN indexes