it's easy to convert one column table to single dimension array;
my_array integer[];
my_array := ARRAY(SELECT * FROM single_column_table);
But in my case, I need to convert table with several columns to array of custom type objects;
So I have custom type
TYPE dbfile AS
(fileid integer,
deleted boolean,
name text,
parentid integer,
...
ALTER TYPE dbfile
and array declared as
my_files dbfile[];
-- how to cast table to array of custom types???
my_files := SELECT * FROM get_files(); -- get_files return SETOF dbfile.
how to cast table to array of custom types?
ARRAY() does not work, as it requires single column.