From eb15f26d577a11319b9429fb84f752a0135918db Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 23 Jul 2011 16:59:49 -0400 Subject: 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. --- src/backend/commands/proclang.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/proclang.c') diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index b36f31ee6d5..98770c5a61a 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -388,8 +388,7 @@ create_proc_lang(const char *languageName, bool replace, * Create dependencies for the new language. If we are updating an * existing language, first delete any existing pg_depend entries. * (However, since we are not changing ownership or permissions, the - * shared dependencies do *not* need to change, and we leave them alone. - * We also don't change any pre-existing extension-membership dependency.) + * shared dependencies do *not* need to change, and we leave them alone.) */ myself.classId = LanguageRelationId; myself.objectId = HeapTupleGetOid(tup); @@ -404,8 +403,7 @@ create_proc_lang(const char *languageName, bool replace, languageOwner); /* dependency on extension */ - if (!is_update) - recordDependencyOnCurrentExtension(&myself); + recordDependencyOnCurrentExtension(&myself, is_update); /* dependency on the PL handler function */ referenced.classId = ProcedureRelationId; -- cgit v1.2.3