|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.50 1998/08/2022:07:34 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.51 1998/08/2023:01:24 momjian Exp $ |
11 | 11 | *
|
12 | 12 | *
|
13 | 13 | * INTERFACE ROUTINES
|
@@ -1171,31 +1171,33 @@ index_create(char *heapRelationName,
|
1171 | 1171 | void
|
1172 | 1172 | index_destroy(OidindexId)
|
1173 | 1173 | {
|
| 1174 | +RelationuserindexRelation; |
1174 | 1175 | RelationindexRelation;
|
1175 |
| -RelationcatalogRelation; |
| 1176 | +RelationrelationRelation; |
1176 | 1177 | RelationattributeRelation;
|
1177 | 1178 | HeapTupletuple;
|
1178 | 1179 | int16attnum;
|
1179 | 1180 |
|
1180 | 1181 | Assert(OidIsValid(indexId));
|
1181 | 1182 |
|
1182 |
| -indexRelation=index_open(indexId); |
| 1183 | +/* why open it here? bjm 1998/08/20 */ |
| 1184 | +userindexRelation=index_open(indexId); |
1183 | 1185 |
|
1184 | 1186 | /* ----------------
|
1185 | 1187 | * fix RELATION relation
|
1186 | 1188 | * ----------------
|
1187 | 1189 | */
|
1188 |
| -catalogRelation=heap_openr(RelationRelationName); |
| 1190 | +relationRelation=heap_openr(RelationRelationName); |
1189 | 1191 |
|
1190 | 1192 | tuple=SearchSysCacheTupleCopy(RELOID,
|
1191 | 1193 | ObjectIdGetDatum(indexId),
|
1192 | 1194 | 0,0,0);
|
1193 | 1195 |
|
1194 | 1196 | AssertState(HeapTupleIsValid(tuple));
|
1195 | 1197 |
|
1196 |
| -heap_delete(catalogRelation,&tuple->t_ctid); |
| 1198 | +heap_delete(relationRelation,&tuple->t_ctid); |
1197 | 1199 | pfree(tuple);
|
1198 |
| -heap_close(catalogRelation); |
| 1200 | +heap_close(relationRelation); |
1199 | 1201 |
|
1200 | 1202 | /* ----------------
|
1201 | 1203 | * fix ATTRIBUTE relation
|
@@ -1226,23 +1228,24 @@ index_destroy(Oid indexId)
|
1226 | 1228 |
|
1227 | 1229 | if (!HeapTupleIsValid(tuple))
|
1228 | 1230 | elog(NOTICE,"IndexRelationDestroy: %s's INDEX tuple missing",
|
1229 |
| -RelationGetRelationName(indexRelation)); |
| 1231 | +RelationGetRelationName(userindexRelation)); |
1230 | 1232 |
|
1231 |
| -Assert(ItemPointerIsValid(&tuple->t_ctid)); |
| 1233 | +indexRelation=heap_openr(IndexRelationName); |
1232 | 1234 |
|
1233 | 1235 | heap_delete(indexRelation,&tuple->t_ctid);
|
1234 | 1236 | pfree(tuple);
|
| 1237 | +heap_close(indexRelation); |
1235 | 1238 |
|
1236 | 1239 | /*
|
1237 | 1240 | * flush cache and physically remove the file
|
1238 | 1241 | */
|
1239 |
| -ReleaseRelationBuffers(indexRelation); |
| 1242 | +ReleaseRelationBuffers(userindexRelation); |
1240 | 1243 |
|
1241 |
| -if (FileNameUnlink(relpath(indexRelation->rd_rel->relname.data))<0) |
| 1244 | +if (FileNameUnlink(relpath(userindexRelation->rd_rel->relname.data))<0) |
1242 | 1245 | elog(ERROR,"amdestroyr: unlink: %m");
|
1243 | 1246 |
|
1244 |
| -index_close(indexRelation); |
1245 |
| -RelationForgetRelation(RelationGetRelid(indexRelation)); |
| 1247 | +index_close(userindexRelation); |
| 1248 | +RelationForgetRelation(RelationGetRelid(userindexRelation)); |
1246 | 1249 | }
|
1247 | 1250 |
|
1248 | 1251 | /* ----------------------------------------------------------------
|
|