# select '{"a": 1, "b": 2, "c": {"type": "json", "stuff": "test"}, "d": ["aa","bb","cc","dd"]}'::jsonb - '{c, type}'::text[] - '{d, -1}'::text[]; ERROR: operator does not exist: jsonb - text[] LINE 1: ...ff": "test"}, "d": ["aa","bb","cc","dd"]}'::jsonb - '{c, typ... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
> 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:
Yeah, I think that may be problematic. I agree with Josh that there's probably no sane mix of operators for this, as I would expect your example to replace "d": ["aa","bb","cc","dd"] with "d": ["ee"] rather than append to it. Hmm... unless we used a + operator, but then I'm not sure what should happen in the instance of '{"d": ["aa"]}' + '{"d": "bb"}'.