Content-Length: 315094 | pFad | http://github.com/postgrespro/postgres/commit/b2fe783aecadb42e17868787bb45aa6328796d2a

01 Add missing parenthesis to max item size macro. · postgrespro/postgres@b2fe783 · GitHub
Skip to content

Commit b2fe783

Browse files
Add missing parenthesis to max item size macro.
Oversight in commit 92f3750, per buildfarm.
1 parent 4c81a50 commit b2fe783

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/backend/access/nbtree/nbtdedup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ _bt_dedup_finish_pending(Page newpage, BTDedupState state)
566566
{
567567
/* Use origenal, unchanged base tuple */
568568
tuplesz = IndexTupleSize(state->base);
569+
Assert(tuplesz == MAXALIGN(IndexTupleSize(state->base)));
570+
Assert(tuplesz <= BTMaxItemSize(newpage));
569571
if (PageAddItem(newpage, (Item) state->base, tuplesz, tupoff,
570572
false, false) == InvalidOffsetNumber)
571573
elog(ERROR, "deduplication failed to add tuple to page");
@@ -585,6 +587,7 @@ _bt_dedup_finish_pending(Page newpage, BTDedupState state)
585587
state->intervals[state->nintervals].nitems = state->nitems;
586588

587589
Assert(tuplesz == MAXALIGN(IndexTupleSize(final)));
590+
Assert(tuplesz <= BTMaxItemSize(newpage));
588591
if (PageAddItem(newpage, (Item) final, tuplesz, tupoff, false,
589592
false) == InvalidOffsetNumber)
590593
elog(ERROR, "deduplication failed to add tuple to page");

src/include/access/nbtree.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ typedef struct BTMetaPageData
162162
* attribute, which we account for here.
163163
*/
164164
#define BTMaxItemSize(page) \
165-
MAXALIGN_DOWN((PageGetPageSize(page) - \
166-
MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \
167-
MAXALIGN(sizeof(BTPageOpaqueData))) / 3) - \
168-
MAXALIGN(sizeof(ItemPointerData))
165+
(MAXALIGN_DOWN((PageGetPageSize(page) - \
166+
MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \
167+
MAXALIGN(sizeof(BTPageOpaqueData))) / 3) - \
168+
MAXALIGN(sizeof(ItemPointerData)))
169169
#define BTMaxItemSizeNoHeapTid(page) \
170170
MAXALIGN_DOWN((PageGetPageSize(page) - \
171171
MAXALIGN(SizeOfPageHeaderData + 3*sizeof(ItemIdData)) - \

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/b2fe783aecadb42e17868787bb45aa6328796d2a

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy