On Sat, 27 Jan 2024 at 11:33, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
> Simply commenting out the ORDER BY clause in the string_agg causes the correct result to appear, even with the UNION ALL present. Removing the union all and leaving the order by likewise still produces the correct result.
Are the results correct if you SET enable_presorted_aggregate=0;?
David