Re: ❓ JSON Path Dot Precedence

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Erik Wienhold <ewie(at)ewie(dot)name>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ❓ JSON Path Dot Precedence
Date: 2024-04-07 22:11:32
Message-ID: 1B2C549C-429E-402F-9E43-377E7408B831@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Apr 7, 2024, at 15:46, Erik Wienhold <ewie(at)ewie(dot)name> wrote:

> I guess jsonpath assumes that hex, octal, and binary literals are
> integers. So there's no ambiguity about any fractional part that might
> follow.

Yeah, that’s what the comment in the flex file says:

https://github.com/postgres/postgres/blob/b4a71cf/src/backend/utils/adt/jsonpath_scan.l#L102-L105

> Also, is there even a use case for path "0x2.p10"? The path has to
> start with "$" or ("@" in case of a filter expression), doesn't it? And
> it that case it doesn't parse:
>
> test=# select '$.0x2.p10'::jsonpath;
> ERROR: trailing junk after numeric literal at or near ".0x" of jsonpath input
> LINE 1: select '$.0x2.p10'::jsonpath;
>
> Even with extra whitespace:
>
> test=# select '$ . 0x2 . p10'::jsonpath;
> ERROR: syntax error at or near "0x2" of jsonpath input
> LINE 1: select '$ . 0x2 . p10'::jsonpath;
>
> Or should it behave like an array accessor? Similar to:
>
> test=# select jsonb_path_query('[0,1,{"p10":42},3]', '$[0x2].p10'::jsonpath);
> jsonb_path_query
> ------------------
> 42
> (1 row)

I too am curious why these parse successfully, but don’t appear to be useful.

Best,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-04-07 22:12:29 Re: Streaming read-ready sequential scan code
Previous Message Andres Freund 2024-04-07 22:00:00 Re: Use streaming read API in ANALYZE