title: appending to multi dimensional arrays in postgres
body: <p>I am trying to create a multi-column aggregate function that needs to accumulate all the column values for later processing. </p>
  
  <pre><code>CREATE OR REPLACE FUNCTION accumulate_scores(prev integer[][],l1 integer,
  l2 integer,l3 integer) RETURNS integer[][] AS
  $$      
  BEGIN  
  prev[1] = array_append(prev[1],l1);
  prev[2] = array_append(prev[2],l2);
  prev[3] = array_append(prev[3],l3);
  return prev;
  END 
  $$ LANGUAGE plpgsql;
  
  CREATE AGGREGATE my_aggregate(integer,integer,integer)(
   SFUNC  = accumulate_scores,
   STYPE     = integer[][],
   INITCOND  = '{}'  
  );
  
  select accumulate_scores(ARRAY[1]|| ARRAY[[1],[1]],2,3,4);     
  </code></pre>
  
  <p>I get this error</p>
  
  <pre><code>ERROR: function array_append(integer, integer) does not exist
  Hint: No function matches the given name and argument types. You might need to add explicit type casts.
  </code></pre>
  
  <p>How do i accumulate these values into a multi dimensional array?</p>
  
  <p>Edit: i have tried with array_cat and get the same error. thought array_append might be right since prev[1] is a uni dimensional array</p>