1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

REASSIGN OWNED: handle shared objects, too

Give away ownership of shared objects (databases, tablespaces) along
with local objects, per original code intention.  Try to make the
documentation clearer, too.

Per discussion about DROP OWNED's brokenness, in bug #7748.

This is not backpatched because it'd require some refactoring of the
ALTER/SET OWNER code for databases and tablespaces.
This commit is contained in:
Alvaro Herrera
2013-01-28 18:03:23 -03:00
parent ec41b8edc1
commit ee22c55f5a
2 changed files with 13 additions and 12 deletions

View File

@ -1325,8 +1325,12 @@ shdepReassignOwned(List *roleids, Oid newrole)
{
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;
/* Unexpected because we checked for pins above */
@ -1388,6 +1392,8 @@ shdepReassignOwned(List *roleids, Oid newrole)
case OperatorFamilyRelationId:
case OperatorClassRelationId:
case ExtensionRelationId:
case TableSpaceRelationId:
case DatabaseRelationId:
{
Oid classId = sdepForm->classid;
Relation catalog;