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


Reply via email to