• Evgeny Potemkin's avatar
    Bug#45266: Uninitialized variable lead to an empty result. · 72d020a2
    Evgeny Potemkin authored
    The TABLE::reginfo.impossible_range is used by the optimizer to indicate
    that the condition applied to the table is impossible. It wasn't initialized
    at table opening and this might lead to an empty result on complex queries:
    a query might set the impossible_range flag on a table and when the query finishes,
    all tables are returned back to the table cache. The next query that uses the table
    with the impossible_range flag set and an index over the table will see the flag
    and thus return an empty result.
    
    The open_table function now initializes the TABLE::reginfo.impossible_range
    variable.
    
    mysql-test/r/select.result:
      A test case for the bug#45266: Uninitialized variable lead to an empty result.
    mysql-test/t/select.test:
      A test case for the bug#45266: Uninitialized variable lead to an empty result.
    sql/sql_base.cc:
      Bug#45266: Uninitialized variable lead to an empty result.
      The open_table function now initializes the TABLE::reginfo.impossible_range
      variable.
    sql/sql_select.cc:
      Bug#45266: Uninitialized variable lead to an empty result.
      The open_table function now initializes the TABLE::reginfo.impossible_range
      variable.
    sql/structs.h:
      Bug#45266: Uninitialized variable lead to an empty result.
      A comment is added.
    72d020a2
select.result 130 KB