1# Test cases that cover the crashes within:
2# MDEV-7362 ANALYZE TABLES crash with table-independent-statistics gathering
3# MDEV-7380 engine-independent stats SEGV on ANALYZE TABLE (#2)
4
5--source include/have_stat_tables.inc
6--source include/have_innodb.inc
7
8CREATE TABLE t1 (a longtext, FULLTEXT KEY (`a`)) ENGINE=InnoDB;
9INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977414141674541726D'));
10ANALYZE TABLE t1 PERSISTENT FOR ALL;
11--sorted_result
12SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1';
13DROP TABLE t1;
14
15CREATE TABLE t1 (a longtext, FULLTEXT KEY (`a`)) ENGINE=MyISAM;
16INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977414141674541726D'));
17ANALYZE TABLE t1 PERSISTENT FOR ALL;
18--sorted_result
19SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1';
20DROP TABLE t1;
21
22CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM;
23INSERT INTO geom VALUES
24    (MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
25    (MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
26    (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
27ANALYZE TABLE geom PERSISTENT FOR ALL;
28--sorted_result
29SELECT * FROM mysql.index_stats WHERE index_name='g' AND table_name='geom';
30DROP TABLE geom;
31