Postgres- update a value in a array on particular index
Indeed there is no such function, but you can easily write your own:

create function array_set(p_input anyarray, p_index int, p_new_value anyelement)
  returns anyarray
as
$$
begin
  if p_input is not null then
    p_input[p_index] := p_new_value;
  end if;
  return p_input;
end;
$$
language plpgsql
immutable;


(If you never need it for anything different than bigint[] then you can replace the anyelement and anyarray with the equivalent types)

Then you can use it like this:

update the_table
  set ids = array_set(ids, 2, 50::bigint)
where ...;