diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/extension.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 41857feda9f..b37009bfec4 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -3302,9 +3302,17 @@ ExecAlterExtensionContentsStmt(AlterExtensionContentsStmt *stmt, break; } - extension.classId = ExtensionRelationId; - extension.objectId = get_extension_oid(stmt->extname, false); - extension.objectSubId = 0; + /* + * Find the extension and acquire a lock on it, to ensure it doesn't get + * dropped concurrently. A sharable lock seems sufficient: there's no + * reason not to allow other sorts of manipulations, such as add/drop of + * other objects, to occur concurrently. Concurrently adding/dropping the + * *same* object would be bad, but we prevent that by using a non-sharable + * lock on the individual object, below. + */ + extension = get_object_address(OBJECT_EXTENSION, + (Node *) makeString(stmt->extname), + &relation, AccessShareLock, false); /* Permission check: must own extension */ if (!pg_extension_ownercheck(extension.objectId, GetUserId())) |