@@ -7736,6 +7736,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77367736 const char *colName, LOCKMODE lockmode)
77377737{
77387738 HeapTuple tuple;
7739+ Form_pg_attribute attTup;
77397740 AttrNumber attnum;
77407741 Relation attr_rel;
77417742 ObjectAddress address;
@@ -7753,7 +7754,8 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77537754 errmsg("column \"%s\" of relation \"%s\" does not exist",
77547755 colName, RelationGetRelationName(rel))));
77557756
7756- attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum;
7757+ attTup = (Form_pg_attribute) GETSTRUCT(tuple);
7758+ attnum = attTup->attnum;
77577759
77587760 /* Prevent them from altering a system attribute */
77597761 if (attnum <= 0)
@@ -7765,9 +7767,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77657767 /*
77667768 * Okay, actually perform the catalog change ... if needed
77677769 */
7768- if (!((Form_pg_attribute) GETSTRUCT(tuple)) ->attnotnull)
7770+ if (!attTup ->attnotnull)
77697771 {
7770- ((Form_pg_attribute) GETSTRUCT(tuple)) ->attnotnull = true;
7772+ attTup ->attnotnull = true;
77717773
77727774 CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
77737775
@@ -7777,8 +7779,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
77777779 * this then we can skip that. We needn't bother looking if we've
77787780 * already found that we must verify some other not-null constraint.
77797781 */
7780- if (!tab->verify_new_notnull &&
7781- !NotNullImpliedByRelConstraints(rel, (Form_pg_attribute) GETSTRUCT(tuple)))
7782+ if (!tab->verify_new_notnull && !NotNullImpliedByRelConstraints(rel, attTup))
77827783 {
77837784 /* Tell Phase 3 it needs to test the constraint */
77847785 tab->verify_new_notnull = true;
0 commit comments