Assign a value to a field of a composite type (a row in an array of rows)?
Yes, this feature is missing in the arsenal of array functions. It's rather exotic, and one would typically operate with a (temporary) table instead of an array of rows.

That said, there is a way with a single assignment, using the hstore #= operator:

CREATE OR REPLACE FUNCTION f_test()
  RETURNS int LANGUAGE plpgsql AS
$func$
DECLARE
   x test_type[] := '{(1)}';
BEGIN
   x[1] := x[1] #= hstore '"some_int"=&gt;"2"'; -- !!!
   RETURN x[1].some_int;
END
$func$;





SELECT f_test();



| f_test |
| -----: |
|      2 |



db&lt;>fiddle here

The additional module hstore must be installed. In-depth explanation:


How to set value of composite variable field using dynamic SQL