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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: david(at)justatheory(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-24 17:16:35
Message-ID: CAKFQuwYTM51B6=wF6BObRBfrgCvfwKmU5qGp9jgYxwHWHiFMuQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 24, 2022 at 3:28 AM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 17694
> Logged by: David Wheeler
> Email address: david(at)justatheory(dot)com
> PostgreSQL version: 15.1
> Operating system: macOS
> Description:
>
> The correct way to specify an absolute JSON path expression is to start
> with
> `$.`, as in:
>
> ```
> david=# select '{"foo": 1}' @? '$.foo';
> ?column?
> ----------
> t
> ```
>
> If, however, you omit the dot (`.`), the expression incorrectly always
> evaluates to true!
>
> ```
> david=# select '{"foo": 1}' @? '$foo';
> ?column?
> ----------
> t
>
>
> It looks like the text between the `$` and `.` is ignored. I don't think
> this is right. Shouldn't it be a syntax error? Seems to properly complain
> if
> using the same pattern in subpaths:
>

There is a bug in this area though the syntax itself is valid since you've
simply defined a variable.

While this was in moderation I posted a more detailed report and my
research on the issue.

https://www.postgresql.org/message-id/CAKFQuwbeytffJkVnEqDyLZ=rQsznoTh1OgDoOF3VmOMkxcTMjA@mail.gmail.com

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2022-11-24 17:22:56 Re: BUG #17696: Creation of deferrable initially deferred constraint breaks before transaction commit
Previous Message Gunnar Morling 2022-11-24 17:13:59 Incorrect messages emitted from pgoutput when using column lists