pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix hypothetical bug in heap backward scans
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 06:52 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 06:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/16dfe253e31f75b60e93acc0c2b5bbf19936c074

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 06:53 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 06:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7632ef5a71af0bef8384ceaa44d5486d555d8394

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 06:53 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 06:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/06cdfe21d3233e3010d5332d60f27886c28b1a25

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 06:54 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 06:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/34eeebbb03037e60606e5f6748c46a789eecd308

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 07:00 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 07:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/712ce074a841bf4a0cf0eb372ece19726e3726dd

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 07:01 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 07:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/317de9c45d88dd67718b4e411e2918ffbc96f5ae

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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

* pgsql: Fix hypothetical bug in heap backward scans
@ 2021-01-25 07:01 David Rowley <drowley@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: David Rowley @ 2021-01-25 07:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: https://postgr.es/m/CAApHDvpGc9h0_oVD2CtgBcxCS1N-qDYZSeBRnUh+0CWJA9cMaA@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9b1f8af47e359e3f17177a9c18b3750add407e03

Modified Files
--------------
src/backend/access/heap/heapam.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2021-01-25 07:01 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 06:52 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>
2021-01-25 06:53 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>
2021-01-25 06:53 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>
2021-01-25 06:54 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>
2021-01-25 07:00 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>
2021-01-25 07:01 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>
2021-01-25 07:01 pgsql: Fix hypothetical bug in heap backward scans David Rowley <drowley@postgresql.org>

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