On Tue, 14 Mar 2023 at 16:07, Ben Clements wrote:
> Similar to your "TOP() and BOTTOM() aggregate" idea, you might find Erwin
> Brandstetter's solution using the LAST() aggregate function interesting:
> (https://dba.stackexchange.com/a/324646/100880)
Interesting. Just note that ORDER BY aggreg
On Tue, 14 Mar 2023 at 21:01, Alban Hertroys wrote:
> > On 7 Mar 2023, at 4:11, David G. Johnston
> > wrote:
> > TOP(city, ROW(population, land_area)) ?
>
> What should be the expected behaviour on a tie though?
Undefined. Same as having an ORDER BY on a column that's not unique.
The sort impl
> On 7 Mar 2023, at 4:11, David G. Johnston wrote:
>
> On Mon, Mar 6, 2023 at 7:51 PM David Rowley wrote:
> On Tue, 7 Mar 2023 at 12:40, Tom Lane wrote:
> >
> > Ben Clements writes:
> > > As shown above, the following calculated column can bring in the city
> > > name,
> > > even though the
Thanks David.
Similar to your "TOP() and BOTTOM() aggregate" idea, you might find Erwin
Brandstetter's solution using the LAST() aggregate function interesting: (
https://dba.stackexchange.com/a/324646/100880)
If the FIRST_LAST_AGG extension is installed, then we can do something like
this:
SELE
On Tue, 7 Mar 2023 at 16:11, David G. Johnston
wrote:
>
> On Mon, Mar 6, 2023 at 7:51 PM David Rowley wrote:
>> the transfn for bottom() would need to remember the city and the
>> population for the highest yet seen value of the 2nd arg.
>
>
> BOTTOM() remembers the highest value?
I was thinking
On Mon, Mar 6, 2023 at 7:51 PM David Rowley wrote:
> On Tue, 7 Mar 2023 at 12:40, Tom Lane wrote:
> >
> > Ben Clements writes:
> > > As shown above, the following calculated column can bring in the city
> name,
> > > even though the city name isn't in the GROUP BY:
> > >max(city) keep (dens
On Tue, 7 Mar 2023 at 12:40, Tom Lane wrote:
>
> Ben Clements writes:
> > As shown above, the following calculated column can bring in the city name,
> > even though the city name isn't in the GROUP BY:
> >max(city) keep (dense_rank first order by population desc)
>
> You haven't really expla
Ben Clements writes:
> As shown above, the following calculated column can bring in the city name,
> even though the city name isn't in the GROUP BY:
>max(city) keep (dense_rank first order by population desc)
You haven't really explained what this does, let alone why it can't
be implemented