pgsql: Fix YA incremental sort bug.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix YA incremental sort bug.
Date: 2021-02-05 00:12:29
Message-ID: E1l7ojd-0002cx-JV@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix YA incremental sort bug.

switchToPresortedPrefixMode() did the wrong thing if it detected
a batch boundary just at the last tuple of a fullsort group.

The initially-reported symptom was a "retrieved too many tuples in a
bounded sort" error, but the test case added here just silently gives
the wrong answer without this patch.

I (tgl) am not really happy about committing this patch without review
from the incremental-sort authors, but they seem AWOL and we are hard
against a release deadline. This does demonstrably make some cases
better, anyway.

Per bug #16846 from Yoran Heling. Back-patch to v13 where incremental
sort was introduced.

Neil Chen

Discussion: https://postgr.es/m/16846-ae49f51ac379a4cb@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/10fcb83da6a7c5328f61ca7fb60f78c57db1bd58

Modified Files
--------------
src/backend/executor/nodeIncrementalSort.c | 7 +++++++
src/test/regress/expected/incremental_sort.out | 11 +++++++++++
src/test/regress/sql/incremental_sort.sql | 3 +++
3 files changed, 21 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2021-02-05 02:50:16 pgsql: Tab-complete CREATE DATABASE ... LOCALE.
Previous Message Peter Geoghegan 2021-02-04 23:43:44 pgsql: Harden nbtree page deletion.