1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Use TupleDescAttr macro consistently

A few places were directly accessing the attrs[] array. This goes
against the standards set by 2cd708452. Fix that.

Discussion: https://postgr.es/m/CAApHDvrBztXP3yx=NKNmo3xwFAFhEdyPnvrDg3=M0RhDs+4vYw@mail.gmail.com
This commit is contained in:
David Rowley
2024-07-02 13:41:47 +12:00
parent 0c1aca4614
commit 65b71dec2d
6 changed files with 15 additions and 14 deletions

View File

@@ -658,7 +658,7 @@ ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags)
/* 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++;
}
@@ -676,7 +676,7 @@ ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags)
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;
}

View File

@@ -175,10 +175,10 @@ MemoizeHash_hash(struct memoize_hash *tb, const MemoizeKey *key)
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);
@@ -242,7 +242,7 @@ MemoizeHash_equal(struct memoize_hash *tb, const MemoizeKey *key1,
for (int i = 0; i < numkeys; i++)
{
FormData_pg_attribute *attr;
Form_pg_attribute attr;
if (tslot->tts_isnull[i] != pslot->tts_isnull[i])
{
@@ -255,7 +255,7 @@ MemoizeHash_equal(struct memoize_hash *tb, const MemoizeKey *key1,
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))
{