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