aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2012-11-07 16:23:39 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2012-11-07 16:24:20 -0300
commit9eb80f2ca75a205949df7dc86019d99fe076eb87 (patch)
tree00e3ef162ed6ae0636af4d54a31c66a9d7186ff9 /src
parent663c68f0e94ec6d4d4f75edcbd3d5c3dec4478fd (diff)
downloadpostgresql-9eb80f2ca75a205949df7dc86019d99fe076eb87.tar.gz
postgresql-9eb80f2ca75a205949df7dc86019d99fe076eb87.zip
Don't try to use a unopened relation
Commit 4c9d0901 mistakenly introduced a call to TransferPredicateLocksToHeapRelation() on an index relation that had been closed a few lines above. Moving up an index_open() call that's below is enough to fix the problem. Discovered by me while testing an unrelated patch.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/index.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index dc3e2dc5149..dd2408952b4 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1464,6 +1464,8 @@ index_drop(Oid indexId, bool concurrent)
* conflicts with existing predicate locks, so now is the time to move
* them to the heap relation.
*/
+ userHeapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
+ userIndexRelation = index_open(indexId, ShareUpdateExclusiveLock);
TransferPredicateLocksToHeapRelation(userIndexRelation);
/*
@@ -1473,9 +1475,6 @@ index_drop(Oid indexId, bool concurrent)
*/
indexRelation = heap_open(IndexRelationId, RowExclusiveLock);
- userHeapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
- userIndexRelation = index_open(indexId, ShareUpdateExclusiveLock);
-
tuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(tuple))