Search Postgresql Archives

retrieve subset of a jsonb object with a list of keys

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

 



Hi:

I have a jsonb columne with json object like belo
{"a": 1, "b":2, "c":3}

I'd like to get subset of the object with key list ["a","c"]
so it retruns json object of

{"a": 1,  "c":3}

something like

select '{"a": 1, "b":2, "c":3}'::jsob ->'["a","c"]'

what would be the most efficient (and simplest if possible) to get the subset with the key list?

Thanks

[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