title: Concatenate/merge array values during grouping/aggregation
body: <p>I have a table with the an array column type:</p>
  
  <pre><code> title       tags
  "ridealong";"{comedy,other}"
  "ridealong";"{comedy,tragedy}"
  "freddyjason";"{horror,silliness}"
  </code></pre>
  
  <p>I would like to write a query that produces a single array per title(in an ideal world it would be a set/deduplicated array)</p>
  
  <p>e.g.</p>
  
  <pre><code>select array_cat(tags),title from my_test group by title
  </code></pre>
  
  <p>The above query doesn't work of course, but I would like to produce 2 rows:</p>
  
  <pre><code>"ridealong";"{comedy,other,tragedy}"
  "freddyjason";"{horror,silliness}"
  </code></pre>
  
  <p>Any help or pointers would be very much appreciated
  (I am using Postgres 9.1)</p>
  
  <hr>
  
  <p>Based on Craig's help I ended up with the following (slightly altered syntax since 9.1 complains about the query exactly as he shows it)</p>
  
  <pre><code>SELECT t1.title, array_agg(DISTINCT tag.tag) 
  FROM my_test t1, (select unnest(tags) as tag,title from my_test) as tag 
  where tag.title=t1.title
  GROUP BY t1.title;
  </code></pre>