Re: SIREAD lock versus ACCESS EXCLUSIVE lock - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: SIREAD lock versus ACCESS EXCLUSIVE lock
Date
Msg-id 4DEDF5DA020000250003E265@gw.wicourts.gov
Whole thread Raw
In response to Re: SIREAD lock versus ACCESS EXCLUSIVE lock  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: SIREAD lock versus ACCESS EXCLUSIVE lock
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> wrote:
> If you don't believe that a catcache lookup will ever fail, I will
> contract to break the patch.
As you probably know by now by reaching the end of the thread, this
code is going away based on Heikki's arguments; but for my
understanding, so that I don't make a bad assumption in this area
again, what could cause the following function to throw an exception
if the current process is holding an exclusive lock on the relation
passed in to it?  (I could be a heap or an index relation.)  It
seemed safe to me, and I can't spot the risk on a scan of the called
functions.  What am I missing?
static Oid
IfIndexGetRelation(Oid indexId)
{   HeapTuple tuple;   Form_pg_index index;   Oid result;
   tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexId));   if (!HeapTupleIsValid(tuple))       return
InvalidOid;
   index = (Form_pg_index) GETSTRUCT(tuple);   Assert(index->indexrelid == indexId);
   result = index->indrelid;   ReleaseSysCache(tuple);   return result;
}
Thanks for any clues,
-Kevin


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: SIREAD lock versus ACCESS EXCLUSIVE lock
Next
From: Merlin Moncure
Date:
Subject: Re: Range Types and extensions