title: "could not identify an equality operator for type json" when using distinct
body: <p>I have the following query:</p>
  <pre><code>SELECT 
    distinct(date(survey_results.created_at)), 
    json_build_object(
      'high', 
      ROUND( 
        COUNT(*) FILTER (WHERE ( scores#&gt;&gt;'{medic,categories,motivation}' in('high', 'medium'))) OVER(order by date(survey_results.created_at) ) * 1.0 / 
        (
          CASE (COUNT(*) FILTER (WHERE (scores#&gt;&gt;'{medic,categories,motivation}' in('high','medium','low'))) OVER(order by date(survey_results.created_at))) 
          WHEN 0.0 THEN 1.0 
          ELSE (COUNT(*) FILTER (WHERE (scores#&gt;&gt;'{medic,categories,motivation}' in('high','medium','low'))) OVER(order by date(survey_results.created_at))) 
          END)* 100, 2 ) ) AS childcare FROM survey_results GROUP BY date, scores ORDER BY date asc; 
  </code></pre>
  <p>The problem is with using <code>distinct(date(survey_results.created_at))</code>. With that in place query returns error:</p>
  <pre><code>could not identify an equality operator for type json
  </code></pre>
  <p><a href="https://www.db-fiddle.com/f/vUBjUyKDUNLWzySHKCKcXA/1" rel="nofollow noreferrer">Here is db fiddle</a> that show that problem. How can I fix that?</p>