@@ -7736,6 +7736,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
7736
7736
const char *colName, LOCKMODE lockmode)
7737
7737
{
7738
7738
HeapTuple tuple;
7739
+ Form_pg_attribute attTup;
7739
7740
AttrNumber attnum;
7740
7741
Relation attr_rel;
7741
7742
ObjectAddress address;
@@ -7753,7 +7754,8 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
7753
7754
errmsg("column \"%s\" of relation \"%s\" does not exist",
7754
7755
colName, RelationGetRelationName(rel))));
7755
7756
7756
- attnum = ((Form_pg_attribute) GETSTRUCT(tuple))->attnum;
7757
+ attTup = (Form_pg_attribute) GETSTRUCT(tuple);
7758
+ attnum = attTup->attnum;
7757
7759
7758
7760
/* Prevent them from altering a system attribute */
7759
7761
if (attnum <= 0)
@@ -7765,9 +7767,9 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
7765
7767
/*
7766
7768
* Okay, actually perform the catalog change ... if needed
7767
7769
*/
7768
- if (!((Form_pg_attribute) GETSTRUCT(tuple)) ->attnotnull)
7770
+ if (!attTup ->attnotnull)
7769
7771
{
7770
- ((Form_pg_attribute) GETSTRUCT(tuple)) ->attnotnull = true;
7772
+ attTup ->attnotnull = true;
7771
7773
7772
7774
CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
7773
7775
@@ -7777,8 +7779,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
7777
7779
* this then we can skip that. We needn't bother looking if we've
7778
7780
* already found that we must verify some other not-null constraint.
7779
7781
*/
7780
- if (!tab->verify_new_notnull &&
7781
- !NotNullImpliedByRelConstraints(rel, (Form_pg_attribute) GETSTRUCT(tuple)))
7782
+ if (!tab->verify_new_notnull && !NotNullImpliedByRelConstraints(rel, attTup))
7782
7783
{
7783
7784
/* Tell Phase 3 it needs to test the constraint */
7784
7785
tab->verify_new_notnull = true;
0 commit comments