Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)
От
David G. Johnston
Тема
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)
Дата
Msg-id
CAKFQuwZHTBSz-ELu0Qrdv0tuAUh3B7pFnvAVKnGnUjvj0U33fQ@mail.gmail.com
Ответ на
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) (David G. Johnston)
Список
Дерево обсуждения
DISTINCT *and* ORDER BY in aggregate functions on expressions(!) mirabilos <tg@evolvis.org>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) Tom Lane <tgl@sss.pgh.pa.us>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) "David G. Johnston" <david.g.johnston@gmail.com>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) Thorsten Glaser <tg@evolvis.org>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) Tom Lane <tgl@sss.pgh.pa.us>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Thorsten Glaser <tg@evolvis.org>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Alban Hertroys <haramrae@gmail.com>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Thorsten Glaser <tg@evolvis.org>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Alban Hertroys <haramrae@gmail.com>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Thorsten Glaser <tg@evolvis.org>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Alban Hertroys <haramrae@gmail.com>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y Thorsten Glaser <tg@evolvis.org>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) "David G. Johnston" <david.g.johnston@gmail.com>
Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!) "David G. Johnston" <david.g.johnston@gmail.com>
On Mon, Feb 27, 2023 at 5:22 PM David G. Johnston <david.g.johnston@gmail.com> wrote:
Lastly, if you do need to care about normalizing the output of JSON you should consider writing a function that takes arbitrary json input and reformats it, rather than trying to build up json from scratch where every individual component needs to be aware and take action. i.e., get rid of the ORDER BY also. Maybe this belongs in an application layer with tooling that already provides this capability.
Just to clarify/correct myself - if building up json arrays you'll just remove the distinct and then do a normal aggregate order by based upon whatever ordering the base data presents. I was thinking you were doing order by to get keys in order (i.e., jsonb_object_agg) but that isn't the case here.
David J.
В списке pgsql-general по дате отправления
От: David G. Johnston
Дата:
От: Jan Bilek
Дата: