From: David Rowley Date: Tue, 29 Oct 2024 12:38:42 +0000 (+1300) Subject: Reduce variable scope and possibly useless palloc X-Git-Tag: REL_18_BETA1~1599 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=fcbd1bb6613fde5784b54c88e4d0398ab8e13694;p=postgresql.git Reduce variable scope and possibly useless palloc Move the CreateStmt down to the branch that it's used in, thus preventing the makeNode() call in cases where the CreateStmt isn't used. Author: Ranier Vilela Discussion: https://postgr.es/m/CAEudQAq=06YPWPhS+yyTbCwv5JLKRz8rm3dWx6JR5Uj_d_fQDA@mail.gmail.com --- diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index fdad8338324..2bd49eb55e6 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -47,7 +47,6 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace, { Oid viewOid; LOCKMODE lockmode; - CreateStmt *createStmt = makeNode(CreateStmt); List *attrList; ListCell *t; @@ -223,6 +222,7 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace, } else { + CreateStmt *createStmt = makeNode(CreateStmt); ObjectAddress address; /*