title: Select into a 2D array
body: <p>In PostgreSQL, how can I select some values into a 2D array?</p>
  
  <p>For example, if I want to aggregate a field of data into an array, I would use the ARRAY() constructor or array_agg function e.g.</p>
  
  <pre><code>ARRAY(SELECT s.name FROM myschema.mytable s)
  </code></pre>
  
  <p>How would I go about selecting say, two values, into a 2D array i.e.</p>
  
  <pre><code>2DARRAYFUNCTION(SELECT s.name, s.id FROM ...)
  </code></pre>