Re: BUG #19694: MIN()/MAX() fails with "more than one row returned by a subquery" under FETCH FIRST ... WITH TIES

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: chaitanyyachoudhary(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19694: MIN()/MAX() fails with "more than one row returned by a subquery" under FETCH FIRST ... WITH TIES
Date: 2026-09-18 14:43:42
Message-ID: 1011468.1789742622@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> An aggregate query with ORDER BY and FETCH FIRST n ROWS WITH TIES fails
> with an error when the planner chooses the index path for MIN() or MAX().

Thanks for the report, will fix.

> The same code is present on REL_18_STABLE and master as of 2026-09-17.

Seems to have been broken since WITH TIES was implemented.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2026-09-18 15:03:38 Re: BUG #19695: JSON_VALUE ... RETURNING jsonb returns NULL for later evaluation once one evaluation returns NULL
Previous Message Peter Eisentraut 2026-09-18 14:37:21 Re: BUG #19545: Integer truncation of `GinTuple.keylen` causes out-of-bounds read in parallel GIN index build