aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/aclchk.c4
-rw-r--r--src/backend/commands/alter.c17
2 files changed, 18 insertions, 3 deletions
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 30c601c23d2..3b7c6436e6c 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -5719,9 +5719,9 @@ recordExtObjInitPriv(Oid objoid, Oid classoid)
ReleaseSysCache(tuple);
}
- /* pg_largeobject_metadata */
- else if (classoid == LargeObjectMetadataRelationId)
+ else if (classoid == LargeObjectRelationId)
{
+ /* For large objects, we must consult pg_largeobject_metadata */
Datum aclDatum;
bool isNull;
HeapTuple tuple;
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index c8f471be380..4429fbe8b00 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -1035,9 +1035,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 */
@@ -1045,6 +1050,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);
}