postgresql/src/backend/access
Peter Geoghegan 0f08df4068 Avoid treating nonrequired nbtree keys as required.
Consistently prevent nbtree array advancement from treating a scankey as
required when operating in pstate.forcenonrequired mode.  Otherwise, we
risk a NULL pointer dereference.  This was possible in the path where
_bt_check_compare is called to recheck a tuple that advanced all of the
scan's arrays to matching values: its continuescan=false handling
expects _bt_advance_array_keys to have been called with a valid pstate,
but it'll always be NULL during sktrig_required=false calls (which is
how _bt_advance_array_keys must be called when pstate.forcenonrequired).

Oversight in commit 8a510275, which optimized nbtree search scan key
comparisons.

Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://postgr.es/m/CAHgHdKsn2W=gPBmj7p6MjQFvxB+zZDBkwTSg0o3f5Hh8rkRrsA@mail.gmail.com
Discussion: https://postgr.es/m/CAH2-WzmodSE+gpTd1CRGU9ez8ytyyDS+Kns2r9NzgUp1s56kpw@mail.gmail.com
2025-05-02 17:50:58 -04:00
..
brin Use PRI?64 instead of "ll?" in format strings (continued). 2025-03-29 10:43:57 +01:00
common Allow NOT NULL constraints to be added as NOT VALID 2025-04-07 19:19:50 +02:00
gin Fix memory leak in _gin_parallel_merge 2025-05-02 23:05:18 +02:00
gist Add maintenance_io_concurrency flag to some read stream users 2025-04-28 14:19:45 -04:00
hash Show index search count in EXPLAIN ANALYZE, take 2. 2025-03-11 09:20:50 -04:00
heap Comment on need to MarkBufferDirty() if omitting DELAY_CHKPT_START. 2025-04-20 12:00:17 -07:00
index Relax ordering-related hardcoded btree requirements in planning 2025-04-06 14:43:51 +02:00
nbtree Avoid treating nonrequired nbtree keys as required. 2025-05-02 17:50:58 -04:00
rmgrdesc Use PRI?64 instead of "ll?" in format strings (continued). 2025-03-29 10:43:57 +01:00
sequence Update copyright for 2025 2025-01-01 11:21:55 -05:00
spgist Add maintenance_io_concurrency flag to some read stream users 2025-04-28 14:19:45 -04:00
table Remove table AM callback scan_bitmap_next_block 2025-03-15 10:37:46 -04:00
tablesample Update copyright for 2025 2025-01-01 11:21:55 -05:00
transam Fix a couple of comment typos 2025-04-30 13:40:46 +12:00
Makefile Introduce sequence_*() access functions 2024-02-26 16:04:59 +09:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00