mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Rethink behavior of CREATE OR REPLACE during CREATE EXTENSION.
The original implementation simply did nothing when replacing an existing object during CREATE EXTENSION. The folly of this was exposed by a report from Marc Munro: if the existing object belongs to another extension, we are left in an inconsistent state. We should insist that the object does not belong to another extension, and then add it to the current extension if not already a member.
This commit is contained in:
@ -515,7 +515,7 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt)
|
||||
recordDependencyOnOwner(ForeignDataWrapperRelationId, fdwId, ownerId);
|
||||
|
||||
/* dependency on extension */
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, false);
|
||||
|
||||
/* Post creation hook for new foreign data wrapper */
|
||||
InvokeObjectAccessHook(OAT_POST_CREATE,
|
||||
@ -857,7 +857,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
|
||||
recordDependencyOnOwner(ForeignServerRelationId, srvId, ownerId);
|
||||
|
||||
/* dependency on extension */
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, false);
|
||||
|
||||
/* Post creation hook for new foreign server */
|
||||
InvokeObjectAccessHook(OAT_POST_CREATE, ForeignServerRelationId, srvId, 0);
|
||||
@ -1137,7 +1137,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
|
||||
}
|
||||
|
||||
/* dependency on extension */
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, false);
|
||||
|
||||
/* Post creation hook for new user mapping */
|
||||
InvokeObjectAccessHook(OAT_POST_CREATE, UserMappingRelationId, umId, 0);
|
||||
|
Reference in New Issue
Block a user