pgsql: Use default limitOption in subquery generated for MIN/MAX index - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Use default limitOption in subquery generated for MIN/MAX index
Date
Msg-id E1x7a6a-00000000H99-3AgL@gemulon.postgresql.org
Whole thread
List pgsql-committers
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
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/47c43ffdae795e382903c63fd2169daa6b13be30

Modified Files
--------------
src/backend/optimizer/plan/planagg.c | 1 +
1 file changed, 1 insertion(+)


pgsql-committers by date:

Previous
From: Álvaro Herrera
Date:
Subject: pgsql: Tighten definition of ON CONFLICT arbiter index equivalence
Next
From: Masahiko Sawada
Date:
Subject: pgsql: Fix memory leak in pgoutput with streamed prepared transactions.