title: PostgreSQL left join query object array aggregate
body: <p>I have 2 tables:</p>
  
  <pre><code>table "person" with columns: person_id, person_name
  table "pet" with columns: pet_id, owner_id, pet_name
  
  person data:
  1, 'John'
  2, 'Jill'
  3, 'Mary'
  
  pet data:
  1, 1, 'Fluffy'
  2, 1, 'Buster'
  3, 2, 'Doggy'
  </code></pre>
  
  <p>How to write select query from <code>person</code> left join <code>pet</code> on <code>person_id = owner_id</code> with aggregate functions so my result data looks like:</p>
  
  <pre><code>1,[{pet_id:1,pet_name:'Fluffy'},{pet_id:2,pet_name:'Buster'}],'John'
  2,[{pet_id:3,pet_name:'Doggy'}],'Jill'
  3,[],'Mary'
  </code></pre>