Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 962ab47

Browse files
committed
Fix GiST buffering build to work when there are included columns.
gistRelocateBuildBuffersOnSplit did not get the memo about which attribute count to use. This could lead to a crash if there were included columns and buffering build was chosen. (Because there are random page-split decisions elsewhere in GiST index build, the crashes are not entirely deterministic.) Back-patch to v12 where GiST gained support for included columns. Pavel Borisov Discussion: https://postgr.es/m/CALT9ZEECCV5m7wvxg46PC-7x-EybUmnpupBGhSFMoAAay+r6HQ@mail.gmail.com
1 parent 9343bfe commit 962ab47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/access/gist/gistbuildbuffers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
666666
zero_penalty = true;
667667

668668
/* Loop over index attributes. */
669-
for (j = 0; j < r->rd_att->natts; j++)
669+
for (j = 0; j < IndexRelationGetNumberOfKeyAttributes(r); j++)
670670
{
671671
float usize;
672672

@@ -692,7 +692,7 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
692692
which = i;
693693
best_penalty[j] = usize;
694694

695-
if (j < r->rd_att->natts - 1)
695+
if (j < IndexRelationGetNumberOfKeyAttributes(r) - 1)
696696
best_penalty[j + 1] = -1;
697697
}
698698
else if (best_penalty[j] == usize)

0 commit comments

Comments
 (0)