Re: ❓ JSON Path Dot Precedence

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Erik Wienhold <ewie(at)ewie(dot)name>
Subject: Re: ❓ JSON Path Dot Precedence
Date: 2024-07-08 15:27:36
Message-ID: 9C7ABA9C-EEE6-4C04-8F26-5D456468DDF4@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, following up on some old threads.

> On Apr 10, 2024, at 16:44, David E. Wheeler <david(at)justatheory(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-07-08 15:35:42 Re: Parallel CREATE INDEX for GIN indexes
Previous Message Tomas Vondra 2024-07-08 15:25:43 Re: 回复: An implementation of multi-key sort