title: PostgreSQL count array values
body: <p>What I would like is to count the array elements which corresponds to true (attendance), false (non-attendance) and NULL for any single event.</p>
  
  <p>EDIT:</p>
  
  <p>I just realized that arrays do not behave as I thought in pSQL, so a simple</p>
  
  <pre><code>userconfirm bool[]
  </code></pre>
  
  <p>Might suffice. However, I am still having the same problem counting true/false/null values. I will attempt to edit the question below to match this new constraint. I apologize for any errors.</p>
  
  <hr>
  
  <p>I have a column such as</p>
  
  <pre><code>userconfirm bool[]
  </code></pre>
  
  <p>Where <code>userconfirm[314] = true</code> would mean that user #314 will attend. (false = no attend, NULL = not read/etc).</p>
  
  <p>I'm not sure this is the best solution for this functionality (users announce their attendance to an event), but I am having trouble with an aggregate function on this column.</p>
  
  <pre><code>select count(*) from foo where id = 6 AND true = ANY (userconfirm);
  </code></pre>
  
  <p>This only returns 1, and trying to google "counting arrays" does not turn up anything useful.</p>
  
  <p>How would I go about counting the different values for a single event?</p>