A little confusion about JSON Path

Поиск
Список
Период
Сортировка
Искать
От
Thomas Kellerer
Тема
A little confusion about JSON Path
Дата
Msg-id
8dcb9b9d-4863-b7e9-c3dc-e4ab2d01e918@gmx.net
Список
Дерево обсуждения
A little confusion about JSON Path Thomas Kellerer <spam_eater@gmx.net>
Re: A little confusion about JSON Path Laurenz Albe <laurenz.albe@cybertec.at>
Re: A little confusion about JSON Path Thomas Kellerer <spam_eater@gmx.net>
Hello,

I don't understand why the following two JSON Path expressions aren't doing the same thing in Postgres 12:

    with sample (data) as (
      values
        ('{"k1": {"list":[1,2,3]}}'::jsonb)
    )
    select data, 
           jsonb_path_exists(data, '$.k1.list.type() ? (@ == "array")'), -- returns true as expected
           jsonb_path_exists(data, '$.k1.list ? (@.type() == "array")') -- returns false - not expected
    from sample;


Apparently "@.type()" returns something different then "$.k1.list.type()"

But maybe I simply don't understand how the @ is supposed to work.

Regards
Thomas


В списке pgsql-general по дате отправления
От: Daniel Verite
Дата:
От: Imre Samu
Дата:
FAQ