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

Commit97cda93

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 parentde5b9db commit97cda93

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
@@ -2143,7 +2143,8 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright,
21432143
{
21442144
IndexTupletidpivot;
21452145

2146-
pivot=index_truncate_tuple(itupdesc,firstright,keepnatts);
2146+
pivot=index_truncate_tuple(itupdesc,firstright,
2147+
Min(keepnatts,nkeyatts));
21472148

21482149
/*
21492150
* If there is a distinguishing key attribute within new pivot tuple,
@@ -2173,6 +2174,10 @@ _bt_truncate(Relation rel, IndexTuple lastleft, IndexTuple firstright,
21732174
/*
21742175
* No truncation was possible, since key attributes are all equal.
21752176
* It's necessary to add a heap TID attribute to the new pivot tuple.
2177+
*
2178+
* This path is only taken when rel is not an INCLUDE index. It
2179+
* avoids a second palloc0() by avoiding the index_truncate_tuple()
2180+
* call completely.
21762181
*/
21772182
Assert(natts==nkeyatts);
21782183
newsize=IndexTupleSize(firstright)+MAXALIGN(sizeof(ItemPointerData));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp