diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-11-19 10:49:25 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-11-19 10:49:25 -0500 |
commit | bc4996e61b98d41eacf991c18508b7a2305a68c6 (patch) | |
tree | b0f8404f7f1fe62f6fe0c530c23e4c70acc7dede /src/backend/commands/alter.c | |
parent | f11c557e92c50d3d613d1173c15feb5310ba4744 (diff) | |
download | postgresql-bc4996e61b98d41eacf991c18508b7a2305a68c6.tar.gz postgresql-bc4996e61b98d41eacf991c18508b7a2305a68c6.zip |
Make ALTER .. SET SCHEMA do nothing, instead of throwing an ERROR.
This was already true for CREATE EXTENSION, but historically has not
been true for other object types. Therefore, this is a backward
incompatibility. Per discussion on pgsql-hackers, everyone seems to
agree that the new behavior is better.
Marti Raudsepp, reviewed by Haribabu Kommi and myself
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()) |