* GetSysCacheOid * * A convenience routine that does SearchSysCache and returns the OID in the * oidcol column of the found tuple, or InvalidOid if no tuple could be found. * No lock is retained on the syscache entry. */
| 1462 | * No lock is retained on the syscache entry. |
| 1463 | */ |
| 1464 | Oid |
| 1465 | GetSysCacheOid(int cacheId, |
| 1466 | AttrNumber oidcol, |
| 1467 | Datum key1, |
| 1468 | Datum key2, |
| 1469 | Datum key3, |
| 1470 | Datum key4) |
| 1471 | { |
| 1472 | HeapTuple tuple; |
| 1473 | bool isNull; |
| 1474 | Oid result; |
| 1475 | |
| 1476 | tuple = SearchSysCache(cacheId, key1, key2, key3, key4); |
| 1477 | if (!HeapTupleIsValid(tuple)) |
| 1478 | return InvalidOid; |
| 1479 | result = heap_getattr(tuple, oidcol, |
| 1480 | SysCache[cacheId]->cc_tupdesc, |
| 1481 | &isNull); |
| 1482 | Assert(!isNull); /* columns used as oids should never be NULL */ |
| 1483 | ReleaseSysCache(tuple); |
| 1484 | return result; |
| 1485 | } |
| 1486 | |
| 1487 | |
| 1488 | /* |
no test coverage detected