From 60cbd7751c1ec6ffdf2ffc520ddeb35cb2f2ed70 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Tue, 7 Apr 2020 15:56:52 -0700 Subject: Remove nbtree BTreeTupleSetAltHeapTID() function. Since heap TID is supposed to be just another key attribute to the implementation, it doesn't make much sense to have separate BTreeTupleSetNAtts() and BTreeTupleSetAltHeapTID() functions. Merge the two functions together. This slightly simplifies _bt_truncate(). --- src/backend/access/nbtree/nbtutils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/backend/access/nbtree/nbtutils.c') diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index 86cec248593..08d7201f196 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @@ -2239,7 +2239,7 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright, */ if (keepnatts <= nkeyatts) { - BTreeTupleSetNAtts(pivot, keepnatts); + BTreeTupleSetNAtts(pivot, keepnatts, false); return pivot; } @@ -2262,11 +2262,13 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright, /* Cannot leak memory here */ pfree(pivot); - /* Store heap TID in enlarged pivot tuple */ + /* + * Store all of firstright's key attribute values plus a tiebreaker heap + * TID value in enlarged pivot tuple + */ tidpivot->t_info &= ~INDEX_SIZE_MASK; tidpivot->t_info |= newsize; - BTreeTupleSetNAtts(tidpivot, nkeyatts); - BTreeTupleSetAltHeapTID(tidpivot); + BTreeTupleSetNAtts(tidpivot, nkeyatts, true); pivotheaptid = BTreeTupleGetHeapTID(tidpivot); /* -- cgit v1.2.3