pgsql: Build EC members for child join rels in the right memory context

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Build EC members for child join rels in the right memory context
Date: 2020-10-06 15:44:05
Message-ID: E1kPp8H-0001ba-Sk@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Build EC members for child join rels in the right memory context.

This patch prevents crashes or wrong plans when partition-wise joins
are considered during GEQO planning, as a consequence of the
EquivalenceClass data structures becoming corrupt after a GEQO
context reset.

A remaining problem is that successive GEQO cycles will make multiple
copies of the required EC members, since add_child_join_rel_equivalences
has no idea that such members might exist already. For now we'll just
live with that. The lack of field complaints of crashes suggests that
this is a mighty little-used situation.

Back-patch to v12 where this code was introduced.

Discussion: https://postgr.es/m/1683100.1601860653@sss.pgh.pa.us

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3d69efc4f07d773329dfbd39d6ec67a025cf7339

Modified Files
--------------
src/backend/optimizer/path/equivclass.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2020-10-06 16:12:27 pgsql: pg_upgrade; change major version comparisons to use <=, not <
Previous Message Magnus Hagander 2020-10-06 13:50:58 pgsql: Further improvements on documentation for pg_dump -t