I have a table 'things' with a set of columns
id | name | data
1 | 'hi' | [{name: 'what', amount: 10}, {name:'koo', amount: 15}, {name: 'boo', amount: 13}]
I want to change the amount to 0, in all of the array elements. I.e, I want the result to be
[{name: 'what', amount: 0}, {name:'koo', amount:0}, {name: 'boo', amount: 0}]
When I do this
UPDATE things
SET data = jsonb_set(data, '{0,amount}', '0', false)
WHERE id=1
This works, but only sets the first array element amount to 0. I.e the result is
[{name: 'what', amount: 0}, {name:'koo', amount: 15}, {name: 'boo', amount: 13}]
I want them all to be 0.
How do I do that?