Re: [HACKERS] SQL/JSON in PostgreSQL
От | Pavel Stehule |
---|---|
Тема | Re: [HACKERS] SQL/JSON in PostgreSQL |
Дата | |
Msg-id | CAFj8pRDRSpoP009yYrVSuKWBDDiEZHQvc+fwOCFhZQ0_zynGxw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] SQL/JSON in PostgreSQL (Nikita Glukhov <n.gluhov@postgrespro.ru>) |
Ответы |
Re: [HACKERS] SQL/JSON in PostgreSQL
|
Список | pgsql-hackers |
Hi
I try jsonpath on json{
"book":
[
{
"title": "Beginning JSON",
"author": "Ben Smith",
"price": 49.99
},
{
"title": "JSON at Work",
"author": "Tom Marrs",
"price": 29.99
},
{
"title": "Learn JSON in a DAY",
"author": "Acodemy",
"price": 8.99
},
{
"title": "JSON: Questions and Answers",
"author": "George Duckett",
"price": 6.00
}
],
"price range":
{
"cheap": 10.00,
"medium": 20.00
}
}
postgres=# select j @* '$.book[*] ? (@.price==6)' from test;
┌─────────────────────────────────────────────────────┐
│ ?column? │
╞═════════════════════════════════════════════════════╡
│ { ↵│
│ "title": "JSON: Questions and Answers",↵│
│ "author": "George Duckett", ↵│
│ "price": 6.00 ↵│
│ } ↵│
│ │
└─────────────────────────────────────────────────────┘
(1 row)
postgres=# select j @* '$.book[*].title ? (@.price==6)' from test;
┌──────────┐
│ ?column? │
╞══════════╡
└──────────┘
(0 rows)
┌──────────┐
│ ?column? │
╞══════════╡
└──────────┘
(0 rows)
I found some examples, where the filter has bigger sense, but it is not supported
LINE 1: select j @* '$.book[?(@.price==6.00)].title' from test;
^
DETAIL: syntax error, unexpected '?' at or near "?"
^
DETAIL: syntax error, unexpected '?' at or near "?"
Regards
Pavel
В списке pgsql-hackers по дате отправления: