Commit ac5bdf62 authored by Michael Paquier's avatar Michael Paquier

Fix buggy logic in isTempNamespaceInUse()

The logic introduced in this routine as of 246a6c8f would report an
incorrect result when a session calls it to check if the temporary
namespace owned by the session is in use or not.  It is possible to
optimize more the routine in this case to avoid a PGPROC lookup, but
let's keep the logic simple.  As this routine is used only by autovacuum
for now, there were no live bugs, still let's be correct for any future
code involving it.

Author: Michael Paquier
Reviewed-by: Julien Rouhaud
Discussion: https://postgr.es/m/20200113093703.GA41902@paquier.xyz
Backpatch-through: 11
parent 4d8a8d0c
...@@ -3235,8 +3235,8 @@ isTempNamespaceInUse(Oid namespaceId) ...@@ -3235,8 +3235,8 @@ isTempNamespaceInUse(Oid namespaceId)
backendId = GetTempNamespaceBackendId(namespaceId); backendId = GetTempNamespaceBackendId(namespaceId);
if (backendId == InvalidBackendId || /* No such temporary namespace? */
backendId == MyBackendId) if (backendId == InvalidBackendId)
return false; return false;
/* Is the backend alive? */ /* Is the backend alive? */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment