Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
REASSIGN OWNED: consider grants on tablespaces, too
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 3 Oct 2012 15:22:41 +0000 (12:22 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 3 Oct 2012 15:22:41 +0000 (12:22 -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 tushar.qa@gmail.com.

src/backend/catalog/pg_shdepend.c

index 2420a9855fd58410366a083df865618361254d57..6f4d52c173025d95bb434e56152f4f9f75929737 100644 (file)
@@ -1166,8 +1166,12 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
            InternalGrant istmt;
            Form_pg_shdepend sdepForm = (Form_pg_shdepend) GETSTRUCT(tuple);
 
-           /* 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)