Skip to content

Commit f01172b

Browse files
committed
Fix check for GTT index initialization
1 parent ceb5188 commit f01172b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/optimizer/util/plancat.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void set_baserel_partition_constraint(Relation relation,
8383
RelOptInfo *rel);
8484

8585
static bool
86-
index_is_valid(Relation index)
86+
is_index_valid(Relation index)
8787
{
8888
if (!index->rd_index->indisvalid)
8989
return false;
@@ -93,12 +93,12 @@ index_is_valid(Relation index)
9393
Buffer metapage = ReadBuffer(index, 0);
9494
bool isNew = PageIsNew(BufferGetPage(metapage));
9595
ReleaseBuffer(metapage);
96-
DropRelFileNodeAllLocalBuffers(index->rd_smgr->smgr_rnode.node);
9796
if (isNew)
9897
{
99-
Relation heap = RelationIdGetRelation(index->rd_index->indrelid);
100-
index->rd_indam->ambuild(heap, index,
101-
BuildIndexInfo(index));
98+
Relation heap;
99+
DropRelFileNodeAllLocalBuffers(index->rd_smgr->smgr_rnode.node);
100+
heap = RelationIdGetRelation(index->rd_index->indrelid);
101+
index->rd_indam->ambuild(heap, index, BuildIndexInfo(index));
102102
RelationClose(heap);
103103
}
104104
}
@@ -229,7 +229,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
229229
* still needs to insert into "invalid" indexes, if they're marked
230230
* indisready.
231231
*/
232-
if (!index_is_valid(indexRelation))
232+
if (!is_index_valid(indexRelation))
233233
{
234234
index_close(indexRelation, NoLock);
235235
continue;
@@ -728,7 +728,7 @@ infer_arbiter_indexes(PlannerInfo *root)
728728
idxRel = index_open(indexoid, rte->rellockmode);
729729
idxForm = idxRel->rd_index;
730730

731-
if (!index_is_valid(idxRel))
731+
if (!is_index_valid(idxRel))
732732
goto next;
733733

734734
/*

0 commit comments

Comments
 (0)