REASSIGN OWNED: consider grants on tablespaces, too
authorAlvaro Herrera
Wed, 3 Oct 2012 15:22:41 +0000 (12:22 -0300)
committerAlvaro Herrera
Wed, 3 Oct 2012 15:29:38 +0000 (12:29 -0300)
Apparently this was considered in the original code (see commit
cec3b0a9) but I failed to notice that such entries would always be
skipped by the database check at the start of the loop.

Per bugs #7578 by Nikolay, #6116 by [email protected].

src/backend/catalog/pg_shdepend.c

index a2bb9f58a2dd4fb3aa1f7a6c124a6255d423b8a5..1ecf12c211d28c0466b5bb0df646ddc39ac94ba7 100644 (file)
@@ -1214,8 +1214,12 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
            Form_pg_shdepend sdepForm = (Form_pg_shdepend) GETSTRUCT(tuple);
            ObjectAddress obj;
 
-           /* We only operate on objects in the current database */
-           if (sdepForm->dbid != MyDatabaseId)
+           /*
+            * We only operate on shared objects and objects in the current
+            * database
+            */
+           if (sdepForm->dbid != MyDatabaseId &&
+               sdepForm->dbid != InvalidOid)
                continue;
 
            switch (sdepForm->deptype)