diff options
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r-- | src/backend/parser/parse_utilcmd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index b761fdfd7d7..45bb31ecf8f 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -917,7 +917,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla Relation relation; TupleDesc tupleDesc; TupleConstr *constr; - AttrNumber *attmap; + AttrMap *attmap; AclResult aclresult; char *comment; ParseCallbackState pcbstate; @@ -974,7 +974,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla * since dropped columns in the source table aren't copied, so the new * table can have different column numbers. */ - attmap = (AttrNumber *) palloc0(sizeof(AttrNumber) * tupleDesc->natts); + attmap = make_attrmap(tupleDesc->natts); /* * Insert the copied attributes into the cxt for the new table definition. @@ -1020,7 +1020,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla */ cxt->columns = lappend(cxt->columns, def); - attmap[parent_attno - 1] = list_length(cxt->columns); + attmap->attnums[parent_attno - 1] = list_length(cxt->columns); /* * Copy default, if present and it should be copied. We have separate @@ -1051,7 +1051,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla def->cooked_default = map_variable_attnos(this_default, 1, 0, - attmap, tupleDesc->natts, + attmap, InvalidOid, &found_whole_row); /* @@ -1134,7 +1134,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla ccbin_node = map_variable_attnos(stringToNode(ccbin), 1, 0, - attmap, tupleDesc->natts, + attmap, InvalidOid, &found_whole_row); /* @@ -1200,7 +1200,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla /* Build CREATE INDEX statement to recreate the parent_index */ index_stmt = generateClonedIndexStmt(cxt->relation, parent_index, - attmap, tupleDesc->natts, + attmap, NULL); /* Copy comment on index, if requested */ @@ -1332,7 +1332,7 @@ transformOfType(CreateStmtContext *cxt, TypeName *ofTypename) */ IndexStmt * generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, - const AttrNumber *attmap, int attmap_length, + const AttrMap *attmap, Oid *constraintOid) { Oid source_relid = RelationGetRelid(source_idx); @@ -1552,7 +1552,7 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, /* Adjust Vars to match new table's column numbering */ indexkey = map_variable_attnos(indexkey, 1, 0, - attmap, attmap_length, + attmap, InvalidOid, &found_whole_row); /* As in transformTableLikeClause, reject whole-row variables */ @@ -1659,7 +1659,7 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx, /* Adjust Vars to match new table's column numbering */ pred_tree = map_variable_attnos(pred_tree, 1, 0, - attmap, attmap_length, + attmap, InvalidOid, &found_whole_row); /* As in transformTableLikeClause, reject whole-row variables */ |