Re: min/max aggregation for jsonb

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>, Daneel Yaitskov <dyaitskov(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: min/max aggregation for jsonb
Date: 2023-05-02 08:47:21
Message-ID: 1b6efed7-0e46-7c4a-6443-81daee6d10ad@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03.03.23 11:41, David Rowley wrote:
> On Fri, 3 Mar 2023 at 23:17, Daneel Yaitskov <dyaitskov(at)gmail(dot)com> wrote:
>> I wanted to use min/max aggregation functions for jsonb type and noticed
>> there is no functions for this type, meanwhile string/array types are supported.
>
> It's not really clear to me how you'd want these to sort. If you just
> want to sort by what the output that you see from the type's output
> function then you might get what you need by casting to text.
>
>> Is there a concern about implementing support for jsonb in min/max?
>
> I imagine a lack of any meaningful way of comparing two jsonb values
> to find out which is greater than the other is of some concern.

We already have ordering operators and operator classes for jsonb, so
sticking min/max aggregates around that should be pretty straightforward.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Benoit Lobréau 2023-05-02 10:44:58 Re: Logging parallel worker draught
Previous Message Niyas Sait 2023-05-02 07:51:09 Re: [PATCH] Add native windows on arm64 support