mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-16711 Crash in Field_blob::store() while reading statistics
for the small InnoDB table
This bug was introduced by the patch 6c414fcf89
.
The patch has not taken into account that some objects of the Field_* types
are created only for TABLE_SHARE and the field 'table' is set to NULL
for them. In particular such are objects created to store statistical
min/max values for columns.
This commit is contained in:
@ -566,6 +566,10 @@ SELECT * FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||
test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL
|
||||
SELECT pk FROM t1;
|
||||
pk
|
||||
1
|
||||
2
|
||||
DROP TABLE t1;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
#
|
||||
@ -593,5 +597,21 @@ SELECT * FROM mysql.column_stats;
|
||||
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||
DROP TABLE t1;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
#
|
||||
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
|
||||
#
|
||||
SET use_stat_tables= PREFERABLY;
|
||||
CREATE TABLE t1 (pk INT PRIMARY KEY, t CHAR(60));
|
||||
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, t TEXT);
|
||||
SELECT MAX(pk) FROM t1;
|
||||
MAX(pk)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
set use_stat_tables=@save_use_stat_tables;
|
||||
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
|
||||
SET SESSION STORAGE_ENGINE=DEFAULT;
|
||||
|
Reference in New Issue
Block a user