Nobody using the missing_ok flag yet, but let's speculate that this will
be a better interface for future callers.
KaiGai Kohei, with some adjustments by me.
* Caller is expecting to get back the relation, even though we
* didn't end up using it to find the rule.
*/
- relation = heap_open(reloid, AccessShareLock);
+ if (OidIsValid(address.objectId))
+ relation = heap_open(reloid, AccessShareLock);
}
else
{
address.objectId = InvalidOid;
address.objectSubId = 0;
}
+
+ /* Avoid relcache leak when object not found. */
+ if (!OidIsValid(address.objectId))
+ {
+ heap_close(relation, AccessShareLock);
+ relation = NULL; /* department of accident prevention */
+ return address;
+ }
}
/* Done. */