GetRelationPublicationActions. - Remove unreachable code

Поиск
Список
Период
Сортировка
От Peter Smith
Тема GetRelationPublicationActions. - Remove unreachable code
Дата
Msg-id CAHut+Pv8t3-pXg4L48=5cdy=FMK3EubdpSq6ESgLGVNp8hLx4A@mail.gmail.com
обсуждение исходный текст
Ответы Re: GetRelationPublicationActions. - Remove unreachable code  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi hackers.

There appears to be some unreachable code in the relcache function
GetRelationPublicationActions.

When the 'relation->rd_pubactions' is not NULL then the function
unconditionally returns early (near the top).

Therefore, the following code (near the bottom) seems to have no
purpose because IIUC the 'rd_pubactions' can never be not NULL here.

if (relation->rd_pubactions)
{
pfree(relation->rd_pubactions);
relation->rd_pubactions = NULL;
}

The latest Code Coverage report [1] also shows that this code is never executed.

    5601        3556 :     if (relation->rd_pubactions)
    5602             :     {
    5603           0 :         pfree(relation->rd_pubactions);
    5604           0 :         relation->rd_pubactions = NULL;
    5605             :     }

~~

PSA a patch to remove this unreachable code.

------
[1] https://coverage.postgresql.org/src/backend/utils/cache/relcache.c.gcov.html

Kind Regards,
Peter Smith.
Fujitsu Australia

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: catalog access with reset GUCs during parallel worker startup
Следующее
От: Andres Freund
Дата:
Сообщение: Re: catalog access with reset GUCs during parallel worker startup