diff options
Diffstat (limited to 'src/backend/commands/alter.c')
-rw-r--r-- | src/backend/commands/alter.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index d28758cf8b2..535741e9236 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c @@ -592,8 +592,18 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid) Assert(!isnull); oldNspOid = DatumGetObjectId(namespace); + /* + * If the object is already in the correct namespace, we don't need + * to do anything except fire the object access hook. + */ + if (oldNspOid == nspOid) + { + InvokeObjectPostAlterHook(classId, objid, 0); + return oldNspOid; + } + /* Check basic namespace related issues */ - CheckSetNamespace(oldNspOid, nspOid, classId, objid); + CheckSetNamespace(oldNspOid, nspOid); /* Permission checks ... superusers can always do it */ if (!superuser()) |