title: Postgres: array_agg throws 'cannot accumulate empty arrays' for empty array(s)
body: <p>Having problems when using <code>array_agg</code> when a row contains an empty array (<code>{}</code>).</p>
  
  <p>This is my SQL query:</p>
  
  <pre><code>SELECT service_name, metric_name, array_agg(value_textarray)
  FROM service_data
  WHERE service_name = 'ActivityDataService'
  GROUP BY service_name, metric_name
  </code></pre>
  
  <p>Where the column definitions are the following:</p>
  
  <pre><code>service_name - text
  metric_name - text
  value_textarray - text[]
  </code></pre>
  
  <p>When I execute the query and I have empty array (<code>{}</code>) in the database, I get the following error:</p>
  
  <pre><code>ERROR:  cannot accumulate empty arrays
  </code></pre>
  
  <p>How should I go about fixing this? </p>