title: Aggregate jsonb unique values in one field in postgres
body: <p>I have a dataset like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>     id     |                       recipients_by_data                       
  ------------+------------------------------------------------------------
   1000000001 | {"name": "users", "phone": "users"}
   1000000002 | {"address": "users", "phone": "administrators"}
   1000000003 | {"birthdate": "managers"}
   1000000004 | {"name": "citizens", "phone": "citizens", "gender": "none"}
  ...
  </code></pre>
  
  <p>where recipients is of jsonb type.</p>
  
  <p>I want to aggregate all the recipients value into on field like so:</p>
  
  <pre class="lang-none prettyprint-override"><code>     id     |                       data_recipients                       
  ------------+--------------------------------------------------------
   1000000001 | users
   1000000002 | users, administrators
   1000000003 | managers
   1000000004 | citizens, none
  </code></pre>
  
  <p>How can I achieve this ?</p>