From 3274255b22303629d951cd474dcdcb14b827745c Mon Sep 17 00:00:00 2001 From: jian he Date: Thu, 12 Sep 2024 16:04:48 +0800 Subject: [PATCH v2 1/2] minor coesmetic change for not null patch v2 --- src/backend/catalog/heap.c | 4 +--- src/backend/commands/tablecmds.c | 9 +++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 2c3a0de021..36a912967a 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -2797,7 +2797,6 @@ AddRelationNotNullConstraints(Relation rel, List *constraints, List *givennames; List *nnnames; List *nncols = NIL; - ListCell *lc; /* * We track two lists of names: nnnames keeps all the constraint names, @@ -2815,9 +2814,8 @@ AddRelationNotNullConstraints(Relation rel, List *constraints, * each element with identical attnum. We delete from there any element * that we process. */ - foreach(lc, constraints) + foreach_node(Constraint, constr, constraints) { - Constraint *constr = lfirst_node(Constraint, lc); AttrNumber attnum; char *conname; bool is_local = true; diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index cbc4fce8cd..b49d623119 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -7659,16 +7659,14 @@ set_attnotnull(List **wqueue, Relation rel, AttrNumber attnum, bool recurse, if (recurse) { List *children; - ListCell *lc; /* Make above update visible, for multiple inheritance cases */ if (changed) CommandCounterIncrement(); children = find_inheritance_children(RelationGetRelid(rel), lockmode); - foreach(lc, children) + foreach_oid(childrelid, children) { - Oid childrelid = lfirst_oid(lc); Relation childrel; AttrNumber childattno; @@ -9228,15 +9226,14 @@ ATPrepAddPrimaryKey(List **wqueue, Relation rel, AlterTableCmd *cmd, { Relation childrel = table_open(childrelid, NoLock); AlterTableCmd *newcmd = makeNode(AlterTableCmd); - ListCell *lc2; newcmd->subtype = AT_AddConstraint; newcmd->recurse = true; - foreach(lc2, newconstrs) + foreach_node(Constraint, lc2, newconstrs) { /* ATPrepCmd copies newcmd, so we can scribble on it here */ - newcmd->def = lfirst(lc2); + newcmd->def = (Node *) lc2; ATPrepCmd(wqueue, childrel, newcmd, true, false, lockmode, context); -- 2.34.1