@@ -7028,6 +7028,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
70287028 Relation pgclass,
70297029 attrdesc;
70307030 HeapTuple reltup;
7031+ Form_pg_class relform;
70317032 Form_pg_attribute attribute;
70327033 int newattnum;
70337034 char relkind;
@@ -7161,10 +7162,11 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
71617162 reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
71627163 if (!HeapTupleIsValid(reltup))
71637164 elog(ERROR, "cache lookup failed for relation %u", myrelid);
7164- relkind = ((Form_pg_class) GETSTRUCT(reltup))->relkind;
7165+ relform = (Form_pg_class) GETSTRUCT(reltup);
7166+ relkind = relform->relkind;
71657167
71667168 /* Determine the new attribute's number */
7167- newattnum = ((Form_pg_class) GETSTRUCT(reltup)) ->relnatts + 1;
7169+ newattnum = relform ->relnatts + 1;
71687170 if (newattnum > MaxHeapAttributeNumber)
71697171 ereport(ERROR,
71707172 (errcode(ERRCODE_TOO_MANY_COLUMNS),
@@ -7193,7 +7195,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
71937195 /*
71947196 * Update pg_class tuple as appropriate
71957197 */
7196- ((Form_pg_class) GETSTRUCT(reltup)) ->relnatts = newattnum;
7198+ relform ->relnatts = newattnum;
71977199
71987200 CatalogTupleUpdate(pgclass, &reltup->t_self, reltup);
71997201
0 commit comments