objectaddress-retry.patch
application/octet-stream
Filename: objectaddress-retry.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/catalog/objectaddress.c | 8 | 3 |
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
index ec4c987..94135fd 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -281,6 +281,7 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
/* Some kind of lock must be taken. */
Assert(lockmode != NoLock);
+retry:
switch (objtype)
{
case OBJECT_INDEX:
@@ -432,10 +433,14 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
LockSharedObject(address.classId, address.objectId, 0, lockmode);
else
LockDatabaseObject(address.classId, address.objectId, 0, lockmode);
- /* Did it go away while we were waiting for the lock? */
+ /*
+ * Did it go away while we were waiting for the lock? If so, look up
+ * the name again. This will either throw a better error message than
+ * we could generate otherwise, or it will find the new object that
+ * now has the same name as the dropped one.
+ */
if (!object_exists(address))
- elog(ERROR, "cache lookup failed for class %u object %u subobj %d",
- address.classId, address.objectId, address.objectSubId);
+ goto retry;
}
/* Return the object address and the relation. */