Skip to content
  • Jan Wedvik's avatar
    bf5eecb2
    Bug#31853180 ASSERTION "SELECT_LEX..NEST_LAST_JOIN" · bf5eecb2
    Jan Wedvik authored
    Some SHOW statements call make_schema_query_block() to generate a
    query towards an information schema table. This query then fetches
    the data set that will be the result of the SHOW statement. A subset
    of these SHOW statements allow an optional WHERE-clause. This applies
    to SHOW OPEN TABLES, SHOW FIELDS/COLUMNS, and SHOW KEYS. If the
    WHERE-clause contains a subquery (e.g. "SHOW OPEN TABLES WHERE 1 IN
    (SELECT c1 FROM t1)"), the optimizer may try to transform the subquery
    into a join between the information schema table and a derived table
    (derived from "SELECT c1 FROM t1" in the example above). This triggers
    an assert or segment violation, because Query_block.join_list at that
    point is empty, i.e. there is nothing to join the derived table
    with. Query_block.join_list is empty because make_schema_query_block()
    fails to add the information schema table to join_list.
    
    The fix alters make_schema_query_block() so that it adds the
    information schema table to Query_block.join_list. It also adds
    testcases to verify the fix.
    
    Change-Id: I7a0ed7a133ffc739e0ef495446c9703d02e7b66a
    bf5eecb2
    Bug#31853180 ASSERTION "SELECT_LEX..NEST_LAST_JOIN"
    Jan Wedvik authored
    Some SHOW statements call make_schema_query_block() to generate a
    query towards an information schema table. This query then fetches
    the data set that will be the result of the SHOW statement. A subset
    of these SHOW statements allow an optional WHERE-clause. This applies
    to SHOW OPEN TABLES, SHOW FIELDS/COLUMNS, and SHOW KEYS. If the
    WHERE-clause contains a subquery (e.g. "SHOW OPEN TABLES WHERE 1 IN
    (SELECT c1 FROM t1)"), the optimizer may try to transform the subquery
    into a join between the information schema table and a derived table
    (derived from "SELECT c1 FROM t1" in the example above). This triggers
    an assert or segment violation, because Query_block.join_list at that
    point is empty, i.e. there is nothing to join the derived table
    with. Query_block.join_list is empty because make_schema_query_block()
    fails to add the information schema table to join_list.
    
    The fix alters make_schema_query_block() so that it adds the
    information schema table to Query_block.join_list. It also adds
    testcases to verify the fix.
    
    Change-Id: I7a0ed7a133ffc739e0ef495446c9703d02e7b66a
Loading