Hi, Thom.
> Would this support deleting "type" and the value 'dd'
With this patch you can delete them one by one:
select '{"a": 1, "b": 2, "c": {"type": "json", "stuff": "test"}, "d": ["aa","bb","cc","dd"]}'::jsonb - '{c, type}'::text[] - '{d, -1}'::text[];
?column?
-------------------------------------------------------------------
{"a": 1, "b": 2, "c": {"stuff": "test"}, "d": ["aa", "bb", "cc"]}
(1 row)
> Is there a way to take the json:
> '{"a": 1, "b": 2, "c": {"type": "json", "stuff": "test"}, "d": ["aa","bb","cc","dd"]}'> and add "ee" to "d" without replacing it?
No, looks like there is no way to add a new element to array with help of this patch. I suppose this feature can be implemented easy enough inside the "jsonb_concat" function:
select '{"a": 1, "b": 2, "c": {"type": "json", "stuff": "test"}, "d": ["aa","bb","cc","dd"]}'::jsonb || '{"d": ["ee"]}'::jsonb
but I'm not sure, that it will be the best way.