postgres.git / summary / log / commit / refs

commit    897e79486296d136855734a34de062eadfe3199b
Author:   Alexander Korotkov <akorotkov@postgresql.org>
Date:     Sat Jun 13 23:49:05 2026 +0000
First released in: 14.24, 15.19, 16.15, 17.11, 18.6

    amcheck: Use correct varlena size accessor in bt_normalize_tuple()
    
    bt_normalize_tuple() uses VARSIZE() to get the size of varlena, even though
    it's not yet known, that it has a 4-byte header.  Fix this by replacing a
    accessor with a universal VARSIZE_ANY().
    
    Backpatch to all supported versions.
    
    Reported-by: Andres Freund <andres@anarazel.de>
    Discussion: https://postgr.es/m/7ckc7oka4bvafkf5bwlqs6ygrhlsbhz25ppozfch7zbuxcx3rf%40e4pr4oqenalc
    Author: Andrey Borodin <x4mmm@yandex-team.ru>
    Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
    Backpatch-through: 14


contrib/amcheck/verify_nbtree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c index 870954d11b8..c7cd8d3f043 100644 --- a/contrib/amcheck/verify_nbtree.c +++ b/contrib/amcheck/verify_nbtree.c @@ -2893,7 +2893,7 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup) ItemPointerGetOffsetNumber(&(itup->t_tid)), RelationGetRelationName(state->rel)))); else if (!VARATT_IS_COMPRESSED(DatumGetPointer(normalized[i])) && - VARSIZE(DatumGetPointer(normalized[i])) > TOAST_INDEX_TARGET && + VARSIZE_ANY(DatumGetPointer(normalized[i])) > TOAST_INDEX_TARGET && (att->attstorage == TYPSTORAGE_EXTENDED || att->attstorage == TYPSTORAGE_MAIN)) { [parent: 10e510423dc3]