Hi, following up on some old threads.

> On Apr 10, 2024, at 16:44, David E. Wheeler <da...@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: what path 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



Reply via email to