mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +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:
@ -142,7 +142,7 @@ makeParserDependencies(HeapTuple tuple)
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
|
||||
|
||||
/* dependency on extension */
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, false);
|
||||
|
||||
/* dependencies on functions */
|
||||
referenced.classId = ProcedureRelationId;
|
||||
@ -479,7 +479,7 @@ makeDictionaryDependencies(HeapTuple tuple)
|
||||
recordDependencyOnOwner(myself.classId, myself.objectId, dict->dictowner);
|
||||
|
||||
/* dependency on extension */
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, false);
|
||||
|
||||
/* dependency on template */
|
||||
referenced.classId = TSTemplateRelationId;
|
||||
@ -1069,7 +1069,7 @@ makeTSTemplateDependencies(HeapTuple tuple)
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
|
||||
|
||||
/* dependency on extension */
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, false);
|
||||
|
||||
/* dependencies on functions */
|
||||
referenced.classId = ProcedureRelationId;
|
||||
@ -1417,8 +1417,7 @@ makeConfigurationDependencies(HeapTuple tuple, bool removeOld,
|
||||
recordDependencyOnOwner(myself.classId, myself.objectId, cfg->cfgowner);
|
||||
|
||||
/* dependency on extension */
|
||||
if (!removeOld)
|
||||
recordDependencyOnCurrentExtension(&myself);
|
||||
recordDependencyOnCurrentExtension(&myself, removeOld);
|
||||
|
||||
/* dependency on parser */
|
||||
referenced.classId = TSParserRelationId;
|
||||
|
Reference in New Issue
Block a user