diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index dbbbc376e00..5408eda8ee1 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.114 2003/10/02 06:34:03 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.114.2.1 2007/08/25 19:08:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -112,8 +112,6 @@ DefineIndex(RangeVar *heapRelation, relationId = RelationGetRelid(rel); namespaceId = RelationGetNamespace(rel); - heap_close(rel, NoLock); - /* * Verify we (still) have CREATE rights in the rel's namespace. * (Presumably we did when the rel was created, but maybe not @@ -251,6 +249,8 @@ DefineIndex(RangeVar *heapRelation, ComputeIndexAttrs(indexInfo, classObjectId, attributeList, relationId, accessMethodName, accessMethodId); + heap_close(rel, NoLock); + index_create(relationId, indexRelationName, indexInfo, accessMethodId, classObjectId, primary, isconstraint, allowSystemTableMods);