Skip to content

Commit 77b88bd

Browse files
Add assertions to _bt_update_posting().
Copy some assertions from _bt_form_posting() to its sibling function, _bt_update_posting(). Discussion: https://postgr.es/m/CAH2-WzkPR8KMwkL0ap976kmXwBCeukTeHz6fB-U__wvuP1S9Zg@mail.gmail.com
1 parent ed0d883 commit 77b88bd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/backend/access/nbtree/nbtdedup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ _bt_update_posting(BTVacuumPosting vacposting)
688688
else
689689
newsize = keysize;
690690

691+
Assert(newsize <= INDEX_SIZE_MASK);
692+
Assert(newsize == MAXALIGN(newsize));
693+
691694
/* Allocate memory using palloc0() (matches index_form_tuple()) */
692695
itup = palloc0(newsize);
693696
memcpy(itup, origtuple, keysize);
@@ -721,6 +724,7 @@ _bt_update_posting(BTVacuumPosting vacposting)
721724
Assert(ui == nhtids);
722725
Assert(d == vacposting->ndeletedtids);
723726
Assert(nhtids == 1 || _bt_posting_valid(itup));
727+
Assert(nhtids > 1 || ItemPointerIsValid(&itup->t_tid));
724728

725729
/* vacposting arg's itup will now point to updated version */
726730
vacposting->itup = itup;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy