aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2018-08-21 08:32:18 +0900
committerMichael Paquier <michael@paquier.xyz>2018-08-21 08:32:18 +0900
commit1339fcc896173407d6930dffbc185fe08f1ae86b (patch)
tree2f3f4575741fd195008594816fb835d66353349c /src
parentf3efef434fb107dfec8b7e225779479e39a5a360 (diff)
downloadpostgresql-1339fcc896173407d6930dffbc185fe08f1ae86b.tar.gz
postgresql-1339fcc896173407d6930dffbc185fe08f1ae86b.zip
Clarify comment about assignment and reset of temp namespace ID in MyProc
The new wording comes from Álvaro, which I modified a bit. Reported-by: Andres Freund, Álvaro Herrera Author: Álvaro Herrera, Michael Paquier Discussion: https://postgr.es/m/20180809165047.GK13638@paquier.xyz Backpatch-through: 11
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/namespace.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 3971346e738..5d13e6a3d70 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -3938,8 +3938,10 @@ InitTempTableNamespace(void)
* decide if a temporary namespace is in use or not. We assume that
* assignment of namespaceId is an atomic operation. Even if it is not,
* the temporary relation which resulted in the creation of this temporary
- * namespace is still locked until the current transaction commits, so it
- * would not be accessible yet, acting as a barrier.
+ * namespace is still locked until the current transaction commits, and
+ * its pg_namespace row is not visible yet. However it does not matter:
+ * this flag makes the namespace as being in use, so no objects created on
+ * it would be removed concurrently.
*/
MyProc->tempNamespaceId = namespaceId;
@@ -3976,10 +3978,12 @@ AtEOXact_Namespace(bool isCommit, bool parallel)
/*
* Reset the temporary namespace flag in MyProc. We assume that
- * this operation is atomic. Even if it is not, the temporary
- * table which created this namespace is still locked until this
- * transaction aborts so it would not be visible yet, acting as a
- * barrier.
+ * this operation is atomic.
+ *
+ * Because this transaction is aborting, the pg_namespace row is
+ * not visible to anyone else anyway, but that doesn't matter:
+ * it's not a problem if objects contained in this namespace are
+ * removed concurrently.
*/
MyProc->tempNamespaceId = InvalidOid;
}
@@ -4037,10 +4041,12 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
/*
* Reset the temporary namespace flag in MyProc. We assume that
- * this operation is atomic. Even if it is not, the temporary
- * table which created this namespace is still locked until this
- * transaction aborts so it would not be visible yet, acting as a
- * barrier.
+ * this operation is atomic.
+ *
+ * Because this subtransaction is aborting, the pg_namespace row
+ * is not visible to anyone else anyway, but that doesn't matter:
+ * it's not a problem if objects contained in this namespace are
+ * removed concurrently.
*/
MyProc->tempNamespaceId = InvalidOid;
}