diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 7a366f94f16..150a970cdcc 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -1191,12 +1191,19 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, * created composite type as the desired table type. * So, remove the composite type's dependency on the relation, and record * the relation's dependency on the composite type. + * Also, remove the relation's dependency on the owner, and record the + * composite type's dependency on the owner. */ if (stmt->tsql_tabletype) { deleteDependencyRecordsForClass(typaddress->classId, typaddress->objectId, RelationRelationId, DEPENDENCY_INTERNAL); recordDependencyOn(&address, typaddress, DEPENDENCY_INTERNAL); + + deleteSharedDependencyRecordsFor(address.classId, address.objectId, + address.objectSubId); + recordDependencyOnOwner(typaddress->classId, typaddress->objectId, + ownerId); } /*