diff options
author | David Rowley <drowley@postgresql.org> | 2019-07-22 10:29:41 +1200 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2019-07-22 10:29:41 +1200 |
commit | e1a0f6a983068675813074847e1d0d61bd37ac0e (patch) | |
tree | 670240ac75e82c99834c721396c3f65cd2ed351d /src | |
parent | 330cafdfaa11ebe53e3e59688acac1577ae0cb34 (diff) | |
download | postgresql-e1a0f6a983068675813074847e1d0d61bd37ac0e.tar.gz postgresql-e1a0f6a983068675813074847e1d0d61bd37ac0e.zip |
Adjust overly strict Assert
3373c7155 changed how we determine EquivalenceClasses for relations and
added an Assert to ensure all relations mentioned in each EC's ec_relids
was a RELOPT_BASEREL. However, the join removal code may remove a LEFT
JOIN and since it does not clean up EC members belonging to the removed
relations it can leave RELOPT_DEADREL rels in ec_relids.
Fix this by adjusting the Assert to allow RELOPT_DEADREL rels too.
Reported-by: sqlsmith via Andreas Seltenreich
Discussion: https://postgr.es/m/87y30r8sls.fsf@ansel.ydns.eu
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/optimizer/path/equivclass.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c index 2c595dfb08c..ccc07ba9f0d 100644 --- a/src/backend/optimizer/path/equivclass.c +++ b/src/backend/optimizer/path/equivclass.c @@ -761,7 +761,8 @@ get_eclass_for_sort_expr(PlannerInfo *root, { RelOptInfo *rel = root->simple_rel_array[i]; - Assert(rel->reloptkind == RELOPT_BASEREL); + Assert(rel->reloptkind == RELOPT_BASEREL || + rel->reloptkind == RELOPT_DEADREL); rel->eclass_indexes = bms_add_member(rel->eclass_indexes, ec_index); |