Check if a set of tables specified by used_tables can be accessed when we're doing scan on join_tab jtab. */
| 13666 | we're doing scan on join_tab jtab. |
| 13667 | */ |
| 13668 | static bool are_tables_local(JOIN_TAB *jtab, table_map used_tables) |
| 13669 | { |
| 13670 | if (jtab->bush_root_tab) |
| 13671 | { |
| 13672 | /* |
| 13673 | jtab is inside execution join nest. We may not refer to outside tables, |
| 13674 | except the const tables. |
| 13675 | */ |
| 13676 | table_map local_tables= jtab->emb_sj_nest->nested_join->used_tables | |
| 13677 | jtab->join->const_table_map | |
| 13678 | OUTER_REF_TABLE_BIT; |
| 13679 | return !MY_TEST(used_tables & ~local_tables); |
| 13680 | } |
| 13681 | |
| 13682 | /* |
| 13683 | If we got here then jtab is at top level. |
| 13684 | - all other tables at top level are accessible, |
| 13685 | - tables in join nests are accessible too, because all their columns that |
| 13686 | are needed at top level will be unpacked when scanning the |
| 13687 | materialization table. |
| 13688 | */ |
| 13689 | return TRUE; |
| 13690 | } |
| 13691 | |
| 13692 | static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, |
| 13693 | KEYUSE *org_keyuse, bool allow_full_scan, |
no outgoing calls
no test coverage detected