This may be a pl/pgsql limitation but you should probably provide a complete self-contained example with your attempt so that user-error can be eliminated.
David J.
All right. Here you are a complete example. Just tested it.
Sorry for the long email.
CREATE TYPE type_customer AS (id integer, cust_name character varying(100), email character varying(100));
CREATE TYPE type_supercustomer AS (cus_data type_customer, superpower character varying);
CREATE TABLE public.table_customer ( id serial NOT NULL, cust_name character varying(100) NOT NULL, email character varying(100) NOT NULL, PRIMARY KEY (id) ) WITH (OIDS = FALSE);
CREATE TABLE public.table_supercustomer ( superpower character varying(100) NOT NULL ) INHERITS (table_customer) WITH (OIDS = FALSE); ALTER TABLE table_supercustomer ADD PRIMARY KEY (id);
CREATE OR REPLACE FUNCTION function_read_supercustomer() RETURNS SETOF type_supercustomer AS $BODY$ DECLARE retset type_supercustomer; BEGIN FOR retset IN SELECT (id, cust_name, email), superpower FROM table_supercustomer LOOP retset.superpower := initcap(retset.superpower);--works (retset.cus_data).email = 'anything you want';--does not work RETURN NEXT retset; END LOOP; END; $BODY$ LANGUAGE plpgsql STABLE STRICT COST 100 ROWS 1000;