Skip to content

Commit 62cd735

Browse files
committed
Provide compatibility with PG 11.0
1 parent 031bcd6 commit 62cd735

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

deparse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ deparseTargetList(StringInfo buf,
633633
first = true;
634634
for (i = 1; i <= tupdesc->natts; i++)
635635
{
636-
Form_pg_attribute attr = tupdesc->attrs[i - 1];
636+
Form_pg_attribute attr = TupleDescAttr(tupdesc, i - 1);
637637

638638
/* Ignore dropped attributes. */
639639
if (attr->attisdropped)
@@ -1190,15 +1190,15 @@ deparseAnalyzeSql(StringInfo buf, Relation rel, List **retrieved_attrs)
11901190
for (i = 0; i < tupdesc->natts; i++)
11911191
{
11921192
/* Ignore dropped columns. */
1193-
if (tupdesc->attrs[i]->attisdropped)
1193+
if (TupleDescAttr(tupdesc, i)->attisdropped)
11941194
continue;
11951195

11961196
if (!first)
11971197
appendStringInfoString(buf, ", ");
11981198
first = false;
11991199

12001200
/* Use attribute name or column_name option. */
1201-
colname = NameStr(tupdesc->attrs[i]->attname);
1201+
colname = NameStr(TupleDescAttr(tupdesc, i)->attname);
12021202
options = GetForeignColumnOptions(relid, i + 1);
12031203

12041204
foreach(lc, options)

vops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,9 +2375,9 @@ Datum vops_unnest(PG_FUNCTION_ARGS)
23752375
user_ctx->tile_pos = 0;
23762376
user_ctx->filter_mask = filter_mask;
23772377
filter_mask = ~0;
2378-
2378+
23792379
for (i = 0; i < n_attrs; i++) {
2380-
Form_pg_attribute attr = src_desc->attrs[i];
2380+
Form_pg_attribute attr = TupleDescAttr(src_desc, i);
23812381
vops_type tid = vops_get_type(attr->atttypid);
23822382
Datum val = GetAttributeByNum(t, attr->attnum, &user_ctx->nulls[i]);
23832383
user_ctx->types[i] = tid;

vops_fdw.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ postgresGetForeignRelSize(PlannerInfo *root,
310310
{
311311
for (j = 0; j < vops_tupdesc->natts; j++)
312312
{
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)
314314
{
315315
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)
317317
{
318318
fpinfo->tile_attrs = bms_add_member(fpinfo->tile_attrs, i + 1 - FirstLowInvalidHeapAttributeNumber);
319319
}
@@ -685,7 +685,7 @@ postgresIterateForeignScan(ForeignScanState *node)
685685
/* ordinary column */
686686
Assert(i <= n_attrs);
687687
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;
689689
fsstate->vops_types[i-1] = vops_get_type(fsstate->attr_types[i-1]);
690690
}
691691
j += 1;
@@ -747,7 +747,7 @@ postgresIterateForeignScan(ForeignScanState *node)
747747
fsstate->dst_nulls[i] = false;
748748
}
749749
} 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)
751751
{
752752
fsstate->dst_values[i] = Float4GetDatum((float)DatumGetFloat8(fsstate->src_values[i]));
753753
} else {
@@ -1413,7 +1413,7 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
14131413
for (i = 0; i < tupdesc->natts; i++)
14141414
{
14151415
/* Ignore dropped columns. */
1416-
if (tupdesc->attrs[i]->attisdropped)
1416+
if (TupleDescAttr(tupdesc, i)->attisdropped)
14171417
continue;
14181418
if (!first) {
14191419
appendStringInfoString(&record, ", ");
@@ -1422,11 +1422,11 @@ postgresAcquireSampleRowsFunc(Relation relation, int elevel,
14221422
first = false;
14231423

14241424
/* Use attribute name or column_name option. */
1425-
colname = NameStr(tupdesc->attrs[i]->attname);
1425+
colname = NameStr(TupleDescAttr(tupdesc, i)->attname);
14261426
appendStringInfoString(&sql, "r.");
14271427
appendStringInfoString(&sql, quote_identifier(colname));
14281428

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));
14301430
}
14311431
appendStringInfoString(&sql, " FROM ");
14321432
deparseRelation(&sql, relation);

0 commit comments

Comments
 (0)