Re: BUG #19751: MIN aggregate + FETCH FIRST 1 ROW WITH TIES causes false 21000 error when index scan is forced

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: 1482694023(at)qq(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19751: MIN aggregate + FETCH FIRST 1 ROW WITH TIES causes false 21000 error when index scan is forced
Date: 2026-10-05 15:21:10
Message-ID: 680155.1791213670@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:
> SELECT MIN(reading) AS minimum
> FROM (
> SELECT reading
> FROM readings
> WHERE region_id = 2
> ) AS scoped
> ORDER BY minimum
> FETCH FIRST 1 ROW WITH TIES;
> Observed result:
> ERROR: more than one row returned by a subquery used as an expression

Thanks for the report, but this was reported and fixed a couple
weeks ago:

https://www.postgresql.org/message-id/flat/19694-4e61bd0475398eef%40postgresql.org

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Rahul 2026-10-05 16:57:38 Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs
Previous Message shihao zhong 2026-10-05 15:10:53 Re: BUG #17545: Incorrect selectivity for IS NOT DISTINCT FROM and NULLs