Commit b9fda39d authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Added call to heap_endscan in IndexIsUniqueNoCache - to release

our READ lock on pg_index and let others to create indices too !
parent dd07f766
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.13 1997/03/24 07:39:47 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.14 1997/03/27 04:13:44 vadim Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1714,7 +1714,7 @@ IndexIsUnique(Oid indexId) ...@@ -1714,7 +1714,7 @@ IndexIsUnique(Oid indexId)
ObjectIdGetDatum(indexId), ObjectIdGetDatum(indexId),
0,0,0); 0,0,0);
if(!HeapTupleIsValid(tuple)) { if(!HeapTupleIsValid(tuple)) {
elog(WARN, "Can't find index id %d in IndexIsUnique", elog(WARN, "IndexIsUnique: can't find index id %d",
indexId); indexId);
} }
index = (IndexTupleForm)GETSTRUCT(tuple); index = (IndexTupleForm)GETSTRUCT(tuple);
...@@ -1742,7 +1742,6 @@ IndexIsUniqueNoCache(Oid indexId) ...@@ -1742,7 +1742,6 @@ IndexIsUniqueNoCache(Oid indexId)
ScanKeyData skey[1]; ScanKeyData skey[1];
HeapScanDesc scandesc; HeapScanDesc scandesc;
HeapTuple tuple; HeapTuple tuple;
Buffer b;
IndexTupleForm index; IndexTupleForm index;
bool isunique; bool isunique;
...@@ -1755,15 +1754,16 @@ IndexIsUniqueNoCache(Oid indexId) ...@@ -1755,15 +1754,16 @@ IndexIsUniqueNoCache(Oid indexId)
scandesc = heap_beginscan(pg_index, 0, SelfTimeQual, 1, skey); scandesc = heap_beginscan(pg_index, 0, SelfTimeQual, 1, skey);
tuple = heap_getnext(scandesc, 0, &b); tuple = heap_getnext(scandesc, 0, NULL);
if(!HeapTupleIsValid(tuple)) { if(!HeapTupleIsValid(tuple)) {
elog(WARN, "Can't find index id %d in IndexIsUniqueNoCache", elog(WARN, "IndexIsUniqueNoCache: can't find index id %d",
indexId); indexId);
} }
index = (IndexTupleForm)GETSTRUCT(tuple); index = (IndexTupleForm)GETSTRUCT(tuple);
Assert(index->indexrelid == indexId); Assert(index->indexrelid == indexId);
isunique = index->indisunique; isunique = index->indisunique;
ReleaseBuffer(b); heap_endscan (scandesc);
heap_close (pg_index);
return isunique; return isunique;
} }
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