isTempNamespaceInUse() is incorrect with its handling of MyBackendId

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема isTempNamespaceInUse() is incorrect with its handling of MyBackendId
Дата
Msg-id 20200113093703.GA41902@paquier.xyz
обсуждение исходный текст
Ответы Re: isTempNamespaceInUse() is incorrect with its handling ofMyBackendId
Список pgsql-hackers
Hi all,

While reviewing some code in namespace.c, I have bumped into the
following issue introduced by 246a6c8:
diff --git a/src/backend/catalog/namespace.c
b/src/backend/catalog/namespace.c
index c82f9fc4b5..e70243a008 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;

The current logic of isTempNamespaceInUse() would cause a session
calling the routine to return always false if trying to check if its
own temporary session is in use, but that's incorrect.  It is actually
safe to remove the check on MyBackendId as the code would fall back on
a check equivalent to MyProc->tempNamespaceId a bit down as per the
attached, so let's fix it.

Thoughts?
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andy Fan
Дата:
Сообщение: Re: How to make a OpExpr check compatible among different versions
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: PATCH: logical_work_mem and logical streaming of largein-progress transactions