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

Commit5f6b0e6

Browse files
committed
Recurse to sequences on ownership change for all relkinds
When a table ownership is changed, we must apply that also to any ownedsequences. (Otherwise, it would result in a situation that cannot berestored, because linked sequences must have the same owner as thetable.) But this was previously only applied to regular tables andmaterialized views. But it should also apply to at least foreigntables. This patch removes the relkind check altogether, because itdoesn't save very much and just introduces the possibility of similaromissions.Bug: #15238Reported-by: Christoph Berg <christoph.berg@credativ.de>
1 parentcb822ff commit5f6b0e6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10045,17 +10045,13 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
1004510045
list_free(index_oid_list);
1004610046
}
1004710047

10048-
if (tuple_class->relkind==RELKIND_RELATION||
10049-
tuple_class->relkind==RELKIND_MATVIEW)
10050-
{
10051-
/* If it has a toast table, recurse to change its ownership */
10052-
if (tuple_class->reltoastrelid!=InvalidOid)
10053-
ATExecChangeOwner(tuple_class->reltoastrelid,newOwnerId,
10054-
true,lockmode);
10048+
/* If it has a toast table, recurse to change its ownership */
10049+
if (tuple_class->reltoastrelid!=InvalidOid)
10050+
ATExecChangeOwner(tuple_class->reltoastrelid,newOwnerId,
10051+
true,lockmode);
1005510052

10056-
/* If it has dependent sequences, recurse to change them too */
10057-
change_owner_recurse_to_sequences(relationOid,newOwnerId,lockmode);
10058-
}
10053+
/* If it has dependent sequences, recurse to change them too */
10054+
change_owner_recurse_to_sequences(relationOid,newOwnerId,lockmode);
1005910055
}
1006010056

1006110057
InvokeObjectPostAlterHook(RelationRelationId,relationOid,0);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp