Re: Question on the right way to think about order by

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Paula Kirsch <pl(dot)kirsch(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Question on the right way to think about order by
Date: 2018-07-03 15:07:45
Message-ID: CAKFQuwbVVTAPyXc7dRoooiMnbGFdHosKF44jusm91VUNF89y-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday, July 3, 2018, Paula Kirsch <pl(dot)kirsch(at)gmail(dot)com> wrote:
>
> When I think about order by in an aggregate statement, e.g.
>
> select string_agg(product, ' | ' order by product) from products;
>
>
> is it correct to think of order by as a parameter passed to string_agg?
>

For a user it's simply the order that rows are passed into the function.
If the state transition aspect retains order this is how you can control
it. The function itself doesn't really ever see the parameter, it just
sees ordered data.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mathieu PUJOL 2018-07-03 15:35:17 Re: Analyze plan of foreign data wrapper
Previous Message Paula Kirsch 2018-07-03 14:26:59 Question on the right way to think about order by