create or replace function typecast() returns void as $$
declare
    t varchar(100);
begin
    for t in select (select array_agg(i) as a from generate_series(1, 30) as g(i)) as x from generate_series(1, 10000000) loop
        null;
    end loop;
end;
$$ language plpgsql;


create or replace function raise() returns void as $$
declare
    t int[] := (select array_agg(i) as a from generate_series(1, 30) as g(i));
    i int;
begin
    for i in 1..10000000 loop
        raise debug '%', t;
    end loop;
end;
$$ language plpgsql;
