1 # Need more as 16k open files per process (ulimit -n) on Unix systems. 
    2 --source include/have_partition_open_file_limit.inc
 
    3 # Create a list partitioned table with 8192 partitions. 
    4 # The CREATE will be written into a temporary file ($MYSQL_TMP_DIR/part_list_elem.inc). 
    5 # After inserting the content of the file it will be removed. 
    9    my $fname= 
"$ENV{'MYSQL_TMP_DIR'}/part_list_elem.inc";
 
   11    push (@wrlines, 
"eval create table t2 (a int) engine=\$engine\n");
 
   12    push (@wrlines, 
"     partition by list (a)\n");
 
   13    push (@wrlines, 
"     subpartition by hash (a)");
 
   14    push (@wrlines, 
"     subpartitions 2 (\n");
 
   15    for(my $i=0; $i<4096; $i++)
 
   20           my $pattern= 
"        PARTITION p$i VALUES IN (".$j++.
",".$j++.
",".$j++.
",".$j++.
"),\n";
 
   21           push(@wrlines,$pattern);
 
   25           my $last_pattern= 
"        PARTITION p$i VALUES IN (".$j++.
",".$j++.
",".$j++.
",".$j++.
")\n";
 
   26           push(@wrlines,$last_pattern);
 
   30    push (@wrlines, 
"     );\n");
 
   31    open(FILE, 
">", $fname) or die;
 
   36 source $MYSQL_TMP_DIR/part_list_elem.inc;
 
   37 #remove_file $MYSQL_TMP_DIR/part_list_elem.inc; 
   40 --echo $count inserts;
 
   44 eval insert into t2 values ($count);
 
   48 select count(*) from t2;
 
   49 select count(*) from t2 partition (p0);
 
   50 select count(*) from t2 partition (p10);
 
   51 select count(*) from t2 partition (p100);
 
   52 select count(*) from t2 partition (p1000);
 
   53 select count(*) from t2 partition (p4000);
 
   54 select count(*) from t2 partition (p4095);
 
   56 select * from t2 partition (p0);
 
   57 select * from t2 partition (p10);
 
   58 select * from t2 partition (p100);
 
   59 select * from t2 partition (p1000);
 
   60 select * from t2 partition (p4000);
 
   61 select * from t2 partition (p4095);
 
   63 delete from t2 partition (p4095);
 
   64 select * from t2 partition (p4095);
 
   65 insert into t2 partition (p4095) values (16382),(16383);
 
   66 select * from t2 partition (p4095);
 
   67 update t2 partition (p4095) set a=16381 where a= 16382;
 
   68 select * from t2 partition (p4095);
 
   70 write_file $MYSQL_TMP_DIR/data01;
 
   74 replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
 
   75 eval load data infile '$MYSQL_TMP_DIR/data01' into 
table t2 partition (p4095) fields terminated by ',';
 
   76 remove_file $MYSQL_TMP_DIR/data01;
 
   77 select * from t2 partition (p4095);
 
   79 error ER_TOO_MANY_PARTITIONS_ERROR;
 
   80 alter 
table t2 add partition (partition p4096 values in (16384,16385,16386,16387));