title: ERROR: WITHIN GROUP is required for ordered-set aggregate mode
body: <p>I have been using Postgres (version 9.2 and 9.3) with this function: <a href="https://wiki.postgresql.org/wiki/Aggregate_Mode" rel="nofollow">https://wiki.postgresql.org/wiki/Aggregate_Mode</a> for a while. Now recently after upgrading to version 9.4 I run into the following error when using the function:</p>
  
  <blockquote>
  <pre><code>PG::WrongObjectType: ERROR:  WITHIN GROUP is required for ordered-set aggregate mode
         LINE 1: SELECT  mode(logins_count) AS mode_value FROM "registrations"  WHERE "registrations"."cr...
  </code></pre>
  </blockquote>
  
  <p>The error occurs when doing:</p>
  
  <pre><code>SELECT mode(logins_count) AS mode_value FROM registrations
  WHERE registrations.created_at &gt; '20141105';
  </code></pre>
  
  <p>I do not understand the error message and I do not get what I have to change?</p>