aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/joinrels.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2018-02-05 17:31:57 -0500
committerRobert Haas <rhaas@postgresql.org>2018-02-05 17:31:57 -0500
commitf069c91a5793ff6b7884120de748b2005ee7756f (patch)
tree2b5125e6ba39362e8eafa0f34e6b3f023432f801 /src/backend/optimizer/path/joinrels.c
parent1eb5d43beed9d8cdc61377867f0a53eb2cfba0c4 (diff)
downloadpostgresql-f069c91a5793ff6b7884120de748b2005ee7756f.tar.gz
postgresql-f069c91a5793ff6b7884120de748b2005ee7756f.zip
Fix possible crash in partition-wise join.
The previous code assumed that we'd always succeed in creating child-joins for a joinrel for which partition-wise join was considered, but that's not guaranteed, at least in the case where dummy rels are involved. Ashutosh Bapat, with some wordsmithing by me. Discussion: http://postgr.es/m/CAFjFpRf8=uyMYYfeTBjWDMs1tR5t--FgOe2vKZPULxxdYQ4RNw@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/path/joinrels.c')
-rw-r--r--src/backend/optimizer/path/joinrels.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index a35d0689119..f74afdb4dda 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -1319,17 +1319,6 @@ try_partition_wise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
return;
/*
- * set_rel_pathlist() may not create paths in children of an empty
- * partitioned table and so we can not add paths to child-joins. So, deem
- * such a join as unpartitioned. When a partitioned relation is deemed
- * empty because all its children are empty, dummy path will be set in
- * each of the children. In such a case we could still consider the join
- * as partitioned, but it might not help much.
- */
- if (IS_DUMMY_REL(rel1) || IS_DUMMY_REL(rel2))
- return;
-
- /*
* Since this join relation is partitioned, all the base relations
* participating in this join must be partitioned and so are all the
* intermediate join relations.
@@ -1360,11 +1349,6 @@ try_partition_wise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
nparts = joinrel->nparts;
- /* Allocate space to hold child-joins RelOptInfos, if not already done. */
- if (!joinrel->part_rels)
- joinrel->part_rels =
- (RelOptInfo **) palloc0(sizeof(RelOptInfo *) * nparts);
-
/*
* Create child-join relations for this partitioned join, if those don't
* exist. Add paths to child-joins for a pair of child relations