UNIQUE_PATH_NOOP is dead code?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: UNIQUE_PATH_NOOP is dead code?
Date: 2019-02-03 04:24:39
Message-ID: 29448.1549167879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2019-02-03 05:56:27 Re: Ryu floating point output patch
Previous Message Noah Misch 2019-02-03 03:57:04 Synchronize with imath upstream