pgsql: Use default limitOption in subquery generated for MIN/MAX index

Поиск
Список
Период
Сортировка
Искать

pgsql: Use default limitOption in subquery generated for MIN/MAX index

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
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 
Author: Chaitanya Choudhary 
Reviewed-by: Tom Lane 
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(+)

FAQ