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

Attachment: v1-0001-Remove-unreachable-code-in-GetRelationPublication.patch
Description: Binary data

Reply via email to