diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2003-08-06 18:59:26 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2003-08-06 18:59:26 +0300 |
commit | 6496a0dd14dd15be215cfca5172bad1935302c24 (patch) | |
tree | cfd699e5b375e48d92e731e8b4212c3f415699d2 /sql | |
parent | e4477bcacf78741f5c1116cbba2174396f413b5e (diff) | |
parent | b5e85696741e02ab33432bdec254edd802839fa1 (diff) | |
download | mariadb-git-6496a0dd14dd15be215cfca5172bad1935302c24.tar.gz |
merge
mysql-test/r/innodb.result:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_derived.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_union.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_myisam.cc | 12 | ||||
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_derived.cc | 10 | ||||
-rw-r--r-- | sql/sql_table.cc | 17 | ||||
-rw-r--r-- | sql/sql_union.cc | 18 | ||||
-rw-r--r-- | sql/table.h | 1 |
6 files changed, 46 insertions, 16 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 4f1021232a4..70322cef6fd 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -767,12 +767,20 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt) void ha_myisam::deactivate_non_unique_index(ha_rows rows) { MYISAM_SHARE* share = file->s; + bool do_warning=0; if (share->state.key_map == ((ulonglong) 1L << share->base.keys)-1) { if (!(specialflag & SPECIAL_SAFE_MODE)) { if (rows == HA_POS_ERROR) + { + uint orig_update= file->update; + file->update ^= HA_STATE_CHANGED; + uint check_update= file->update; mi_extra(file, HA_EXTRA_NO_KEYS, 0); + do_warning= (file->update == check_update) && file->state->records; + file->update= orig_update; + } else { /* @@ -797,6 +805,10 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) } else enable_activate_all_index=0; + if (do_warning) + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA, + ER(ER_ILLEGAL_HA), table->table_name); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index dd69fbbd2f2..a5807914abd 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -787,6 +787,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, DBUG_RETURN(0); } table->query_id=thd->query_id; + table->clear_query_id=1; thd->tmp_table_used= 1; goto reset; } @@ -2048,8 +2049,9 @@ bool setup_tables(TABLE_LIST *tables) table->keys_in_use_for_query &= ~map; } table->used_keys &= table->keys_in_use_for_query; - if (table_list->shared) + if (table_list->shared || table->clear_query_id) { + table->clear_query_id= 0; /* Clear query_id that may have been set by previous select */ for (Field **ptr=table->field ; *ptr ; ptr++) (*ptr)->query_id=0; diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 9ed26bc4062..81439a19918 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -122,6 +122,16 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, res= -1; goto exit; } + + /* + This is done in order to redo all field optimisations when any of the + involved tables is used in the outer query + */ + if (tables) + { + for (TABLE_LIST *cursor= tables; cursor; cursor= cursor->next) + cursor->table->clear_query_id= 1; + } item_list= select_cursor->item_list; select_cursor->with_wild= 0; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2e6585583ba..e16d7a0067d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1858,10 +1858,19 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, /* COND_refresh will be signaled in close_thread_tables() */ break; case DISABLE: - VOID(pthread_mutex_lock(&LOCK_open)); - wait_while_table_is_used(thd, table); - VOID(pthread_mutex_unlock(&LOCK_open)); - table->file->deactivate_non_unique_index(HA_POS_ERROR); + if (table->db_type == DB_TYPE_MYISAM) + { + VOID(pthread_mutex_lock(&LOCK_open)); + wait_while_table_is_used(thd, table); + VOID(pthread_mutex_unlock(&LOCK_open)); + table->file->deactivate_non_unique_index(HA_POS_ERROR); + } + else + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA, + ER(ER_ILLEGAL_HA), table->table_name); + break; + /* COND_refresh will be signaled in close_thread_tables() */ break; } diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 5f3fbadc99a..57044a8370a 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -136,7 +136,7 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, found_rows_for_union= first_select()->options & OPTION_FOUND_ROWS && global_parameters->select_limit; if (found_rows_for_union) - first_select()->options ^= OPTION_FOUND_ROWS; + first_select()->options&= ~OPTION_FOUND_ROWS; } if (t_and_f) { @@ -154,8 +154,6 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, goto err; List_iterator<Item> it(select_cursor->item_list); Item *item; - while((item=it++)) - item->maybe_null=1; item_list= select_cursor->item_list; select_cursor->with_wild= 0; if (setup_ref_array(thd, &select_cursor->ref_pointer_array, @@ -167,6 +165,12 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result, item_list, 0, 0, 1)) goto err; t_and_f= 1; + while((item=it++)) + { + item->maybe_null=1; + if (item->type() == Item::FIELD_ITEM) + ((class Item_field *)item)->field->table->maybe_null=1; + } } tmp_table_param.field_count=item_list.elements; @@ -250,7 +254,6 @@ err: int st_select_lex_unit::exec() { - int do_print_slow= 0; SELECT_LEX_NODE *lex_select_save= thd->lex.current_select; SELECT_LEX *select_cursor=first_select_in_union(); DBUG_ENTER("st_select_lex_unit::exec"); @@ -318,7 +321,6 @@ int st_select_lex_unit::exec() thd->lex.current_select= lex_select_save; DBUG_RETURN(res); } - do_print_slow|= select_cursor->options; } } optimized= 1; @@ -361,12 +363,6 @@ int st_select_lex_unit::exec() Mark for slow query log if any of the union parts didn't use indexes efficiently */ - select_cursor->options= ((select_cursor->options & - ~(QUERY_NO_INDEX_USED | - QUERY_NO_GOOD_INDEX_USED)) | - do_print_slow & - (QUERY_NO_INDEX_USED | - QUERY_NO_GOOD_INDEX_USED)); } } thd->lex.current_select= lex_select_save; diff --git a/sql/table.h b/sql/table.h index 1831c834de6..2fab0087da4 100644 --- a/sql/table.h +++ b/sql/table.h @@ -116,6 +116,7 @@ struct st_table { my_bool crashed; my_bool is_view; my_bool no_keyread; + my_bool clear_query_id; /* To reset query_id for tables and cols */ my_bool auto_increment_field_not_null; Field *next_number_field, /* Set if next_number is activated */ *found_next_number_field, /* Set on open */ |