agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix incorrect block accounting in TID Range Scans
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:19 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/374522aa63af1187c15dd21db0b2c988b55c9a3a

Modified Files
--------------
src/backend/access/heap/heapam.c           | 20 +++++++++++---------
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++++++
3 files changed, 49 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:19 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ad230d58883b40bae3e5cc7bc04a80b8a790ee1a

Modified Files
--------------
src/backend/access/heap/heapam.c           | 20 +++++++++++---------
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++++++
3 files changed, 49 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:20 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/39a0db101105eab3f4044d11c609c58b9459ea16

Modified Files
--------------
src/backend/access/heap/heapam.c           | 20 +++++++++++---------
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++++++
3 files changed, 49 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:20 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/25ebf0097fcc1aaf7bb56816e7508142c1613ab9

Modified Files
--------------
src/backend/access/heap/heapam.c           | 20 +++++++++++---------
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++++++
3 files changed, 49 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:21 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6ceac2e125025ca9e392a851a979807ee4dba176

Modified Files
--------------
src/backend/access/heap/heapam.c           | 20 +++++++++++---------
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++++++
3 files changed, 49 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:21 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/cd7d3e129b79ee41c03001550b43b160e10c2f30

Modified Files
--------------
src/backend/access/heap/heapam.c           | 48 +++++++++++++++++++++++++-----
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++
3 files changed, 78 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix incorrect block accounting in TID Range Scans
@ 2026-09-23 13:22 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2026-09-23 13:22 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect block accounting in TID Range Scans

heapgettup_advance_block() (or heapgettup() and heapgettup_pagemode() in
versions before v16) would incorrectly decrement rs_numblocks when
advancing to the next block.  Ordinarily this was fine, but if the TID
Range scan plan was used by a scrollable cursor and the cursor was fetched
backwards enough to result in another block being required, then
rs_numblocks may have reached 0 prematurely resulting in the scan ending
prematurely.

Reported-by: Jeff Davis <pgsql@j-davis.com>
Author: Ewan Young <kdbase.hack@gmail.com>
Discussion: https://postgr.es/m/6b50233fcc0f7d6f4845f083777fa9702d9612e4.camel@j-davis.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c84dd31bd9f5c2ba1ca79615d405ea0bf00c51a2

Modified Files
--------------
src/backend/access/heap/heapam.c           | 48 +++++++++++++++++++++++++-----
src/test/regress/expected/tidrangescan.out | 26 ++++++++++++++++
src/test/regress/sql/tidrangescan.sql      | 12 ++++++++
3 files changed, 78 insertions(+), 8 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-09-23 13:22 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 13:19 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>
2026-09-23 13:19 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>
2026-09-23 13:20 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>
2026-09-23 13:20 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>
2026-09-23 13:21 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>
2026-09-23 13:21 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>
2026-09-23 13:22 pgsql: Fix incorrect block accounting in TID Range Scans David Rowley <drowley@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox