Search Postgresql Archives

A little confusion about JSON Path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux