summaryrefslogtreecommitdiff
path: root/sql/sql_statistics.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2018-08-24 01:59:02 +0530
committerMarko Mäkelä <marko.makela@mariadb.com>2018-08-27 12:21:26 +0300
commit69d7bfd97092f050bd4c60ce79f60d48a249089b (patch)
tree9436917e13dde703be88d41553153e4fe325e483 /sql/sql_statistics.cc
parent7d8d37c31d9cabaf31576eb3edeae6580ffb16b4 (diff)
downloadmariadb-git-69d7bfd97092f050bd4c60ce79f60d48a249089b.tar.gz
MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4
No need to read statistics for tables that are not USER tables. We allocate memory for structures to collect statistics only for USER TABLES.
Diffstat (limited to 'sql/sql_statistics.cc')
-rw-r--r--sql/sql_statistics.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 537ede91710..cb75a5c2176 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3129,6 +3129,9 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
if (!tl->is_view_or_derived() && !is_temporary_table(tl) && tl->table)
{
TABLE_SHARE *table_share= tl->table->s;
+ if (table_share && !(table_share->table_category == TABLE_CATEGORY_USER))
+ continue;
+
if (table_share &&
table_share->stats_cb.stats_can_be_read &&
!table_share->stats_cb.stats_is_read)