summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-09-04 23:17:39 +0300
committerSergei Golubchik <serg@mariadb.org>2021-09-12 15:30:42 +0200
commitd7cab0532537187268f0a51e3a4eba15218ec9f5 (patch)
tree6a9ced2e763e0f6d3f4b677a40021362c3a85a11
parent18ec7276e67b99de87a174f8d6ed3866ade17ca6 (diff)
downloadmariadb-git-preview-10.7-MDEV-21130-json-histograms.tar.gz
- Fix bad tests in statistics_json test: make them meaningful and make them work on windows - Fix analyze_debug.test: correctly handle errors during ANALYZE
-rw-r--r--mysql-test/main/statistics_json.result18
-rw-r--r--mysql-test/main/statistics_json.test6
-rw-r--r--sql/sql_admin.cc3
3 files changed, 8 insertions, 19 deletions
diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result
index 857b062ae47..aa7b7c08a31 100644
--- a/mysql-test/main/statistics_json.result
+++ b/mysql-test/main/statistics_json.result
@@ -3174,22 +3174,12 @@ Percentage 0.0 99.9 50 JSON_HB {
"99.9"
]
}
-explain extended select * from Country where 'Code' between 'BBC' and 'GGG';
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 100.00
-Warnings:
-Note 1003 select `world`.`Country`.`Code` AS `Code`,`world`.`Country`.`Name` AS `Name`,`world`.`Country`.`SurfaceArea` AS `SurfaceArea`,`world`.`Country`.`Population` AS `Population`,`world`.`Country`.`Capital` AS `Capital` from `world`.`Country` where 1
-analyze select * from Country where 'Code' between 'BBC' and 'GGG';
+analyze select * from Country use index () where Code between 'BBC' and 'GGG';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
-1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 100.00 100.00
-explain extended select * from Country where 'Code' < 'BBC';
-id select_type table type possible_keys key key_len ref rows filtered Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
-Warnings:
-Note 1003 select `world`.`Country`.`Code` AS `Code`,`world`.`Country`.`Name` AS `Name`,`world`.`Country`.`SurfaceArea` AS `SurfaceArea`,`world`.`Country`.`Population` AS `Population`,`world`.`Country`.`Capital` AS `Capital` from `world`.`Country` where 0
-analyze select * from Country where 'Code' < 'BBC';
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 25.49 25.52 Using where
+analyze select * from Country use index () where Code < 'BBC';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+1 SIMPLE Country ALL NULL NULL NULL NULL 239 239.00 5.88 7.11 Using where
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
DROP SCHEMA world;
diff --git a/mysql-test/main/statistics_json.test b/mysql-test/main/statistics_json.test
index 99705aa38ae..be223f5e4a4 100644
--- a/mysql-test/main/statistics_json.test
+++ b/mysql-test/main/statistics_json.test
@@ -85,10 +85,8 @@ ANALYZE TABLE Country, City, CountryLanguage persistent for all;
--enable_result_log
SELECT column_name, min_value, max_value, hist_size, hist_type, histogram FROM mysql.column_stats;
-explain extended select * from Country where 'Code' between 'BBC' and 'GGG';
-analyze select * from Country where 'Code' between 'BBC' and 'GGG';
-explain extended select * from Country where 'Code' < 'BBC';
-analyze select * from Country where 'Code' < 'BBC';
+analyze select * from Country use index () where Code between 'BBC' and 'GGG';
+analyze select * from Country use index () where Code < 'BBC';
set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 55cfc5d3b85..c5c9f502fc5 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1045,7 +1045,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
else
compl_result_code= HA_ADMIN_FAILED;
- free_statistics_for_table(thd, table->table);
+ if (table->table)
+ free_statistics_for_table(thd, table->table);
if (compl_result_code)
result_code= HA_ADMIN_FAILED;
else