1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +03:00

Fix create_lateral_join_info to handle dead relations properly.

Commit 0a480502b0 broke it.

Report by Andreas Seltenreich.  Fix by Ashutosh Bapat.

Discussion: http://postgr.es/m/874ls2vrnx.fsf@ansel.ydns.eu
This commit is contained in:
Robert Haas
2017-09-20 10:20:10 -04:00
parent 7f3a3312ab
commit 57eebca03a
3 changed files with 22 additions and 2 deletions

View File

@ -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 ||