postgresql/src/backend
Peter Geoghegan 748d871b7c Fix nbtree skip array parallel alloc accounting.
btestimateparallelscan neglected to add btps_arrElems[] space overhead
for skip array scan keys that were later output by nbtree preprocessing.
Skip arrays don't actually need to use this space, but a scan with a
subsequent SAOP array will need to subscript btps_arrElems[] using a
simple so->arrayKeys[]-wise offset.  so->arrayKeys[] has entries for
both kinds of arrays.

As a result of this oversight, it was possible for an index scan with a
skip array and a lower-order SAOP array to write past the allocated
shared memory boundary when storing the SAOP array's cur_elem.  In
practice the problem seems to be limited to scans with many skipped
index columns, since our general approach to estimating the amount of
shared memory that will be required is fairly conservative.

To fix, have btestimateparallelscan request an extra sizeof(int) space
for key columns that might require a skip array later on.

Oversight in commit 92fe23d9, which added the nbtree skip scan
optimization.

Author: Siddharth Kothari <sidkot@google.com>
Discussion: https://postgr.es/m/CAGCUe0Lwk3C0qdkBa+OLpYc7yXwW=pbaz8Sju4xMXEQAmyp+5g@mail.gmail.com
Backpatch-through: 18
2026-04-29 11:22:23 -04:00
..
access Fix nbtree skip array parallel alloc accounting. 2026-04-29 11:22:23 -04:00
archive Don't include wait_event.h in pgstat.h 2026-03-06 16:24:58 +01:00
backup Online enabling and disabling of data checksums 2026-04-03 22:58:51 +02:00
bootstrap Rework signal handler infrastructure to pass sender info as argument. 2026-04-15 07:30:34 -04:00
catalog Don't call CheckAttributeType() with InvalidOid on dropped cols 2026-04-23 21:28:26 +03:00
commands Fix wrong datum conversion for subretentionactive in CreateSubscription. 2026-04-28 13:13:47 +05:30
executor Fix incorrect logic for hashed IN / NOT IN with non-strict operators 2026-04-24 14:03:12 +12:00
foreign Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
jit jit: No backport::SectionMemoryManager for LLVM 22. 2026-04-03 14:55:11 +13:00
lib Fix a set of typos and grammar issues across the tree 2026-04-21 14:46:22 +09:00
libpq Fix a set of typos and grammar issues across the tree 2026-04-21 14:46:22 +09:00
main Update copyright for 2026 2026-01-01 13:24:10 -05:00
nodes Fix DELETE/UPDATE FOR PORTION OF with rules 2026-04-27 10:34:06 +02:00
optimizer Fix bogus calls in remove_self_join_rel() 2026-04-27 10:40:37 +09:00
parser Fix collation of expressions in GRAPH_TABLE COLUMNS clause 2026-04-24 08:43:26 +02:00
partitioning Add missing Datum conversions 2026-04-20 07:22:16 +02:00
po Update copyright for 2026 2026-01-01 13:24:10 -05:00
port Rework signal handler infrastructure to pass sender info as argument. 2026-04-15 07:30:34 -04:00
postmaster Fix new-to-v19 -Wshadow warnings 2026-04-23 16:49:29 +12:00
regex Use fallthrough attribute instead of comment 2026-02-19 08:51:12 +01:00
replication Fix xid_advance_interval when max_retention_duration is 0. 2026-04-28 14:51:38 +05:30
rewrite Fix typos and grammar in graph table rewrite code 2026-04-24 08:27:04 +02:00
snowball Fix meson build of snowball code. 2026-01-05 16:51:36 -05:00
statistics Fix a set of typos and grammar issues across the tree 2026-04-21 14:46:22 +09:00
storage Harmonize function parameter names for Postgres 19. 2026-04-22 12:47:19 -04:00
tcop Rework signal handler infrastructure to pass sender info as argument. 2026-04-15 07:30:34 -04:00
tsearch Prevent some buffer overruns in spell.c's parsing of affix files. 2026-04-22 12:02:15 -04:00
utils Cosmetic fixes for radix sort 2026-04-29 16:14:25 +07:00
.gitignore
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile ssl: Serverside SNI support for libpq 2026-03-18 12:37:11 +01:00
meson.build Add CONCURRENTLY option to REPACK 2026-04-06 21:55:08 +02:00
nls.mk Create a separate file listing backend types 2025-09-26 15:21:49 +02:00