pgsql: Fix old oversight in join removal logic.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix old oversight in join removal logic.
Date: 2015-08-07 02:14:40
Message-ID: E1ZNXBA-00052Q-UW@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8c7bb02409548a88fa02d6f8771e2a6ca27007d3

Modified Files
--------------
src/backend/optimizer/plan/analyzejoins.c | 20 ++++++++++++++------
src/test/regress/expected/join.out | 16 ++++++++++++++++
src/test/regress/sql/join.sql | 15 +++++++++++++++
3 files changed, 45 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2015-08-07 02:34:08 pgsql: 9.5 release notes: updates from Andres Freund and Jeff Janes
Previous Message Bruce Momjian 2015-08-07 01:09:01 pgsql: 9.5 release notes: mention ON CONFLICT DO NOTHING for FDWs