• Tom Lane's avatar
    Fix old oversight in join removal logic. · bab163e1
    Tom Lane authored
    Commit 9e7e29c7 introduced an Assert that
    join removal didn't reduce the eval_at set of any PlaceHolderVar to empty.
    At first glance it looks like join_is_removable ensures that's true --- but
    actually, the loop in join_is_removable skips PlaceHolderVars that are not
    referenced above the join due to be removed.  So, if we don't want any
    empty eval_at sets, the right thing to do is to delete any now-unreferenced
    PlaceHolderVars from the data structure entirely.
    
    Per fuzz testing by Andreas Seltenreich.  Back-patch to 9.3 where the
    aforesaid Assert was added.
    bab163e1
analyzejoins.c 24.5 KB