diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-05-06 12:29:41 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-05-06 12:29:41 -0400 |
commit | 59273a7cec34e5bb8a9483f23a03e3318b52d65b (patch) | |
tree | 0e948af67f31229e32d30a84b6790f1af785ce88 /src/backend/commands/subscriptioncmds.c | |
parent | 984aca448d5dba0f1be162ce41aa23becf5e931a (diff) | |
download | postgresql-59273a7cec34e5bb8a9483f23a03e3318b52d65b.tar.gz postgresql-59273a7cec34e5bb8a9483f23a03e3318b52d65b.zip |
Heed lock protocol in DROP OWNED BY
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
Diffstat (limited to 'src/backend/commands/subscriptioncmds.c')
-rw-r--r-- | src/backend/commands/subscriptioncmds.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index f138e61a8d3..655ce2dc4bb 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -899,7 +899,6 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel) if (slotname) PreventInTransactionBlock(isTopLevel, "DROP SUBSCRIPTION"); - ObjectAddressSet(myself, SubscriptionRelationId, subid); EventTriggerSQLDropAddObject(&myself, true, true); |