@@ -7028,6 +7028,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
7028
7028
Relation pgclass,
7029
7029
attrdesc;
7030
7030
HeapTuple reltup;
7031
+ Form_pg_class relform;
7031
7032
Form_pg_attribute attribute;
7032
7033
int newattnum;
7033
7034
char relkind;
@@ -7161,10 +7162,11 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
7161
7162
reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid));
7162
7163
if (!HeapTupleIsValid(reltup))
7163
7164
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;
7165
7167
7166
7168
/* Determine the new attribute's number */
7167
- newattnum = ((Form_pg_class) GETSTRUCT(reltup)) ->relnatts + 1;
7169
+ newattnum = relform ->relnatts + 1;
7168
7170
if (newattnum > MaxHeapAttributeNumber)
7169
7171
ereport(ERROR,
7170
7172
(errcode(ERRCODE_TOO_MANY_COLUMNS),
@@ -7193,7 +7195,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
7193
7195
/*
7194
7196
* Update pg_class tuple as appropriate
7195
7197
*/
7196
- ((Form_pg_class) GETSTRUCT(reltup)) ->relnatts = newattnum;
7198
+ relform ->relnatts = newattnum;
7197
7199
7198
7200
CatalogTupleUpdate(pgclass, &reltup->t_self, reltup);
7199
7201
0 commit comments