summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-04-11 13:05:01 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-04-11 13:05:01 +0530
commit409dddf6958736d65ee77aa9b469f8b807da3bb1 (patch)
tree8f411703fcbf16b410d6c2922e3e1fa674897709 /sql
parent812ac2bb857877efc6973e275353ecdfcd8aeb35 (diff)
downloadmariadb-git-409dddf6958736d65ee77aa9b469f8b807da3bb1.tar.gz
MDEV-18300: ASAN error in Field_blob::get_key_image upon UPDATE with subquery
For single table updates and multi-table updates , engine independent statistics were not being read even if the statistics were collected. Fixed it, so when the optimizer_use_condition_selectivity > 2 then we would read the available statistics for update queries.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_statistics.cc1
-rw-r--r--sql/sql_update.cc3
2 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index f4dcafdb7c3..d3a2094e272 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -4071,6 +4071,7 @@ bool is_eits_usable(Field *field)
partition list of a table. We assume the selecticivity for
such columns would be handled during partition pruning.
*/
+ DBUG_ASSERT(field->table->stats_is_read);
Column_statistics* col_stats= field->read_stats;
return col_stats && !col_stats->no_stat_values_provided() && //(1)
field->type() != MYSQL_TYPE_GEOMETRY && //(2)
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 960b5cbccc5..78aa059f64f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -301,6 +301,8 @@ int mysql_update(THD *thd,
if (lock_tables(thd, table_list, table_count, 0))
DBUG_RETURN(1);
+ (void) read_statistics_for_tables_if_needed(thd, table_list);
+
if (table_list->handle_derived(thd->lex, DT_MERGE_FOR_INSERT))
DBUG_RETURN(1);
if (table_list->handle_derived(thd->lex, DT_PREPARE))
@@ -1540,6 +1542,7 @@ int mysql_multi_update_prepare(THD *thd)
{
DBUG_RETURN(TRUE);
}
+ (void) read_statistics_for_tables_if_needed(thd, table_list);
/* @todo: downgrade the metadata locks here. */
/*