]> granicus.if.org Git - postgresql/commit
Fix old oversight in join removal logic.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 7 Aug 2015 02:14:07 +0000 (22:14 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 7 Aug 2015 02:14:27 +0000 (22:14 -0400)
commitbab163e1218c0c36ccb0c0ef1b8f2d6feb2fc122
tree0f1db53e5826205e0271415d4f890b037b70ebef
parent58e09b902418d07545caec675d67265f1d510f4b
Fix old oversight in join removal logic.

Commit 9e7e29c75ad441450f9b8287bd51c13521641e3b 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.
src/backend/optimizer/plan/analyzejoins.c
src/test/regress/expected/join.out
src/test/regress/sql/join.sql