A little confusion about JSON Path

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема A little confusion about JSON Path
Дата
Msg-id 8dcb9b9d-4863-b7e9-c3dc-e4ab2d01e918@gmx.net
обсуждение исходный текст
Ответы Re: A little confusion about JSON Path
Список pgsql-general
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"
Дата:
Сообщение: Re: Text search lexer's handling of hyphens and negatives
Следующее
От: Imre Samu
Дата:
Сообщение: Re: Regarding db dump with Fc taking very long time to completion