• Igor Babaev's avatar
    MDEV-25362 Incorrect name resolution for subqueries in ON expressions · 635b5ce3
    Igor Babaev authored
    This patch sets the proper name resolution context for outer references
    used in a subquery from an ON clause. Usually this context is more narrow
    than the name resolution context of the parent select that were used before
    this fix.
    This fix revealed another problem that concerned ON expressions used in
    from clauses of specifications of derived tables / views / CTEs. The name
    resolution outer context for such ON expression must be set to NULL to
    prevent name resolution beyond the derived table where it is used.
    The solution to resolve this problem applied in sql_derived.cc was provided
    by Sergei Petrunia <sergey@mariadb.com>.
    
    The change in sql_parse.cc is not good for 10.4+. A corresponding diff for
    10.4+ will be provided in JIRA entry for this bug.
    
    Approved by Oleksandr Byelkin <sanja@mariadb.com>
    635b5ce3
sql_parse.cc 318 KB