• H
    Fall back for selects of outer refs in scalar subquery in ORCA (#10836) · df5f06d6
    Hans Zeller 提交于
    This is a backport of the changes in #10799 to 6X_STABLE.
    
    When we have an outer ref in a subquery, like this
    
    select * from foo where foo.a is null or foo.a = (select foo.b from bar)
    
    then we can't simply use the outer reference for the condition when
    we unnest the subquery into an apply. This is because if the subquery
    returns no rows, then we must be using a NULL instead of the outer
    reference.
    
    We have code to handle this for quantified subqueries, but not for
    scalar subqueries.
    
    When we translate the generated DXL to a plan, we assert when we find
    an outer reference in the project list of a subquery. In rare cases,
    we might also crash, when the subquery contained a project with multiple
    values below the outer reference (see added test in gporca.sql).
    
    The "fix" (more a workaround) is to force a fallback when we detect
    this situation during unnesting of a scalar subquery.
    df5f06d6
gporca.sql 108.0 KB