bool typisvarlena;
Oid typoid;
- typoid = tupdesc->attrs[i].atttypid;
+ typoid = TupleDescAttr(tupdesc, i)->atttypid;
getTypeOutputInfo(typoid, &foutoid, &typisvarlena);
value = OidOutputFunctionCall(foutoid, itup_values[i]);
}
/* add dependencies on their datatypes and collations */
for (int i = 0; i < natts; i++)
{
+ Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
+
/* Add dependency info */
ObjectAddressSubSet(myself, RelationRelationId, new_rel_oid, i + 1);
- ObjectAddressSet(referenced, TypeRelationId,
- tupdesc->attrs[i].atttypid);
+ ObjectAddressSet(referenced, TypeRelationId, attr->atttypid);
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
/* The default collation is pinned, so don't bother recording it */
- if (OidIsValid(tupdesc->attrs[i].attcollation) &&
- tupdesc->attrs[i].attcollation != DEFAULT_COLLATION_OID)
+ if (OidIsValid(attr->attcollation) &&
+ attr->attcollation != DEFAULT_COLLATION_OID)
{
ObjectAddressSet(referenced, CollationRelationId,
- tupdesc->attrs[i].attcollation);
+ attr->attcollation);
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
}
}
result_types = palloc_array(Oid, result_desc->natts);
for (int i = 0; i < result_desc->natts; i++)
- result_types[i] = result_desc->attrs[i].atttypid;
+ result_types[i] = TupleDescAttr(result_desc, i)->atttypid;
values[4] = build_regtype_array(result_types, result_desc->natts);
}
else
/* First, count the number of such index keys */
for (int attnum = 0; attnum < indnkeyatts; attnum++)
{
- if (indexRelation->rd_att->attrs[attnum].atttypid == CSTRINGOID &&
+ if (TupleDescAttr(indexRelation->rd_att, attnum)->atttypid == CSTRINGOID &&
indexRelation->rd_opcintype[attnum] == NAMEOID)
namecount++;
}
for (int attnum = 0; attnum < indnkeyatts; attnum++)
{
- if (indexRelation->rd_att->attrs[attnum].atttypid == CSTRINGOID &&
+ if (TupleDescAttr(indexRelation->rd_att, attnum)->atttypid == CSTRINGOID &&
indexRelation->rd_opcintype[attnum] == NAMEOID)
indexstate->ioss_NameCStringAttNums[idx++] = (AttrNumber) attnum;
}
if (!pslot->tts_isnull[i]) /* treat nulls as having hash key 0 */
{
- FormData_pg_attribute *attr;
+ Form_pg_attribute attr;
uint32 hkey;
- attr = &pslot->tts_tupleDescriptor->attrs[i];
+ attr = TupleDescAttr(pslot->tts_tupleDescriptor, i);
hkey = datum_image_hash(pslot->tts_values[i], attr->attbyval, attr->attlen);
for (int i = 0; i < numkeys; i++)
{
- FormData_pg_attribute *attr;
+ Form_pg_attribute attr;
if (tslot->tts_isnull[i] != pslot->tts_isnull[i])
{
continue;
/* perform binary comparison on the two datums */
- attr = &tslot->tts_tupleDescriptor->attrs[i];
+ attr = TupleDescAttr(tslot->tts_tupleDescriptor, i);
if (!datum_image_eq(tslot->tts_values[i], pslot->tts_values[i],
attr->attbyval, attr->attlen))
{
{
for (int i = 0; i < relation->rd_att->natts; i++)
{
- FormData_pg_attribute *attr = &relation->rd_att->attrs[i];
+ Form_pg_attribute attr = TupleDescAttr(relation->rd_att, i);
if (attr->attnotnull)
{