aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/heap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index a122bbffce7..ae2efdc760d 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -1250,6 +1250,13 @@ heap_create_with_catalog(const char *relname,
}
/*
+ * Other sessions' catalog scans can't find this until we commit. Hence,
+ * it doesn't hurt to hold AccessExclusiveLock. Do it here so callers
+ * can't accidentally vary in their lock mode or acquisition timing.
+ */
+ LockRelationOid(relid, AccessExclusiveLock);
+
+ /*
* Determine the relation's initial permissions.
*/
if (use_user_acl)