2 ms·
See the `||` operator and `jsonb_set` (use Cmd-F): https://www.postgresql.org/docs/current/static/functions-json.html https://www.postgresql.org/docs/current/s
by brandur 8y ago
See the `||` operator and `jsonb_set` (use Cmd-F):
https://www.postgresql.org/docs/current/static/functions-json.html https://www.postgresql.org/docs/current/static/functions-jso...
From the docs for the `||` operator:
> Concatenate two jsonb values into a new jsonb value
And for `jsonb_set`:
> Returns target with the section designated by path replaced by new_value, or with new_value added if create_missing is true ( default is true) and the item designated by path does not exist. As with the path orientated operators, negative integers that appear in path count from the end of JSON arrays.
You'd use this function in conjunction with an `UPDATE` statement to get the result that you want.