Re: DISTINCT aggregate crashes when ORDER BY repeats its argument

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DISTINCT aggregate crashes when ORDER BY repeats its argument
Date: 2026-11-06 07:23:42
Message-ID: CAApHDvptd8wVr9LgwCSgrO-WRm6PMEBiOuXPJKBJeetM9e1=cA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 6 Nov 2026 at 06:22, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> wrote:
> This crashes the backend on master:
>
> CREATE TABLE t (x text);
> INSERT INTO t VALUES ('a'), ('a'), ('b');
> SELECT array_agg(DISTINCT x ORDER BY x USING ~<~, x USING <)
> FROM t;

Thanks. I've gone over that and added a test for multiple ORDER BY
columns without DISTINCT. Adjusted a few comments, made the required
adjustments for v14 and v15, and pushed.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2026-11-06 07:45:29 Re: Call CalculateShmemSize() only once
Previous Message Ashutosh Sharma 2026-11-06 07:04:03 Re: log XLogPrefetch stats at end of recovery