diff --git a/mysql-test/main/statistics_json.result b/mysql-test/main/statistics_json.result index 07e6e09710c..b4da524637b 100644 --- a/mysql-test/main/statistics_json.result +++ b/mysql-test/main/statistics_json.result @@ -101,7 +101,7 @@ ERROR HY000: Failed to parse histogram, encountered JSON_TYPE '1'. UPDATE mysql.column_stats SET histogram='{}' WHERE table_name='t1'; FLUSH TABLES; SELECT * FROM t1; -ERROR HY000: Failed to parse histogram, encountered JSON_TYPE '32641'. +ERROR HY000: Failed to parse histogram, encountered JSON_TYPE '1'. DELETE FROM mysql.column_stats; DROP TABLE t1; create schema world; diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index baaabf73477..f0e8098aa85 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -1993,11 +1993,10 @@ bool json_get_array_items(const char *json, const char *json_end, int *value_typ json_scan_start(&je, &my_charset_utf8mb4_bin, (const uchar *)json, (const uchar *)json_end); - if (json_read_value(&je) || je.value_type != JSON_VALUE_ARRAY) + if (json_read_value(&je) || (*value_type = je.value_type) != JSON_VALUE_ARRAY) { return false; } - *value_type = je.value_type; std::string val; while(!json_scan_next(&je))