Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b42a89

Browse files
Consistently truncate non-key suffix columns.
INCLUDE indexes failed to have their non-key attributes physicallytruncated away in certain rare cases. This led to physically largerpivot tuples that contained useless non-key attribute values. Theimpact on users should be negligible, but this is still clearly aregression (Postgres 11 supports INCLUDE indexes, and yet was notaffected).The bug appeared in commitdd299df, which introduced "true" suffixtruncation of key attributes.Discussion:https://postgr.es/m/CAH2-Wz=E8pkV9ivRSFHtv812H5ckf8s1-yhx61_WrJbKccGcrQ@mail.gmail.comBackpatch: 12-, where "true" suffix truncation was introduced.
1 parent911e702 commit4b42a89

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/backend/access/nbtree/nbtutils.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,8 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright,
22052205
{
22062206
IndexTupletidpivot;
22072207

2208-
pivot=index_truncate_tuple(itupdesc,firstright,keepnatts);
2208+
pivot=index_truncate_tuple(itupdesc,firstright,
2209+
Min(keepnatts,nkeyatts));
22092210

22102211
if (BTreeTupleIsPosting(pivot))
22112212
{
@@ -2250,6 +2251,10 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright,
22502251
/*
22512252
* No truncation was possible, since key attributes are all equal.
22522253
* It's necessary to add a heap TID attribute to the new pivot tuple.
2254+
*
2255+
* This path is only taken when rel is not an INCLUDE index. It
2256+
* avoids a second palloc0() by avoiding the index_truncate_tuple()
2257+
* call completely.
22532258
*/
22542259
Assert(natts==nkeyatts);
22552260
newsize=IndexTupleSize(firstright)+MAXALIGN(sizeof(ItemPointerData));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp