@@ -255,7 +255,7 @@ InsertTuples(Relation index, IvfflatBuildState * buildstate, ForkNumber forkNum)
255
255
int64 inserted = 0 ;
256
256
257
257
TupleTableSlot * slot = MakeSingleTupleTableSlot (buildstate -> sortdesc , & TTSOpsMinimalTuple );
258
- TupleDesc tupdesc = RelationGetDescr ( index ) ;
258
+ TupleDesc tupdesc = buildstate -> tupdesc ;
259
259
260
260
pgstat_progress_update_param (PROGRESS_CREATEIDX_SUBPHASE , PROGRESS_IVFFLAT_PHASE_LOAD );
261
261
@@ -319,6 +319,7 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In
319
319
buildstate -> index = index ;
320
320
buildstate -> indexInfo = indexInfo ;
321
321
buildstate -> typeInfo = IvfflatGetTypeInfo (index );
322
+ buildstate -> tupdesc = RelationGetDescr (index );
322
323
323
324
buildstate -> lists = IvfflatGetLists (index );
324
325
buildstate -> dimensions = TupleDescAttr (index -> rd_att , 0 )-> atttypmod ;
@@ -359,7 +360,7 @@ InitBuildState(IvfflatBuildState * buildstate, Relation heap, Relation index, In
359
360
buildstate -> sortdesc = CreateTemplateTupleDesc (3 );
360
361
TupleDescInitEntry (buildstate -> sortdesc , (AttrNumber ) 1 , "list" , INT4OID , -1 , 0 );
361
362
TupleDescInitEntry (buildstate -> sortdesc , (AttrNumber ) 2 , "tid" , TIDOID , -1 , 0 );
362
- TupleDescInitEntry (buildstate -> sortdesc , (AttrNumber ) 3 , "vector" , RelationGetDescr ( index ) -> attrs [0 ].atttypid , -1 , 0 );
363
+ TupleDescInitEntry (buildstate -> sortdesc , (AttrNumber ) 3 , "vector" , buildstate -> tupdesc -> attrs [0 ].atttypid , -1 , 0 );
363
364
364
365
buildstate -> slot = MakeSingleTupleTableSlot (buildstate -> sortdesc , & TTSOpsVirtual );
365
366
0 commit comments