Можете да изпратите своя JSON низ такъв, какъвто е, и PostgreSQL да се справи с него:
update portfolios p
set votes = s.votes
from (
select (e->>'votes')::int as votes, (e->>'id')::int as id
from (select (regexp_replace($1, '"\1"', 'g'))::jsonb as jarr) j
cross join jsonb_array_elements(jarr) e
) s
where p.id = s.id;
Където $1
е [{votes: 5, id: 1}, {votes: 15, id: 1}, {votes: 25, id: 2}]', '([a-z]+)
като низ.