title: use distinct and order by in STRING_AGG function
body: <p>I am trying the string_agg a column while at the same time ordering the column and only show unique values. Consider the following demo. IS there a syntax issue or is this simply not possible with the method I am using?</p>
  
  <pre><code>SELECT STRING_AGG(DISTINCT foo.a::TEXT,',' ORDER BY foo.a DESC)
                FROM (
                         SELECT 1 As a
                         UNION ALL
                         SELECT 1
                         UNION ALL
                         SELECT 1
                         UNION ALL
                         SELECT 2
                     ) AS foo
  </code></pre>
  
  <blockquote>
    <p>[2019-11-22 13:29:32] [42P10] ERROR: in an aggregate with DISTINCT, ORDER BY expressions must appear in argument list
    [2019-11-22 13:29:32] Position: 53</p>
  </blockquote>