Tom Lane <t...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers