Skip to content

Plans for the future

erthalion edited this page Jun 12, 2015 · 3 revisions
  • deep merge concat
select jsonb_deep_merge(
    '{"a": {"b":1}}'::jsonb,
    '{"a": {"c":2}}'::jsonb
);
     jsonb_deep_merge            
-------------------------------
   {"a": {"b":1, "c":2}}
(1 row)
  • Check for key existence in an indexable way (something, that may be called jsonb_exist_path)
select '{"a": {"b": {"c": 1}}}'::jsonb ? ARRAY['a', 'b', 'c']
 jsonb 
-------
 true
(1 row)
  • Delete value from jsonb array
select '["a", "c", "a"]'::jsonb - 'a';
 ?column?
----------
 ["c"]
(1 row)
  • jsonb - jsonb
select jsonb_delete_jsonb(
    '{"a": 1, "b": {"c": 2}, {"f": [4, 5]}}'::jsonb,
    '{"a": 4, {"f": [4, 5]}, "c": 2}'::jsonb
);
      jsonb_delete
----------------------------
  {"a": 1, "b": {"c": 2}}
(1 row)
  • jsonb_intersection
select jsonb_intersection(
    '{{"a":2}, "d": {"f": 3}, {"g":[4, 5]}}'::jsonb,
    '{{"a":2}, "f": 3, {"g":[4, 5]}}'::jsonb
);
   jsonb_intersection
--------------------------
  {"a": 2, "g": [4, 5]}
(1 row)
Clone this wiki locally