How to add result of generate_series to array in PostgreSQL?
You can use the array constructor:
DECLARE
dates date[];
BEGIN
select array(select generate_series('2012-06-29', '2012-07-03', '1 day'::interval)::date)
into dates; --need semicolon here
return dates;
END;
If that code is actually a function, then you can simplify it to a SQL function
create function get_dates()
returns date[]
$$
select array(select generate_series(current_date - 6, current_date, interval '1' day)::date);
$$
language sql;