summaryrefslogtreecommitdiffstats
path: root/src/backend/commands/alter.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/backend/commands/alter.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 5456b82..6f27a49 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -1046,9 +1046,14 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId)
/* Perform actual update */
CatalogTupleUpdate(rel, &newtup->t_self, newtup);
- /* Update owner dependency reference */
+ /*
+ * Update owner dependency reference. When working on a large object,
+ * we have to translate back to the OID conventionally used for LOs'
+ * classId.
+ */
if (classId == LargeObjectMetadataRelationId)
classId = LargeObjectRelationId;
+
changeDependencyOnOwner(classId, objectId, new_ownerId);
/* Release memory */
@@ -1056,6 +1061,16 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId)
pfree(nulls);
pfree(replaces);
}
+ else
+ {
+ /*
+ * No need to change anything. But when working on a large object, we
+ * have to translate back to the OID conventionally used for LOs'
+ * classId, or the post-alter hook (if any) will get confused.
+ */
+ if (classId == LargeObjectMetadataRelationId)
+ classId = LargeObjectRelationId;
+ }
InvokeObjectPostAlterHook(classId, objectId, 0);
}