aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-09-20 10:20:10 -0400
committerRobert Haas <rhaas@postgresql.org>2017-09-20 10:20:10 -0400
commit57eebca03a9eb61eb18f8ea9db94775653f797d1 (patch)
treec1a9834369b762508c1c77a6253ad23a66a9159e /src/backend
parent7f3a3312abf34ea7e899046e326775612802764b (diff)
downloadpostgresql-57eebca03a9eb61eb18f8ea9db94775653f797d1.tar.gz
postgresql-57eebca03a9eb61eb18f8ea9db94775653f797d1.zip
Fix create_lateral_join_info to handle dead relations properly.
Commit 0a480502b092195a9b25a2f0f199a21d592a9c57 broke it. Report by Andreas Seltenreich. Fix by Ashutosh Bapat. Discussion: http://postgr.es/m/874ls2vrnx.fsf@ansel.ydns.eu
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/optimizer/plan/initsplan.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index ad81f0f82ff..9931dddba43 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -632,7 +632,11 @@ create_lateral_join_info(PlannerInfo *root)
RelOptInfo *brel = root->simple_rel_array[rti];
RangeTblEntry *brte = root->simple_rte_array[rti];
- if (brel == NULL)
+ /*
+ * Skip empty slots. Also skip non-simple relations i.e. dead
+ * relations.
+ */
+ if (brel == NULL || !IS_SIMPLE_REL(brel))
continue;
/*
@@ -644,7 +648,6 @@ create_lateral_join_info(PlannerInfo *root)
* therefore be marked with the appropriate lateral info so that those
* children eventually get marked also.
*/
- Assert(IS_SIMPLE_REL(brel));
Assert(brte);
if (brel->reloptkind == RELOPT_OTHER_MEMBER_REL &&
(brte->rtekind != RTE_RELATION ||