Fix unwarranted assumption that a cached rowtype would stick around
authorTom Lane <[email protected]>
Wed, 3 Feb 2010 05:46:37 +0000 (05:46 +0000)
committerTom Lane <[email protected]>
Wed, 3 Feb 2010 05:46:37 +0000 (05:46 +0000)
for the lifespan of the CreateStmt.  Per buildfarm member jaguar.

src/backend/parser/parse_utilcmd.c

index ff9453d661ef6224d98c5928e37b18600bc04b79..8aba938b91bdc1e0c537a89aec3a1f138a7f548f 100644 (file)
@@ -822,10 +822,10 @@ transformOfType(ParseState *pstate, CreateStmtContext *cxt, TypeName *ofTypename
    tupdesc = lookup_rowtype_tupdesc(ofTypeId, -1);
    for (i = 0; i < tupdesc->natts; i++)
    {
-       ColumnDef *n = makeNode(ColumnDef);
        Form_pg_attribute attr = tupdesc->attrs[i];
+       ColumnDef *n = makeNode(ColumnDef);
 
-       n->colname = NameStr(attr->attname);
+       n->colname = pstrdup(NameStr(attr->attname));
        n->typeName = makeTypeNameFromOid(attr->atttypid, attr->atttypmod);
        n->constraints = NULL;
        n->is_local = true;