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:23:39 -0300
commit4ee5c40b06f098910ed0fc5fd72fb2744776ccbb (patch)
tree66ea9160da53f480dfc6012fb80a8a218b26d781 /src
parentc90dcd6d2c76402ce307b0d44958c6ca274f2c39 (diff)
downloadpostgresql-4ee5c40b06f098910ed0fc5fd72fb2744776ccbb.tar.gz
postgresql-4ee5c40b06f098910ed0fc5fd72fb2744776ccbb.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 756f6d918b0..d2d91c1b786 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1475,6 +1475,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);
/*
@@ -1484,9 +1486,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))