1--source include/have_partition.inc
2
3--disable_warnings
4DROP TABLE IF EXISTS `t1`;
5--enable_warnings
6
7call mtr.add_suppression("option 'table_open_cache'");
8call mtr.add_suppression("option 'max_connections'");
9
10
11# On some platforms the lowest possible open_files_limit is too high...
12let $max_open_files_limit= `SELECT @@open_files_limit > 511`;
13if ($max_open_files_limit)
14{
15  skip Need open_files_limit to be lower than 512;
16}
17
18#
19--echo # Bug#46922: crash when adding partitions and open_files_limit is reached
20#
21CREATE TABLE t1 (a INT PRIMARY KEY)
22ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
23INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
24--echo # if the bug exists, then crash will happen here
25--replace_regex /file '.*'/file '<partition file>'/
26--error 23
27ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
28--sorted_result
29SELECT * FROM t1;
30DROP TABLE t1;
31