summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2020-05-06 12:29:41 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2020-05-06 12:29:41 -0400
commit91d97462c96e07a6885261c9d46554b1c4ce834b (patch)
tree854808b0b8239b4d309fee07492af7da97416fff /src/include
parentad53d6efef0ca7ebc3f80531ecd230e5f28d638d (diff)
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/include')
-rw-r--r--src/include/catalog/dependency.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h
index fbcf9044325..a690eac41c5 100644
--- a/src/include/catalog/dependency.h
+++ b/src/include/catalog/dependency.h
@@ -164,6 +164,10 @@ typedef enum ObjectClass
#define PERFORM_DELETION_INTERNAL 0x0001
#define PERFORM_DELETION_CONCURRENTLY 0x0002
+extern void AcquireDeletionLock(const ObjectAddress *object, int flags);
+
+extern void ReleaseDeletionLock(const ObjectAddress *object);
+
extern void performDeletion(const ObjectAddress *object,
DropBehavior behavior, int flags);