Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored
Date
Msg-id CAKFQuwYTM51B6=wF6BObRBfrgCvfwKmU5qGp9jgYxwHWHiFMuQ@mail.gmail.com
Whole thread Raw
In response to BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored  ("David E. Wheeler" <david@justatheory.com>)
List pgsql-bugs
On Thu, Nov 24, 2022 at 3:28 AM PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:

Bug reference:      17694
Logged by:          David Wheeler
Email address:      david@justatheory.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.


David J.

pgsql-bugs by date:

Previous
From: Gunnar Morling
Date:
Subject: Incorrect messages emitted from pgoutput when using column lists
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #17696: Creation of deferrable initially deferred constraint breaks before transaction commit