diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index cdbb56f1a4..e950e6ce68 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -1064,8 +1064,6 @@ DefineIndex(Oid relationId, for (i = 0; i < numberOfKeyAttributes; i++) opfamOids[i] = get_opclass_family(classObjectId[i]); - table_close(rel, NoLock); - /* * For each partition, scan all existing indexes; if one matches * our index definition and is not already attached to some other @@ -1265,8 +1263,8 @@ DefineIndex(Oid relationId, heap_freetuple(newtup); } } - else - table_close(rel, NoLock); + + table_close(rel, NoLock); /* * Indexes on partitioned tables are not themselves built, so we're