Commit 4ee5c40b authored by Alvaro Herrera's avatar Alvaro Herrera

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.
parent c90dcd6d
...@@ -1475,6 +1475,8 @@ index_drop(Oid indexId, bool concurrent) ...@@ -1475,6 +1475,8 @@ index_drop(Oid indexId, bool concurrent)
* conflicts with existing predicate locks, so now is the time to move * conflicts with existing predicate locks, so now is the time to move
* them to the heap relation. * them to the heap relation.
*/ */
userHeapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
userIndexRelation = index_open(indexId, ShareUpdateExclusiveLock);
TransferPredicateLocksToHeapRelation(userIndexRelation); TransferPredicateLocksToHeapRelation(userIndexRelation);
/* /*
...@@ -1484,9 +1486,6 @@ index_drop(Oid indexId, bool concurrent) ...@@ -1484,9 +1486,6 @@ index_drop(Oid indexId, bool concurrent)
*/ */
indexRelation = heap_open(IndexRelationId, RowExclusiveLock); indexRelation = heap_open(IndexRelationId, RowExclusiveLock);
userHeapRelation = heap_open(heapId, ShareUpdateExclusiveLock);
userIndexRelation = index_open(indexId, ShareUpdateExclusiveLock);
tuple = SearchSysCacheCopy1(INDEXRELID, tuple = SearchSysCacheCopy1(INDEXRELID,
ObjectIdGetDatum(indexId)); ObjectIdGetDatum(indexId));
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment