diff options
author | Sergei Golubchik <serg@mariadb.org> | 2021-02-15 16:43:15 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-02-15 16:43:15 +0100 |
commit | 25d9d2e37f37fd3d6dfa0004a142f83c260e7ebf (patch) | |
tree | dedbab65f15c43cfb4abba87f9ff5da7df47a73c /sql/sql_show.cc | |
parent | 5e3d3220bbe344b0de60b26c24fd5cdc9fe1741a (diff) | |
parent | 26965387230a9b13fb716344477d108bb87dea98 (diff) | |
download | mariadb-git-25d9d2e37f37fd3d6dfa0004a142f83c260e7ebf.tar.gz |
Merge branch 'bb-10.4-release' into bb-10.5-release
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4c5e877cce8..6fe45fe2de3 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2051,7 +2051,6 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, !foreign_db_mode; bool check_options= !(sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) && !create_info_arg; - my_bitmap_map *old_map; handlerton *hton; int error= 0; DBUG_ENTER("show_create_table"); @@ -2132,7 +2131,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, We have to restore the read_set if we are called from insert in case of row based replication. */ - old_map= tmp_use_all_columns(table, table->read_set); + MY_BITMAP *old_map= tmp_use_all_columns(table, &table->read_set); bool not_the_first_field= false; for (ptr=table->field ; (field= *ptr); ptr++) @@ -2171,8 +2170,13 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, /* For string types dump collation name only if collation is not primary for the given charset + + For generated fields don't print the COLLATE clause if + the collation matches the expression's collation. */ - if (!(field->charset()->state & MY_CS_PRIMARY) && !field->vcol_info) + if (!(field->charset()->state & MY_CS_PRIMARY) && + (!field->vcol_info || + field->charset() != field->vcol_info->expr->collation.collation)) { packet->append(STRING_WITH_LEN(" COLLATE ")); packet->append(field->charset()->name); @@ -2439,7 +2443,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, } } #endif - tmp_restore_column_map(table->read_set, old_map); + tmp_restore_column_map(&table->read_set, old_map); DBUG_RETURN(error); } @@ -3173,11 +3177,8 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond) } DBUG_RETURN(bres); } - else - { - my_error(ER_NO_SUCH_THREAD, MYF(0), (ulong) thread_id); - DBUG_RETURN(1); - } + my_error(ER_NO_SUCH_THREAD, MYF(0), (ulong) thread_id); + DBUG_RETURN(1); } @@ -3771,6 +3772,16 @@ static bool show_status_array(THD *thd, const char *wild, if (show_type == SHOW_SYS) mysql_mutex_lock(&LOCK_global_system_variables); + else if (show_type >= SHOW_LONG_STATUS && scope == OPT_GLOBAL && + !status_var->local_memory_used) + { + mysql_mutex_lock(&LOCK_status); + *status_var= global_status_var; + mysql_mutex_unlock(&LOCK_status); + calc_sum_of_all_status(status_var); + DBUG_ASSERT(status_var->local_memory_used); + } + pos= get_one_variable(thd, var, scope, show_type, status_var, &charset, buff, &length); @@ -3828,7 +3839,6 @@ uint calc_sum_of_all_status(STATUS_VAR *to) calc_sum_callback_arg arg(to); DBUG_ENTER("calc_sum_of_all_status"); - *to= global_status_var; to->local_memory_used= 0; /* Add to this status from existing threads */ server_threads.iterate(calc_sum_callback, &arg); @@ -5237,6 +5247,12 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) continue; } + if (thd->killed == ABORT_QUERY) + { + error= 0; + goto err; + } + DEBUG_SYNC(thd, "before_open_in_get_all_tables"); if (fill_schema_table_by_open(thd, &tmp_mem_root, FALSE, table, schema_table, @@ -5824,7 +5840,7 @@ static bool print_anchor_data_type(const Spvar_definition *def, Let's print it according to the current sql_mode. It will make output in line with the value in mysql.proc.param_list, so both I_S.XXX.DTD_IDENTIFIER and mysql.proc.param_list use the same notation: - default or Oracle, according to the sql_mode at the SP creation time. + default or Oracle, according to the sql_mode at the SP creation time. The caller must make sure to set thd->variables.sql_mode to the routine sql_mode. */ static bool print_anchor_dtd_identifier(THD *thd, const Spvar_definition *def, @@ -7862,10 +7878,7 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond) if (partial_cond) partial_cond->val_int(); - if (scope == OPT_GLOBAL) - { - calc_sum_of_all_status(&tmp); - } + tmp.local_memory_used= 0; // meaning tmp was not populated yet mysql_rwlock_rdlock(&LOCK_all_status_vars); res= show_status_array(thd, wild, |