Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e1a0f6a

Browse files
committed
Adjust overly strict Assert
3373c71 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
1 parent 330cafd commit e1a0f6a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/optimizer/path/equivclass.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,8 @@ get_eclass_for_sort_expr(PlannerInfo *root,
761761
{
762762
RelOptInfo *rel = root->simple_rel_array[i];
763763

764-
Assert(rel->reloptkind == RELOPT_BASEREL);
764+
Assert(rel->reloptkind == RELOPT_BASEREL ||
765+
rel->reloptkind == RELOPT_DEADREL);
765766

766767
rel->eclass_indexes = bms_add_member(rel->eclass_indexes,
767768
ec_index);

0 commit comments

Comments
 (0)