• gkodinov@mysql.com's avatar
    Bug #15355: Common natural join column not resolved in prepared statement nested · 395affb8
    gkodinov@mysql.com authored
      query
    Problem:
    There was a wrong context assigned to the columns that were added in insert_fields()
    when expanding a '*'. When this is done in a prepared statement it causes 
    fix_fields() to fail to find the table that these columns reference.
    Actually the right context is set in setup_natural_join_row_types() called at the 
    end of setup_tables(). However when executed in a context of a prepared statement
    setup_tables() resets the context, but setup_natural_join_row_types() was not
    setting it to the correct value assuming it has already done so.
    
    Solution:
    The top-most, left-most NATURAL/USING join must be set as a 
    first_name_resolution_table in context even when operating on prepared statements.
    395affb8
join.test 28.7 KB