diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/table.cc | 4 | ||||
-rw-r--r-- | sql/table.h | 9 |
4 files changed, 15 insertions, 4 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 60371813280..54bf3bf29f2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2040,11 +2040,13 @@ retry_share: if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME)))) goto err_lock; + table_list->intention_table= table; error= open_table_from_share(thd, share, &table_list->alias, HA_OPEN_KEYFILE | HA_TRY_READ_ONLY, EXTRA_RECORD, thd->open_options, table, FALSE, - IF_PARTITIONING(table_list->partition_names,0)); + IF_PARTITIONING(table_list->partition_names,0), + table_list); if (unlikely(error)) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 598f46594e5..f85e598b776 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3123,7 +3123,7 @@ bool JOIN::make_aggr_tables_info() distinct in the engine, so we do this for all queries, not only GROUP BY queries. */ - if (tables_list && !procedure) + if (tables_list && !procedure && join_tab) { /* At the moment we only support push down for queries where diff --git a/sql/table.cc b/sql/table.cc index 699102885c2..ffc00158956 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3543,7 +3543,8 @@ static void print_long_unique_table(TABLE *table) enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, const LEX_CSTRING *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, - bool is_create_table, List<String> *partitions_to_open) + bool is_create_table, List<String> *partitions_to_open, + TABLE_LIST *table_list) { enum open_frm_error error; uint records, i, bitmap_size, bitmap_count; @@ -3565,6 +3566,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, outparam->s= share; outparam->db_stat= db_stat; outparam->write_row_record= NULL; + outparam->intention_pos_in_table_list= table_list; if (share->incompatible_version && !(ha_open_flags & (HA_OPEN_FOR_ALTER | HA_OPEN_FOR_REPAIR))) diff --git a/sql/table.h b/sql/table.h index 42c017d63af..da7e0b4a99e 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1167,6 +1167,9 @@ public: /* Table's triggers, 0 if there are no of them */ Table_triggers_list *triggers; TABLE_LIST *pos_in_table_list;/* Element referring to this table */ + /* This is same as pos_in_table_list, but it is set as soon as possible when + TABLE is allocated */ + TABLE_LIST *intention_pos_in_table_list; /* Position in thd->locked_table_list under LOCK TABLES */ TABLE_LIST *pos_in_locked_tables; /* Tables used in DEFAULT and CHECK CONSTRAINT (normally sequence tables) */ @@ -2144,6 +2147,9 @@ struct TABLE_LIST /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */ List<Index_hint> *index_hints; TABLE *table; /* opened table */ + /* This is same as table, but it is set as soon as possible when + TABLE is allocated */ + TABLE *intention_table; ulonglong table_id; /* table id (from binlog) for opened table */ /* select_result for derived table to pass it from table creation to table @@ -2982,7 +2988,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, const LEX_CSTRING *alias, uint db_stat, uint prgflag, uint ha_open_flags, TABLE *outparam, bool is_create_table, - List<String> *partitions_to_open= NULL); + List<String> *partitions_to_open= NULL, + TABLE_LIST *table_list= NULL); bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); bool fix_session_vcol_expr_for_read(THD *thd, Field *field, Virtual_column_info *vcol); |