pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix planner crash from pfree'ing a partial path that a GatherPat
Date: Sat, 30 Apr 2016 16:29:26 +0000
Message-ID: <E1awXlm-0003rq-RC@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix planner crash from pfree'ing a partial path that a GatherPath uses.

We mustn't run generate_gather_paths() during add_paths_to_joinrel(),
because that function can be invoked multiple times for the same target
joinrel.  Not only is it wasteful to build GatherPaths repeatedly, but
a later add_partial_path() could delete the partial path that a previously
created GatherPath depends on.  Instead establish the convention that we
do generate_gather_paths() for a rel only just before set_cheapest().

The code was accidentally not broken for baserels, because as of today there
never is more than one partial path for a baserel.  But that assumption
obviously has a pretty short half-life, so move the generate_gather_paths()
calls for those cases as well.

Also add some generic comments explaining how and why this all works.

Per fuzz testing by Andreas Seltenreich.

Report: <871t5pgwdt.fsf@credativ.de>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c45bf5751b6338488bd79ce777210285531da373

Modified Files
--------------
src/backend/optimizer/README           | 15 ++++++++--
src/backend/optimizer/geqo/geqo_eval.c |  3 ++
src/backend/optimizer/path/allpaths.c  | 50 ++++++++++++++++++++--------------
src/backend/optimizer/path/joinpath.c  |  7 +----
src/backend/optimizer/util/pathnode.c  | 30 ++++++++++++++++----
5 files changed, 71 insertions(+), 34 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1awXlm-0003rq-RC@gemulon.postgresql.org>
Permalink:  ../E1awXlm-0003rq-RC@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1awXlm-0003rq-RC@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix planner crash from pfree'ing a partial path that a GatherPat
  In-Reply-To: <E1awXlm-0003rq-RC@gemulon.postgresql.org>
  References: <E1awXlm-0003rq-RC@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox