BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored
| От | PG Bug reporting form |
|---|---|
| Тема | BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored |
| Дата | |
| Msg-id | 17694-2f7d9576ae277d64@postgresql.org обсуждение исходный текст |
| Ответы |
Re: BUG #17694: In JSONPath expressions, characters between leading $ and dot appear to be ignored
|
| Список | pgsql-bugs |
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
david=# select '{"foo": 1}' @? '$"foo bar"';
?column?
----------
t
david=# select '{"foo": 1}' @? '$"foo bar".bar';
?column?
----------
f
```
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:
```
david=# select '{"foo": 1}' @? '$.foo"foo bar"';
ERROR: syntax error at or near """ of jsonpath input
LINE 1: select '{"foo": 1}' @? '$.foo"foo bar"';
```
В списке pgsql-bugs по дате отправления: