diff options
author | Peter Geoghegan <pg@bowt.ie> | 2019-11-18 13:04:53 -0800 |
---|---|---|
committer | Peter Geoghegan <pg@bowt.ie> | 2019-11-18 13:04:53 -0800 |
commit | 2110f716965fe1ac5af83380aa108541b1457e0d (patch) | |
tree | cd4694ba332f93ba4c6dcb1a025bf06816d54f19 | |
parent | bf2efc55da9a1a33da32fa383db9db2f2c49b2cb (diff) | |
download | postgresql-2110f716965fe1ac5af83380aa108541b1457e0d.tar.gz postgresql-2110f716965fe1ac5af83380aa108541b1457e0d.zip |
nbtree: Tweak _bt_pgaddtup() comments.
Make it clear that _bt_pgaddtup() truncates the first data item on an
internal page because its key is supposed to be treated as minus
infinity within _bt_compare().
-rw-r--r-- | src/backend/access/nbtree/nbtinsert.c | 9 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtsort.c | 7 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index b84bf1c3dfa..b93b2a0ffd6 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -2230,10 +2230,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) * * The main difference between this routine and a bare PageAddItem call * is that this code knows that the leftmost index tuple on a non-leaf - * btree page doesn't need to have a key. Therefore, it strips such - * tuples down to just the tuple header. CAUTION: this works ONLY if - * we insert the tuples in order, so that the given itup_off does - * represent the final position of the tuple! + * btree page has a key that must be treated as minus infinity. + * Therefore, it truncates away all attributes. CAUTION: this works + * ONLY if we insert the tuples in order, so that the given itup_off + * does represent the final position of the tuple! */ static bool _bt_pgaddtup(Page page, @@ -2248,7 +2248,6 @@ _bt_pgaddtup(Page page, { trunctuple = *itup; trunctuple.t_info = sizeof(IndexTupleData); - /* Deliberately zero INDEX_ALT_TID_MASK bits */ BTreeTupleSetNAtts(&trunctuple, 0); itup = &trunctuple; itemsize = sizeof(IndexTupleData); diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index c11a3fb570d..fc7d43a0f31 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -756,9 +756,9 @@ _bt_slideleft(Page page) * Add an item to a page being built. * * The main difference between this routine and a bare PageAddItem call - * is that this code knows that the leftmost data item on a non-leaf - * btree page doesn't need to have a key. Therefore, it strips such - * items down to just the item header. + * is that this code knows that the leftmost data item on a non-leaf btree + * page has a key that must be treated as minus infinity. Therefore, it + * truncates away all attributes. * * This is almost like nbtinsert.c's _bt_pgaddtup(), but we can't use * that because it assumes that P_RIGHTMOST() will return the correct @@ -778,7 +778,6 @@ _bt_sortaddtup(Page page, { trunctuple = *itup; trunctuple.t_info = sizeof(IndexTupleData); - /* Deliberately zero INDEX_ALT_TID_MASK bits */ BTreeTupleSetNAtts(&trunctuple, 0); itup = &trunctuple; itemsize = sizeof(IndexTupleData); |