@@ -310,10 +310,10 @@ postgresGetForeignRelSize(PlannerInfo *root,
310
310
{
311
311
for (j = 0 ; j < vops_tupdesc -> natts ; j ++ )
312
312
{
313
- if (strcmp (NameStr (vops_tupdesc -> attrs [ j ] -> attname ), NameStr (fdw_tupdesc -> attrs [ i ] -> attname )) == 0 )
313
+ if (strcmp (NameStr (TupleDescAttr ( vops_tupdesc , j ) -> attname ), NameStr (TupleDescAttr ( fdw_tupdesc , i ) -> attname )) == 0 )
314
314
{
315
315
fpinfo -> vops_attrs = bms_add_member (fpinfo -> vops_attrs , i + 1 - FirstLowInvalidHeapAttributeNumber );
316
- if (vops_get_type (vops_tupdesc -> attrs [ j ] -> atttypid ) != VOPS_LAST )
316
+ if (vops_get_type (TupleDescAttr ( vops_tupdesc , j ) -> atttypid ) != VOPS_LAST )
317
317
{
318
318
fpinfo -> tile_attrs = bms_add_member (fpinfo -> tile_attrs , i + 1 - FirstLowInvalidHeapAttributeNumber );
319
319
}
@@ -685,7 +685,7 @@ postgresIterateForeignScan(ForeignScanState *node)
685
685
/* ordinary column */
686
686
Assert (i <= n_attrs );
687
687
Assert (j < SPI_tuptable -> tupdesc -> natts );
688
- fsstate -> attr_types [i - 1 ] = SPI_tuptable -> tupdesc -> attrs [ j ] -> atttypid ;
688
+ fsstate -> attr_types [i - 1 ] = TupleDescAttr ( SPI_tuptable -> tupdesc , j ) -> atttypid ;
689
689
fsstate -> vops_types [i - 1 ] = vops_get_type (fsstate -> attr_types [i - 1 ]);
690
690
}
691
691
j += 1 ;
@@ -747,7 +747,7 @@ postgresIterateForeignScan(ForeignScanState *node)
747
747
fsstate -> dst_nulls [i ] = false;
748
748
}
749
749
} else {
750
- if (fsstate -> attr_types [i ] == FLOAT8OID && fsstate -> tupdesc -> attrs [ i ] -> atttypid == FLOAT4OID )
750
+ if (fsstate -> attr_types [i ] == FLOAT8OID && TupleDescAttr ( fsstate -> tupdesc , i ) -> atttypid == FLOAT4OID )
751
751
{
752
752
fsstate -> dst_values [i ] = Float4GetDatum ((float )DatumGetFloat8 (fsstate -> src_values [i ]));
753
753
} else {
@@ -1413,7 +1413,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
1413
1413
for (i = 0 ; i < tupdesc -> natts ; i ++ )
1414
1414
{
1415
1415
/* Ignore dropped columns. */
1416
- if (tupdesc -> attrs [ i ] -> attisdropped )
1416
+ if (TupleDescAttr ( tupdesc , i ) -> attisdropped )
1417
1417
continue ;
1418
1418
if (!first ) {
1419
1419
appendStringInfoString (& record , ", " );
@@ -1422,11 +1422,11 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
1422
1422
first = false;
1423
1423
1424
1424
/* Use attribute name or column_name option. */
1425
- colname = NameStr (tupdesc -> attrs [ i ] -> attname );
1425
+ colname = NameStr (TupleDescAttr ( tupdesc , i ) -> attname );
1426
1426
appendStringInfoString (& sql , "r." );
1427
1427
appendStringInfoString (& sql , quote_identifier (colname ));
1428
1428
1429
- appendStringInfo (& record , "%s %s" , quote_identifier (colname ), deparse_type_name (tupdesc -> attrs [ i ] -> atttypid , tupdesc -> attrs [ i ] -> atttypmod ));
1429
+ appendStringInfo (& record , "%s %s" , quote_identifier (colname ), deparse_type_name (TupleDescAttr ( tupdesc , i ) -> atttypid , TupleDescAttr ( tupdesc , i ) -> atttypmod ));
1430
1430
}
1431
1431
appendStringInfoString (& sql , " FROM " );
1432
1432
deparseRelation (& sql , relation );
0 commit comments