agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use default limitOption in subquery generated for MIN/MAX index
Date: Fri, 18 Sep 2026 15:02:24 +0000
Message-ID: <E1x7a6a-00000000H8x-2fh9@gemulon.postgresql.org> (raw)
Use default limitOption in subquery generated for MIN/MAX index scan.
We unintentionally copied the original query's limitOption field while
building the modified subquery. If it was LIMIT_OPTION_WITH_TIES,
that behavior would propagate through to execution, potentially
causing a "more than one row returned by a subquery used as an
expression" error. Fix by resetting to the default LIMIT_OPTION_COUNT.
This bug dates back to the introduction of WITH TIES.
Bug: #19694
Reported-by: Chaitanya Choudhary <chaitanyyachoudhary@gmail.com>
Author: Chaitanya Choudhary <chaitanyyachoudhary@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19694-4e61bd0475398eef@postgresql.org
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/32872d0c9790e570105f55682e92fba22ae1b38d
Modified Files
--------------
src/backend/optimizer/plan/planagg.c | 1 +
1 file changed, 1 insertion(+)
view thread (7+ messages) latest in thread
Message-ID: <E1x7a6a-00000000H8x-2fh9@gemulon.postgresql.org>
Permalink: ../E1x7a6a-00000000H8x-2fh9@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1x7a6a-00000000H8x-2fh9@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Use default limitOption in subquery generated for MIN/MAX index
In-Reply-To: <E1x7a6a-00000000H8x-2fh9@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox