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 <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/CAEudQAq=06YPWPhS+yyTbCwv5JLKRz8rm3dWx6JR5Uj_d_fQDA@mail.gmail.com
pull/182/head
David Rowley 11 months ago
parent 84b8fccbe5
commit fcbd1bb661
  1. 2
      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;
/*

Loading…
Cancel
Save