postgresql/src/backend/optimizer/geqo
Tom Lane c45bf5751b 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>
2016-04-30 12:29:21 -04:00
..
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
geqo_copy.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_cx.c pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
geqo_erx.c Also correct therefor to therefore. 2015-04-26 19:05:39 +02:00
geqo_eval.c Fix planner crash from pfree'ing a partial path that a GatherPath uses. 2016-04-30 12:29:21 -04:00
geqo_main.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_misc.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_mutation.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
geqo_ox1.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
geqo_ox2.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
geqo_pmx.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
geqo_pool.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_px.c pgindent run for release 9.3 2013-05-29 16:58:43 -04:00
geqo_random.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
geqo_recombination.c Improve implementation of GEQO's init_tour() function. 2015-11-05 10:46:14 -05:00
geqo_selection.c Update copyright for 2016 2016-01-02 13:33:40 -05:00