aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2013-01-28 17:46:47 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2013-01-28 18:59:55 -0300
commit3eae7940aeae78432e55ce18efb8ef5ea93f9295 (patch)
treea05d8d1bdfb07c9121317b4f7c86406e3017ba33 /src
parentf1a4b15871cc5a5c6c7a791c91cb4552e37dfb4f (diff)
downloadpostgresql-3eae7940aeae78432e55ce18efb8ef5ea93f9295.tar.gz
postgresql-3eae7940aeae78432e55ce18efb8ef5ea93f9295.zip
DROP OWNED: don't try to drop tablespaces/databases
My "fix" for bugs #7578 and #6116 on DROP OWNED at fe3b5eb08a1 not only misstated that it applied to REASSIGN OWNED (which it did not affect), but it also failed to fix the problems fully, because I didn't test the case of owned shared objects. Thus I created a new bug, reported by Thomas Kellerer as #7748, which would cause DROP OWNED to fail with a not-for-user-consumption error message. The code would attempt to drop the database, which not only fails to work because the underlying code does not support that, but is a pretty dangerous and undesirable thing to be doing as well. This patch fixes that bug by having DROP OWNED only attempt to process shared objects when grants on them are found, ignoring ownership. Backpatch to 8.3, which is as far as the previous bug was backpatched.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/pg_shdepend.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 8d2d37c730a..91e26f4e159 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -1235,11 +1235,14 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
sdepForm->objid);
break;
case SHARED_DEPENDENCY_OWNER:
- /* Save it for deletion below */
- obj.classId = sdepForm->classid;
- obj.objectId = sdepForm->objid;
- obj.objectSubId = sdepForm->objsubid;
- add_exact_object_address(&obj, deleteobjs);
+ /* If a local object, save it for deletion below */
+ if (sdepForm->dbid == MyDatabaseId)
+ {
+ obj.classId = sdepForm->classid;
+ obj.objectId = sdepForm->objid;
+ obj.objectSubId = sdepForm->objsubid;
+ add_exact_object_address(&obj, deleteobjs);
+ }
break;
}
}