UNIQUE_PATH_NOOP is dead code? - Mailing list pgsql-hackers

From Tom Lane
Subject UNIQUE_PATH_NOOP is dead code?
Date
Msg-id 29448.1549167879@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
I happened to notice while looking at code coverage reports that

(1) the portions of create_unique_path() that report that the input
relation is already known unique are no longer reached in our
regression tests;

(2) the loop in relation_has_unique_index_for() that deals with
an exprlist and oprlist supplied by the caller is never iterated.
This is related to (1) because create_unique_path() is the only
caller that supplies such lists.

While I've not looked at it really closely, I suspect that this
is not just an indication of inadequate testing, but that those
sections are actually dead code now.  create_unique_path() is
only used on a relation that is the RHS of a semijoin, and light
testing suggests that in the cases that create_unique_path()
knows about, analyzejoins.c will have strength-reduced the
semijoin to a plain join.  All this code predates the introduction
of that phase, so it was useful when written, but maybe it's
not anymore.

Not planning to do anything about this observation right at this
moment, but perhaps we could remove some code here.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Synchronize with imath upstream
Next
From: Andrew Gierth
Date:
Subject: Re: Ryu floating point output patch