aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/indexcmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r--src/backend/commands/indexcmds.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 374e2d0efe4..8f242aef1e2 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -1060,9 +1060,8 @@ DefineIndex(Oid relationId,
Relation childrel;
List *childidxs;
ListCell *cell;
- AttrNumber *attmap;
+ AttrMap *attmap;
bool found = false;
- int maplen;
childrel = table_open(childRelid, lockmode);
@@ -1087,9 +1086,8 @@ DefineIndex(Oid relationId,
childidxs = RelationGetIndexList(childrel);
attmap =
- convert_tuples_by_name_map(RelationGetDescr(childrel),
- parentDesc);
- maplen = parentDesc->natts;
+ build_attrmap_by_name(RelationGetDescr(childrel),
+ parentDesc);
foreach(cell, childidxs)
{
@@ -1108,7 +1106,7 @@ DefineIndex(Oid relationId,
collationObjectId,
cldidx->rd_opfamily,
opfamOids,
- attmap, maplen))
+ attmap))
{
Oid cldConstrOid = InvalidOid;
@@ -1193,7 +1191,7 @@ DefineIndex(Oid relationId,
{
ielem->expr =
map_variable_attnos((Node *) ielem->expr,
- 1, 0, attmap, maplen,
+ 1, 0, attmap,
InvalidOid,
&found_whole_row);
if (found_whole_row)
@@ -1202,7 +1200,7 @@ DefineIndex(Oid relationId,
}
childStmt->whereClause =
map_variable_attnos(stmt->whereClause, 1, 0,
- attmap, maplen,
+ attmap,
InvalidOid, &found_whole_row);
if (found_whole_row)
elog(ERROR, "cannot convert whole-row table reference");
@@ -1217,7 +1215,7 @@ DefineIndex(Oid relationId,
pgstat_progress_update_param(PROGRESS_CREATEIDX_PARTITIONS_DONE,
i + 1);
- pfree(attmap);
+ free_attrmap(attmap);
}
/*