Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee22c55

Browse files
committed
REASSIGN OWNED: handle shared objects, too
Give away ownership of shared objects (databases, tablespaces) alongwith local objects, per original code intention. Try to make thedocumentation clearer, too.Per discussion about DROP OWNED's brokenness, in bug #7748.This is not backpatched because it'd require some refactoring of theALTER/SET OWNER code for databases and tablespaces.
1 parentec41b8e commitee22c55

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

‎doc/src/sgml/ref/reassign_owned.sgml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...]
3030

3131
<para>
3232
<command>REASSIGN OWNED</command> instructs the system to change
33-
the ownership ofthedatabase objects owned by one of the
33+
the ownership of database objects owned by one of the
3434
old_roles, to new_role.
3535
</para>
3636
</refsect1>
@@ -43,8 +43,9 @@ REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...]
4343
<term><replaceable class="PARAMETER">old_role</replaceable></term>
4444
<listitem>
4545
<para>
46-
The name of a role. The ownership of all the objects in the
47-
current database owned by this role will be reassigned to
46+
The name of a role. The ownership of all the objects within the
47+
current database, and of all shared objects (databases, tablespaces),
48+
owned by this role will be reassigned to
4849
<replaceable class="PARAMETER">new_role</replaceable>.
4950
</para>
5051
</listitem>
@@ -68,7 +69,7 @@ REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...]
6869
<para>
6970
<command>REASSIGN OWNED</command> is often used to prepare for the
7071
removal of one or more roles. Because <command>REASSIGN
71-
OWNED</command>only affects the objectsin the current database,
72+
OWNED</command>does not affect objectswithin other databases,
7273
it is usually necessary to execute this command in each database
7374
that contains objects owned by a role that is to be removed.
7475
</para>
@@ -92,12 +93,6 @@ REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...]
9293
privileges.
9394
</para>
9495

95-
<para>
96-
The <command>REASSIGN OWNED</command> command does not affect the
97-
ownership of any databases owned by the role. Use
98-
<xref linkend="sql-alterdatabase"> to reassign that ownership.
99-
</para>
100-
10196
</refsect1>
10297

10398
<refsect1>

‎src/backend/catalog/pg_shdepend.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,8 +1325,12 @@ shdepReassignOwned(List *roleids, Oid newrole)
13251325
{
13261326
Form_pg_shdependsdepForm= (Form_pg_shdepend)GETSTRUCT(tuple);
13271327

1328-
/* We only operate on objects in the current database */
1329-
if (sdepForm->dbid!=MyDatabaseId)
1328+
/*
1329+
* We only operate on shared objects and objects in the current
1330+
* database
1331+
*/
1332+
if (sdepForm->dbid!=MyDatabaseId&&
1333+
sdepForm->dbid!=InvalidOid)
13301334
continue;
13311335

13321336
/* Unexpected because we checked for pins above */
@@ -1388,6 +1392,8 @@ shdepReassignOwned(List *roleids, Oid newrole)
13881392
caseOperatorFamilyRelationId:
13891393
caseOperatorClassRelationId:
13901394
caseExtensionRelationId:
1395+
caseTableSpaceRelationId:
1396+
caseDatabaseRelationId:
13911397
{
13921398
OidclassId=sdepForm->classid;
13931399
Relationcatalog;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp