• unknown's avatar
    Fix for BUG#15229. · de1e87bb
    unknown authored
    The cause of this bug was a design flaw due to which the list of natural
    join columns was incorrectly computed and stored for nested joins that
    are not natural joins, but are operands (possibly indirect) of nested joins.
    
    The patch corrects the flaw in a such a way, that the result columns of a
    table reference are materialized only if it is a leaf table (that is, only
    if it is a view, stored table, or natural/using join).
    
    
    mysql-test/r/join.result:
      Added test for BUG#15229 and uncommented failing test cases of
      BUG#15357 (now fixed by this patch).
    mysql-test/t/join.test:
      Added test for BUG#15229 and uncommented failing test cases of
      BUG#15357 (now fixed by this patch).
    sql/sql_base.cc:
      - Do not materialize the result columns of regular nested joins
        (that are not natural/using joins).
      - Moved most of the code that creates/adds new natural join column
        references to the method 'get_or_create_column_ref', and simplified
        'mark_common_columns'.
      - Replaced a call to 'get_or_create_column_ref' with 'get_natural_column_ref'
        where it is for sure all columns are alredy created.
    sql/table.cc:
      - Modified the method 'get_or_create_column_ref' so that it adds itself
        the newly created natural join columns to the respective table reference.
    sql/table.h:
      - Modified the method 'get_or_create_column_ref' so that it adds itself
        the newly created natural join columns to the respective table reference.
    de1e87bb
join.test 27.8 KB