@@ -3938,8 +3938,10 @@ InitTempTableNamespace(void)
3938
3938
* decide if a temporary namespace is in use or not. We assume that
3939
3939
* assignment of namespaceId is an atomic operation. Even if it is not,
3940
3940
* the temporary relation which resulted in the creation of this temporary
3941
- * namespace is still locked until the current transaction commits, so it
3942
- * would not be accessible yet, acting as a barrier.
3941
+ * namespace is still locked until the current transaction commits, and
3942
+ * its pg_namespace row is not visible yet. However it does not matter:
3943
+ * this flag makes the namespace as being in use, so no objects created on
3944
+ * it would be removed concurrently.
3943
3945
*/
3944
3946
MyProc -> tempNamespaceId = namespaceId ;
3945
3947
@@ -3976,10 +3978,12 @@ AtEOXact_Namespace(bool isCommit, bool parallel)
3976
3978
3977
3979
/*
3978
3980
* Reset the temporary namespace flag in MyProc. We assume that
3979
- * this operation is atomic. Even if it is not, the temporary
3980
- * table which created this namespace is still locked until this
3981
- * transaction aborts so it would not be visible yet, acting as a
3982
- * barrier.
3981
+ * this operation is atomic.
3982
+ *
3983
+ * Because this transaction is aborting, the pg_namespace row is
3984
+ * not visible to anyone else anyway, but that doesn't matter:
3985
+ * it's not a problem if objects contained in this namespace are
3986
+ * removed concurrently.
3983
3987
*/
3984
3988
MyProc -> tempNamespaceId = InvalidOid ;
3985
3989
}
@@ -4037,10 +4041,12 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
4037
4041
4038
4042
/*
4039
4043
* Reset the temporary namespace flag in MyProc. We assume that
4040
- * this operation is atomic. Even if it is not, the temporary
4041
- * table which created this namespace is still locked until this
4042
- * transaction aborts so it would not be visible yet, acting as a
4043
- * barrier.
4044
+ * this operation is atomic.
4045
+ *
4046
+ * Because this subtransaction is aborting, the pg_namespace row
4047
+ * is not visible to anyone else anyway, but that doesn't matter:
4048
+ * it's not a problem if objects contained in this namespace are
4049
+ * removed concurrently.
4044
4050
*/
4045
4051
MyProc -> tempNamespaceId = InvalidOid ;
4046
4052
}
0 commit comments