postgres.git / summary / log / commit / refs

commit    0fca3d0a4ec297bff5a5cb01dfe345e0f63d7d63
Author:   Michael Paquier <michael@paquier.xyz>
Date:     Wed Jan 15 04:58:41 2020 +0000
First released in: 13.0, 11.7, 12.2

    Fix buggy logic in isTempNamespaceInUse()
    
    The logic introduced in this routine as of 246a6c8 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


src/backend/catalog/namespace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 8d0896c3eb6..b8f0e1da6e9 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -3235,8 +3235,8 @@ isTempNamespaceInUse(Oid namespaceId) backendId = GetTempNamespaceBackendId(namespaceId); - if (backendId == InvalidBackendId || - backendId == MyBackendId) + /* No such temporary namespace? */ + if (backendId == InvalidBackendId) return false; /* Is the backend alive? */ [parent: 29af9c542f6c]