diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index 1e7696beb50..bdebb7893cd 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -2169,7 +2169,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
 	needComma = false;
 	for (i = 0; i < natts; i++)
 	{
-		if (TupleDescAttr(tupdesc, i)->attisdropped)
+		if (TupleDescCompactAttr(tupdesc, i)->attisdropped)
 			continue;
 
 		if (needComma)
@@ -3020,7 +3020,7 @@ validate_pkattnums(Relation rel,
 		for (j = 0; j < natts; j++)
 		{
 			/* dropped columns don't count */
-			if (TupleDescAttr(tupdesc, j)->attisdropped)
+			if (TupleDescCompactAttr(tupdesc, j)->attisdropped)
 				continue;
 
 			if (++lnum == pkattnum)
diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index e5b5e1a5f51..fa295954203 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -1458,10 +1458,8 @@ deparseTargetList(StringInfo buf,
 	first = true;
 	for (i = 1; i <= tupdesc->natts; i++)
 	{
-		Form_pg_attribute attr = TupleDescAttr(tupdesc, i - 1);
-
 		/* Ignore dropped attributes. */
-		if (attr->attisdropped)
+		if (TupleDescCompactAttr(tupdesc, i - 1)->attisdropped)
 			continue;
 
 		if (have_wholerow ||
@@ -2150,13 +2148,12 @@ deparseInsertSql(StringInfo buf, RangeTblEntry *rte,
 		foreach(lc, targetAttrs)
 		{
 			int			attnum = lfirst_int(lc);
-			Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
 
 			if (!first)
 				appendStringInfoString(buf, ", ");
 			first = false;
 
-			if (attr->attgenerated)
+			if (TupleDescCompactAttr(tupdesc, attnum - 1)->attgenerated)
 				appendStringInfoString(buf, "DEFAULT");
 			else
 			{
@@ -2216,13 +2213,12 @@ rebuildInsertSql(StringInfo buf, Relation rel,
 		foreach(lc, target_attrs)
 		{
 			int			attnum = lfirst_int(lc);
-			Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
 
 			if (!first)
 				appendStringInfoString(buf, ", ");
 			first = false;
 
-			if (attr->attgenerated)
+			if (TupleDescCompactAttr(tupdesc, attnum - 1)->attgenerated)
 				appendStringInfoString(buf, "DEFAULT");
 			else
 			{
@@ -2266,14 +2262,13 @@ deparseUpdateSql(StringInfo buf, RangeTblEntry *rte,
 	foreach(lc, targetAttrs)
 	{
 		int			attnum = lfirst_int(lc);
-		Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
 
 		if (!first)
 			appendStringInfoString(buf, ", ");
 		first = false;
 
 		deparseColumnRef(buf, rtindex, attnum, rte, false);
-		if (attr->attgenerated)
+		if (TupleDescCompactAttr(tupdesc, attnum - 1)->attgenerated)
 			appendStringInfoString(buf, " = DEFAULT");
 		else
 		{
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index d715c345dd8..5ab7d34fb9a 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -526,7 +526,7 @@ FreeTupleDesc(TupleDesc tupdesc)
 			for (i = tupdesc->natts - 1; i >= 0; i--)
 			{
 				if (attrmiss[i].am_present
-					&& !TupleDescAttr(tupdesc, i)->attbyval)
+					&& !TupleDescCompactAttr(tupdesc, i)->attbyval)
 					pfree(DatumGetPointer(attrmiss[i].am_value));
 			}
 			pfree(attrmiss);
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index 1d3ab22556d..3d71b442aa9 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -499,7 +499,7 @@ ginFlushBuildState(GinBuildState *buildstate, Relation index)
 								 &attnum, &key, &category, &nlist)) != NULL)
 	{
 		/* information about the key */
-		Form_pg_attribute attr = TupleDescAttr(tdesc, (attnum - 1));
+		CompactAttribute *attr = TupleDescCompactAttr(tdesc, (attnum - 1));
 
 		/* GIN tuple and tuple length */
 		GinTuple   *tup;
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 5fd8b51312c..eea13f805b6 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -6336,7 +6336,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
 		 */
 		for (i = 0; i < newTupDesc->natts; i++)
 		{
-			if (TupleDescAttr(newTupDesc, i)->attisdropped)
+			if (TupleDescCompactAttr(newTupDesc, i)->attisdropped)
 				dropped_attrs = lappend_int(dropped_attrs, i);
 		}
 
@@ -8148,7 +8148,7 @@ ATExecColumnDefault(Relation rel, const char *colName,
 				 newDefault ? 0 : errhint("Use %s instead.",
 										  "ALTER TABLE ... ALTER COLUMN ... DROP IDENTITY")));
 
-	if (TupleDescAttr(tupdesc, attnum - 1)->attgenerated)
+	if (TupleDescCompactAttr(tupdesc, attnum - 1)->attgenerated)
 		ereport(ERROR,
 				(errcode(ERRCODE_SYNTAX_ERROR),
 				 errmsg("column \"%s\" of relation \"%s\" is a generated column",
@@ -17673,16 +17673,16 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
 			}
 			else if (child_con->contype == CONSTRAINT_NOTNULL)
 			{
-				Form_pg_attribute parent_attr;
-				Form_pg_attribute child_attr;
+				CompactAttribute *parent_attr;
+				CompactAttribute *child_attr;
 				AttrNumber	child_attno;
 
-				parent_attr = TupleDescAttr(parent_rel->rd_att, parent_attno - 1);
+				parent_attr = TupleDescCompactAttr(parent_rel->rd_att, parent_attno - 1);
 				child_attno = extractNotNullColumn(child_tuple);
 				if (parent_attno != attmap->attnums[child_attno - 1])
 					continue;
 
-				child_attr = TupleDescAttr(child_rel->rd_att, child_attno - 1);
+				child_attr = TupleDescCompactAttr(child_rel->rd_att, child_attno - 1);
 				/* there shouldn't be constraints on dropped columns */
 				if (parent_attr->attisdropped || child_attr->attisdropped)
 					elog(ERROR, "found not-null constraint on dropped columns");
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index da5d901ec3c..f4b7343dace 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -2509,7 +2509,7 @@ get_dependent_generated_columns(PlannerInfo *root, Index rti,
 			Bitmapset  *attrs_used = NULL;
 
 			/* skip if not generated column */
-			if (!TupleDescAttr(tupdesc, defval->adnum - 1)->attgenerated)
+			if (!TupleDescCompactAttr(tupdesc, defval->adnum - 1)->attgenerated)
 				continue;
 
 			/* identify columns this generated column depends on */
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 04ecf64b1fc..ad91cec98c5 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -3489,12 +3489,12 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
 						if (tupdesc)
 						{
 							/* Composite data type, e.g. a table's row type */
-							Form_pg_attribute att_tup;
+							CompactAttribute *att_tup;
 
 							Assert(tupdesc);
 							Assert(attnum - atts_done <= tupdesc->natts);
-							att_tup = TupleDescAttr(tupdesc,
-													attnum - atts_done - 1);
+							att_tup = TupleDescCompactAttr(tupdesc,
+														   attnum - atts_done - 1);
 							return att_tup->attisdropped;
 						}
 						/* Otherwise, it can't have any dropped columns */
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 3c58ad88476..b5821afbd6b 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -977,7 +977,7 @@ slot_fill_defaults(LogicalRepRelMapEntry *rel, EState *estate,
 	{
 		Expr	   *defexpr;
 
-		if (TupleDescAttr(desc, attnum)->attisdropped || TupleDescAttr(desc, attnum)->attgenerated)
+		if (TupleDescCompactAttr(desc, attnum)->attisdropped || TupleDescCompactAttr(desc, attnum)->attgenerated)
 			continue;
 
 		if (rel->attrmap->attnums[attnum] >= 0)
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index 847806b0a2e..378b61fbd18 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -1069,7 +1069,7 @@ check_and_init_gencol(PGOutputData *data, List *publications,
 	/* Check if there is any generated column present. */
 	for (int i = 0; i < desc->natts; i++)
 	{
-		Form_pg_attribute att = TupleDescAttr(desc, i);
+		CompactAttribute *att = TupleDescCompactAttr(desc, i);
 
 		if (att->attgenerated)
 		{
diff --git a/src/backend/utils/adt/expandedrecord.c b/src/backend/utils/adt/expandedrecord.c
index 13752db44e8..495d48fb581 100644
--- a/src/backend/utils/adt/expandedrecord.c
+++ b/src/backend/utils/adt/expandedrecord.c
@@ -547,7 +547,7 @@ expanded_record_set_tuple(ExpandedRecordHeader *erh,
 		for (i = 0; i < erh->nfields; i++)
 		{
 			if (!erh->dnulls[i] &&
-				!(TupleDescAttr(tupdesc, i)->attbyval))
+				!(TupleDescCompactAttr(tupdesc, i)->attbyval))
 			{
 				char	   *oldValue = (char *) DatumGetPointer(erh->dvalues[i]);
 
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index 9e5449f17d7..84f8a1ab770 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -549,7 +549,7 @@ record_recv(PG_FUNCTION_ARGS)
 	validcols = 0;
 	for (i = 0; i < ncolumns; i++)
 	{
-		if (!TupleDescAttr(tupdesc, i)->attisdropped)
+		if (!TupleDescCompactAttr(tupdesc, i)->attisdropped)
 			validcols++;
 	}
 	if (usercols != validcols)
@@ -754,7 +754,7 @@ record_send(PG_FUNCTION_ARGS)
 	validcols = 0;
 	for (i = 0; i < ncolumns; i++)
 	{
-		if (!TupleDescAttr(tupdesc, i)->attisdropped)
+		if (!TupleDescCompactAttr(tupdesc, i)->attisdropped)
 			validcols++;
 	}
 	pq_sendint32(&buf, validcols);
@@ -924,12 +924,12 @@ record_cmp(FunctionCallInfo fcinfo)
 		/*
 		 * Skip dropped columns
 		 */
-		if (i1 < ncolumns1 && TupleDescAttr(tupdesc1, i1)->attisdropped)
+		if (i1 < ncolumns1 && TupleDescCompactAttr(tupdesc1, i1)->attisdropped)
 		{
 			i1++;
 			continue;
 		}
-		if (i2 < ncolumns2 && TupleDescAttr(tupdesc2, i2)->attisdropped)
+		if (i2 < ncolumns2 && TupleDescCompactAttr(tupdesc2, i2)->attisdropped)
 		{
 			i2++;
 			continue;
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index fd1c7be8f53..abb15b5b30d 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -2286,12 +2286,12 @@ CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos, Datum *keys)
 	for (i = 0; i < nkeys; i++)
 	{
 		int			attnum = attnos[i];
-		Form_pg_attribute att;
+		CompactAttribute *att;
 
 		/* system attribute are not supported in caches */
 		Assert(attnum > 0);
 
-		att = TupleDescAttr(tupdesc, attnum - 1);
+		att = TupleDescCompactAttr(tupdesc, attnum - 1);
 
 		if (!att->attbyval)
 			pfree(DatumGetPointer(keys[i]));
