From 2eea49471fbaeed050eea4fe0e28cdb8de61d0ac Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 6 May 2020 12:29:41 -0400 Subject: Heed lock protocol in DROP OWNED BY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We were acquiring object locks then deleting objects one by one, instead of acquiring all object locks first, ignoring those that did not exist, and then deleting all objects together. The latter is the correct protocol to use, and what this commits changes to code to do. Failing to follow that leads to "cache lookup failed for relation XYZ" error reports when DROP OWNED runs concurrently with other DDL -- for example, a session termination that removes some temp tables. Author: Álvaro Herrera Reported-by: Mithun Chicklore Yogendra (Mithun CY) Reviewed-by: Ahsan Hadi, Tom Lane Discussion: https://postgr.es/m/CADq3xVZTbzK4ZLKq+dn_vB4QafXXbmMgDP3trY-GuLnib2Ai1w@mail.gmail.com --- src/backend/commands/subscriptioncmds.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/backend/commands') diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index 2e67a5889e5..aa88092f3a4 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -928,7 +928,6 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel) if (slotname) PreventInTransactionBlock(isTopLevel, "DROP SUBSCRIPTION"); - ObjectAddressSet(myself, SubscriptionRelationId, subid); EventTriggerSQLDropAddObject(&myself, true, true); -- cgit v1.2.3