List:Commits« Previous MessageNext Message »
From:hhunger@mysql.com Date:April 5 2007 3:54pm
Subject:bk commit into 5.1 tree (hhunger:1.2557)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hhunger. When hhunger does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-04-05 17:54:37+02:00, hhunger@stripped +18 -0
  changed supported sql function to inpuzt files.

  BitKeeper/etc/ignore@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +5 -0
    Added mysql-test/suite/partitions/t/partition.test mysql-test/suite/partitions/r/dif mysql-test/suite/partitions/r/partition.result mysql-test/suite/partitions/r/partition_t55.out mysql-test/suite/partitions/r/partition_t55.refout to the ignore list

  mysql-test/suite/funcs_1/r/a_version_check.result@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +1 -1
    new version

  mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +59 -40
    read data from file.

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +34 -21
    read data from file.

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +4 -0
    inpu file.

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +4 -0
    input file

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +4 -0
    input file

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +45 -0
    input file

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +4 -0
    input file

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +38 -1
    read data from file.

  mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +10038 -889
    read data from file.

  mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +10038 -889
    read data from file.

  mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +13724 -0
    new result file.

  mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/r/partition_t55.out@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +68 -0
    reference fiel for output data to compare

  mysql-test/suite/partitions/r/partition_t55.out@stripped, 2007-04-05 17:52:54+02:00, hhunger@stripped +0 -0

  mysql-test/suite/partitions/t/disabled.def@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +1 -1
    added not executable test program.

  mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +3 -7
    switched to long test.

  mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +3 -3
    switched to long test

  mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +40 -0
    ndb wrapper.

  mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test@stripped, 2007-04-05 17:52:53+02:00, hhunger@stripped +0 -0

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	hhunger
# Host:	hh-nb.hungers
# Root:	/data0/mysql/mysql-5.1-build

--- 1.2/mysql-test/suite/funcs_1/r/a_version_check.result	2007-04-05 17:54:46 +02:00
+++ 1.3/mysql-test/suite/funcs_1/r/a_version_check.result	2007-04-05 17:54:46 +02:00
@@ -6,6 +6,6 @@
 . updated with each new version --- THIS IS INTENDED!
 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
-funcs_1 checked with version: 5.1.16
+funcs_1 checked with version: 5.1.17
 Warnings:
 Warning	1548	Leading spaces are removed from name ' '

--- 1.1/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc	2007-04-05 17:54:46 +02:00
+++ 1.2/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc	2007-04-05 17:54:46 +02:00
@@ -1,7 +1,7 @@
 ################################################################################
-# t/partition_supported_sql_funcs.inc   #                                                                              #
+# t/partition_supported_sql_funcs.inc                                          #           #                                                                              #
 # Purpose:                                                                     #
-#  Tests around sql functions                                                  #
+#  Tests frame for allowed sql functions                                       #
 #                                                                              #
 #                                                                              #
 #------------------------------------------------------------------------------#
@@ -83,24 +83,23 @@
 eval insert into t3 values ($val2);
 eval insert into t3 values ($val3);
 
-eval insert into t4 values (1,$val1);
-eval insert into t4 values (2,$val2);
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t4;
 
-eval insert into t5 values (1,$val1);
-eval insert into t5 values (2,$val2);
-eval insert into t5 values (3,$val3);
-
-eval insert into t6 values (1,$val2);
-eval insert into t6 values (2,$val3);
-
-eval select $sqlfunc from t1;
-
-select * from t1;
-select * from t2;
-select * from t3;
-select * from t4;
-select * from t5;
-select * from t6;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t5;
+
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t6;
+
+eval select $sqlfunc from t1 order by col1;
+
+select * from t1 order by col1;
+select * from t2 order by col1;
+select * from t3 order by col1;
+select * from t4 order by colint;
+select * from t5 order by colint;
+select * from t6 order by colint;
 
 if ($do_long_tests)
 {
@@ -111,12 +110,12 @@
 	eval update t5 set col1=$val4 where col1=$val1;
 	eval update t6 set col1=$val4 where col1=$val1;
 
-	select * from t1;
-	select * from t2;
-	select * from t3;
-	select * from t4;
-	select * from t5;
-	select * from t6;
+	select * from t1 order by col1;
+	select * from t2 order by col1;
+	select * from t3 order by col1;
+	select * from t4 order by colint;
+	select * from t5 order by colint;
+	select * from t6 order by colint;
 }
 
 --echo -------------------------------------------------------------------------
@@ -175,46 +174,63 @@
 (partition p0 values less than ($valsqlfunc),
  partition p1 values less than maxvalue);
 
-select * from t11;
-select * from t22;
-select * from t33;
-select * from t44;
-select * from t55;
-select * from t66;
+select * from t11 order by col1;
+select * from t22 order by col1;
+select * from t33 order by col1;
+select * from t44 order by colint;
+select * from t55 order by colint;
+select * from t66 order by colint;
  
 if ($do_long_tests)
 {
+        --echo ---------------------------
+        --echo ---- some alter table begin
+        --echo ---------------------------
 	eval alter table t11
 	reorganize partition p0,p1 into
 	(partition s1 values less than maxvalue);
-	select * from t11;
+	select * from t11 order by col1;
 
 	eval alter table t11
 	reorganize partition s1 into
 	(partition p0 values less than (15),
 	 partition p1 values less than maxvalue);
-	select * from t11;
+	select * from t11 order by col1;
+
+eval alter table t55
+partition by list(colint)
+subpartition by hash($sqlfunc) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+ partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+ partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+ partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+ partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+ partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+        show create table t55; 
+	select * from t55 order by colint;
 
 	eval alter table t66
 	reorganize partition p0,p1 into
 	(partition s1 values less than maxvalue);
-	select * from t66;
+	select * from t66 order by colint;
 
 	eval alter table t66
 	reorganize partition s1 into
 	(partition p0 values less than ($valsqlfunc),
 	 partition p1 values less than maxvalue);
-	select * from t66;
+	select * from t66 order by colint;
 	
 	eval alter table t66
         reorganize partition p0,p1 into
         (partition s1 values less than maxvalue);
-        select * from t66;
+        select * from t66 order by colint;
 
-        eval alter table t66
-        add partition s0 
-        (partition p0 values less than ($valsqlfunc);
-        select * fromt t66;
+	eval alter table t66
+        reorganize partition s1 into
+	(partition p0 values less than ($valsqlfunc),
+	 partition p1 values less than maxvalue);
+        select * from t66 order by colint;
 
 	let $t1=t1;
 	let $t2=t2;
@@ -233,6 +249,9 @@
 	let $t6=t66;
 	--source suite/partitions/include/partition_supported_sql_funcs_delete.inc
 	# --source include/partition_supported_sql_funcs_delete.inc
+        --echo -------------------------
+        --echo ---- some alter table end
+        --echo -------------------------
 }
 --disable_warnings
 drop table if exists t1 ;

--- 1.1/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc	2007-04-05 17:54:46 +02:00
+++ 1.2/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc	2007-04-05 17:54:46 +02:00
@@ -1,3 +1,16 @@
+################################################################################
+# t/partition_supported_sql_funcs_delete.inc                                   #           #                                                                              #
+# Purpose:                                                                     #
+#  Delete access of the tests frame for allowed sql functions                  #
+#                                                                              #
+#                                                                              #
+#------------------------------------------------------------------------------#
+# Original Author: HH                                                          #
+# Original Date: 2006-11-22                                                    #
+# Change Author:                                                               #
+# Change Date:                                                                 #
+# Change:                                                                      #
+################################################################################
 --echo -------------------------------------------------------------------------
 --echo ---  Delete rows and partitions of tables with $sqlfunc
 --echo -------------------------------------------------------------------------
@@ -9,25 +22,25 @@
 eval delete from $t5 where col1=$val2;
 eval delete from $t6 where col1=$val2;
 
-eval select * from $t1;
-eval select * from $t2;
-eval select * from $t3;
-eval select * from $t4;
-eval select * from $t5;
+eval select * from $t1 order by col1;
+eval select * from $t2 order by col1;
+eval select * from $t3 order by col1;
+eval select * from $t4 order by colint;
+eval select * from $t5 order by colint;
 
 eval insert into $t1 values ($val2);
 eval insert into $t2 values ($val2);
 eval insert into $t3 values ($val2);
-eval insert into $t4 values (4,$val2);
-eval insert into $t5 values (4,$val2);
-eval insert into $t6 values (4,$val2);
-
-eval select * from $t1;
-eval select * from $t2;
-eval select * from $t3;
-eval select * from $t4;
-eval select * from $t5;
-eval select * from $t6;
+eval insert into $t4 values (60,$val2);
+eval insert into $t5 values (60,$val2);
+eval insert into $t6 values (60,$val2);
+
+eval select * from $t1 order by col1;
+eval select * from $t2 order by col1;
+eval select * from $t3 order by col1;
+eval select * from $t4 order by colint;
+eval select * from $t5 order by colint;
+eval select * from $t6 order by colint;
 
 eval alter table $t1 drop partition p0; 
 eval alter table $t2 drop partition p0; 
@@ -35,9 +48,9 @@
 eval alter table $t5 drop partition p0; 
 eval alter table $t6 drop partition p0;  
 
-eval select * from $t1;
-eval select * from $t2;
-eval select * from $t3;
-eval select * from $t4;
-eval select * from $t5;
-eval select * from $t6;
+eval select * from $t1 order by col1;
+eval select * from $t2 order by col1;
+eval select * from $t3 order by col1;
+eval select * from $t4 order by colint;
+eval select * from $t5 order by colint;
+eval select * from $t6 order by colint;
--- New file ---
+++ mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in	07/04/05 17:52:54
1	1	
2	9	
3	3	
4	8	
--- New file ---
+++ mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in	07/04/05 17:52:54
1	2006-02-03	
2	2006-01-17	
3	2006-01-25	
4	2006-02-05	
--- New file ---
+++ mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in	07/04/05 17:52:54
1	5.1230	
2	13.345	
3	17.987	
4	15.654	

--- New file ---
+++ mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in	07/04/05 17:52:54
1	5	
2	13	
3	15	
4	17	
5	23	
6	34	
7	56	
8	56	
9	45	
10	34	
11	78	
12	89	
13	67	
14	46	
15	34	
16	324	
17	345	
18	34	
19	78	
20	567	
21	4	
22	435	
23	34	
24	45	
25	4565	
26	4	
27	3	
28	2	
29	3	
30	5	
31	6	
32	8	
33	9	
34	745	
35	34	
36	34	
37	324	
38	67	
39	78	
40	89	
41	90	
42	78967	
50	56	
51	34	
55	123	
--- New file ---
+++ mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in	07/04/05 17:52:54
1	09:09:15.000002	
2	04:30:01.000018	
3	00:59:22.000024	
4	05:30:34.000037	


--- 1.1/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc	2007-04-05 17:54:46 +02:00
+++ 1.2/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc	2007-04-05 17:54:46 +02:00
@@ -2,7 +2,7 @@
 # t/partition_supported_sql_funcs_main.inc                                     #
 #                                                                              #
 # Purpose:                                                                     #
-#  Tests around sql functions                                                  #
+#  Tests which SQL functions are allowed in partinioning clauses.              #
 #                                                                              #
 #                                                                              #
 #------------------------------------------------------------------------------#
@@ -11,12 +11,28 @@
 # Change Author:                                                               #
 # Change Date:                                                                 #
 # Change:                                                                      #
+#                                                                              #
+# This test uses a test frame (partition_supported_sql_funcs.inc) for every    #
+# SQL function allowed in the partitioning parts of CREATE and ALTE TABLE.     #
+# The variales represent the                                                   #
+# - SQL function isself with a column (sqlfunc) and a literal (valsqlsunc),    #
+# - the type of the column (coltype),                                          #
+# - a file with test values of the coltype (infile) and                        # 
+# - single test values (val1 to val4).                                         #
+# The test frame includes CREATE/ALTER TABLE and some access statements.       #
+# Column types are int, float(7,4), char(1), date and time depending on the    #
+# SQL function. The test frame uses the include file                           # 
+# "partition_supported_sql_funcs_delete.inc" testing the deletion of           #
+# partitions.                                                                  #
+# The CREATE and ALTER TABLE statement do not cover the complete partitions    #
+# functions, but will ashure that the SQL functions are basically working.     #
 ################################################################################
 
 
 let $sqlfunc = abs(col1);
 let $valsqlfunc = abs(15);
 let $coltype = int;
+let $infile = partition_supported_sql_funcs_int_int.in;
 let $val1 =  5 ;
 let $val2 = 13 ;
 let $val3 = 17 ;
@@ -27,6 +43,7 @@
 let $sqlfunc = ascii(col1);
 let $valsqlfunc = ascii('5');
 let $coltype = char(1);
+let $infile = partition_supported_sql_funcs_int_ch1.in;
 let $val1 =  '1';
 let $val2 =  '9';
 let $val3 =  '3';
@@ -37,6 +54,7 @@
 let $sqlfunc = cast(ceiling(col1) as signed integer);
 let $valsqlfunc = cast(ceiling(15) as signed integer);
 let $coltype = float(7,4);
+let $infile = partition_supported_sql_funcs_int_float.in;
 let $val1 =  5.1230;
 let $val2 = 13.345;
 let $val3 = 17.987;
@@ -47,6 +65,7 @@
 let $sqlfunc = cast(floor(col1) as signed);
 let $valsqlfunc = cast(floor(15.123) as signed);
 let $coltype = float(7,4);
+let $infile = partition_supported_sql_funcs_int_float.in;
 let $val1 =  5.1230;
 let $val2 = 13.345;
 let $val3 = 17.987;
@@ -57,6 +76,7 @@
 let $sqlfunc = cast(mod(col1,10) as signed);
 let $valsqlfunc = cast(mod(15,10) as signed);
 let $coltype = float(7,4);
+let $infile = partition_supported_sql_funcs_int_float.in;
 let $val1 =  5.0000;
 let $val2 = 19;
 let $val3 = 17;
@@ -67,6 +87,7 @@
 let $sqlfunc = ord(col1);
 let $valsqlfunc = ord('a');
 let $coltype = char(3);
+let $infile = partition_supported_sql_funcs_int_ch1.in;
 let $val1 =  '1';
 let $val2 =  '9';
 let $val3 =  '3';
@@ -77,6 +98,7 @@
 let $sqlfunc = day(col1);
 let $valsqlfunc = day('2006-12-21');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-02-03';
 let $val2 =  '2006-01-17';
 let $val3 =  '2006-01-25';
@@ -87,6 +109,7 @@
 let $sqlfunc = dayofmonth(col1);
 let $valsqlfunc = dayofmonth('2006-12-24');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-02-03';
 let $val2 =  '2006-01-17';
 let $val3 =  '2006-01-25';
@@ -97,6 +120,7 @@
 let $sqlfunc = dayofweek(col1);
 let $valsqlfunc = dayofweek('2006-12-24');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-02-17';
 let $val3 =  '2006-01-25';
@@ -107,6 +131,7 @@
 let $sqlfunc = dayofyear(col1);
 let $valsqlfunc = dayofyear('2006-12-25');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-01-17';
 let $val3 =  '2006-02-25';
@@ -120,6 +145,7 @@
 let $sqlfunc = extract(month from col1);
 let $valsqlfunc = extract(year from '1998-11-23');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-02-17';
 let $val3 =  '2006-01-25';
@@ -130,6 +156,7 @@
 let $sqlfunc = hour(col1);
 let $valsqlfunc = hour('18:30');
 let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
 let $val1 =  '09:09';
 let $val2 =  '14:30';
 let $val3 =  '21:59';
@@ -140,6 +167,7 @@
 let $sqlfunc = microsecond(col1);
 let $valsqlfunc = microsecond('10:30:10.000010');
 let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
 let $val1 =  '09:09:15.000002';
 let $val2 =  '04:30:01.000018';
 let $val3 =  '00:59:22.000024';
@@ -160,6 +188,7 @@
 let $sqlfunc = second(col1);
 let $valsqlfunc = second('18:30:14');
 let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
 let $val1 =  '09:09:09';
 let $val2 =  '14:30:20';
 let $val3 =  '21:59:22';
@@ -173,6 +202,7 @@
 let $sqlfunc = month(col1);
 let $valsqlfunc = month('2006-10-14');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-12-17';
 let $val3 =  '2006-05-25';
@@ -183,6 +213,7 @@
 let $sqlfunc = quarter(col1);
 let $valsqlfunc = quarter('2006-10-14');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-12-17';
 let $val3 =  '2006-09-25';
@@ -193,6 +224,7 @@
 let $sqlfunc = time_to_sec(col1)-(time_to_sec(col1)-20);
 let $valsqlfunc = time_to_sec('18:30:14')-(time_to_sec('17:59:59'));
 let $coltype = time;
+let $infile = partition_supported_sql_funcs_int_time.in;
 let $val1 =  '09:09:15';
 let $val2 =  '14:30:45';
 let $val3 =  '21:59:22';
@@ -203,6 +235,7 @@
 let $sqlfunc = to_days(col1)-to_days('2006-01-01');
 let $valsqlfunc = to_days('2006-02-02')-to_days('2006-01-01');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-02-03';
 let $val2 =  '2006-01-17';
 let $val3 =  '2006-01-25';
@@ -213,6 +246,7 @@
 let $sqlfunc = weekday(col1);
 let $valsqlfunc = weekday('2006-10-14');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-12-03';
 let $val2 =  '2006-11-17';
 let $val3 =  '2006-05-25';
@@ -223,6 +257,7 @@
 let $sqlfunc = weekofyear(col1);
 let $valsqlfunc = weekofyear('2006-02-14');
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-03-17';
 let $val3 =  '2006-05-25';
@@ -233,6 +268,7 @@
 let $sqlfunc = year(col1)-1990;
 let $valsqlfunc = year('2005-10-14')-1990;
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '1996-01-03';
 let $val2 =  '2000-02-17';
 let $val3 =  '2004-05-25';
@@ -243,6 +279,7 @@
 let $sqlfunc = yearweek(col1)-200600;
 let $valsqlfunc = yearweek('2006-10-14')-200600;
 let $coltype = date;
+let $infile = partition_supported_sql_funcs_int_date.in;
 let $val1 =  '2006-01-03';
 let $val2 =  '2006-08-17';
 let $val3 =  '2006-03-25';

--- 1.1/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result	2007-04-05 17:54:46 +02:00
+++ 1.2/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result	2007-04-05 17:54:46 +02:00
@@ -55,44 +55,329 @@
 insert into t3 values (5 );
 insert into t3 values (13 );
 insert into t3 values (17 );
-insert into t4 values (1,5 );
-insert into t4 values (2,13 );
-insert into t5 values (1,5 );
-insert into t5 values (2,13 );
-insert into t5 values (3,17 );
-insert into t6 values (1,13 );
-insert into t6 values (2,17 );
-select abs(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6;
+select abs(col1) from t1 order by col1;
 abs(col1)
 5
 13
-select * from t1;
+select * from t1 order by col1;
 col1
 5
 13
-select * from t2;
+select * from t2 order by col1;
 col1
 5
 13
 17
-select * from t3;
+select * from t3 order by col1;
 col1
 5
 13
 17
-select * from t4;
+select * from t4 order by colint;
 colint	col1
 1	5
 2	13
-select * from t5;
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	5
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t5 order by colint;
 colint	col1
 1	5
 2	13
-3	17
-select * from t6;
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	5
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t6 order by colint;
 colint	col1
-1	13
-2	17
+1	5
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	5
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+update t1 set col1=15  where col1=5 ;
+update t2 set col1=15  where col1=5 ;
+update t3 set col1=15  where col1=5 ;
+update t4 set col1=15  where col1=5 ;
+update t5 set col1=15  where col1=5 ;
+update t6 set col1=15  where col1=5 ;
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t5 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t6 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
 -------------------------------------------------------------------------
 ---  Alter tables with abs(col1)
 -------------------------------------------------------------------------
@@ -142,33 +427,1241 @@
 partition by range(colint) 
 (partition p0 values less than (abs(15)),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-5
 13
-select * from t22;
+15
+select * from t22 order by col1;
 col1
-5
 13
+15
 17
-select * from t33;
+select * from t33 order by col1;
 col1
-5
 13
+15
 17
-select * from t44;
+select * from t44 order by colint;
 colint	col1
-1	5
+1	15
 2	13
-select * from t55;
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t55 order by colint;
 colint	col1
-1	5
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t66 order by colint;
+colint	col1
+1	15
 2	13
-3	17
-select * from t66;
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13
+15
+alter table t55
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15
+2	13
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1=13 ;
+delete from t2 where col1=13 ;
+delete from t3 where col1=13 ;
+delete from t4 where col1=13 ;
+delete from t5 where col1=13 ;
+delete from t6 where col1=13 ;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+15
+17
+select * from t3 order by col1;
+col1
+15
+17
+select * from t4 order by colint;
 colint	col1
-1	13
-2	17
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t5 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+insert into t1 values (13 );
+insert into t2 values (13 );
+insert into t3 values (13 );
+insert into t4 values (60,13 );
+insert into t5 values (60,13 );
+insert into t6 values (60,13 );
+select * from t1 order by col1;
+col1
+13
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t5 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t6 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15
+select * from t2 order by col1;
+col1
+13
+15
+17
+select * from t3 order by col1;
+col1
+13
+15
+17
+select * from t4 order by colint;
+colint	col1
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t5 order by colint;
+colint	col1
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t6 order by colint;
+colint	col1
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with abs(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1=13 ;
+delete from t22 where col1=13 ;
+delete from t33 where col1=13 ;
+delete from t44 where col1=13 ;
+delete from t55 where col1=13 ;
+delete from t66 where col1=13 ;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+15
+17
+select * from t33 order by col1;
+col1
+15
+17
+select * from t44 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+select * from t55 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+insert into t11 values (13 );
+insert into t22 values (13 );
+insert into t33 values (13 );
+insert into t44 values (60,13 );
+insert into t55 values (60,13 );
+insert into t66 values (60,13 );
+select * from t11 order by col1;
+col1
+13
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t55 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t66 order by colint;
+colint	col1
+1	15
+3	15
+4	17
+5	23
+6	34
+7	56
+8	56
+9	45
+10	34
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15
+select * from t22 order by col1;
+col1
+13
+15
+17
+select * from t33 order by col1;
+col1
+13
+15
+17
+select * from t44 order by colint;
+colint	col1
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t55 order by colint;
+colint	col1
+11	78
+12	89
+13	67
+14	46
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+select * from t66 order by colint;
+colint	col1
+15	34
+16	324
+17	345
+18	34
+19	78
+20	567
+21	4
+22	435
+23	34
+24	45
+25	4565
+26	4
+27	3
+28	2
+29	3
+30	15
+31	6
+32	8
+33	9
+34	745
+35	34
+36	34
+37	324
+38	67
+39	78
+40	89
+41	90
+42	78967
+50	56
+51	34
+55	123
+60	13
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -238,44 +1731,83 @@
 insert into t3 values ('1');
 insert into t3 values ('9');
 insert into t3 values ('3');
-insert into t4 values (1,'1');
-insert into t4 values (2,'9');
-insert into t5 values (1,'1');
-insert into t5 values (2,'9');
-insert into t5 values (3,'3');
-insert into t6 values (1,'9');
-insert into t6 values (2,'3');
-select ascii(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ascii(col1) from t1 order by col1;
 ascii(col1)
 49
 57
-select * from t1;
+select * from t1 order by col1;
 col1
 1
 9
-select * from t2;
+select * from t2 order by col1;
 col1
 1
-9
 3
-select * from t3;
+9
+select * from t3 order by col1;
 col1
 1
-9
 3
-select * from t4;
+9
+select * from t4 order by colint;
 colint	col1
 1	1
 2	9
-select * from t5;
+3	3
+4	8
+select * from t5 order by colint;
 colint	col1
 1	1
 2	9
 3	3
-select * from t6;
+4	8
+select * from t6 order by colint;
+colint	col1
+1	1
+2	9
+3	3
+4	8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t5 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t6 order by colint;
 colint	col1
-1	9
-2	3
+1	8
+2	9
+3	3
+4	8
 -------------------------------------------------------------------------
 ---  Alter tables with ascii(col1)
 -------------------------------------------------------------------------
@@ -325,33 +1857,311 @@
 partition by range(colint) 
 (partition p0 values less than (ascii('5')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-1
+8
 9
-select * from t22;
+select * from t22 order by col1;
 col1
-1
+3
+8
 9
+select * from t33 order by col1;
+col1
 3
-select * from t33;
+8
+9
+select * from t44 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t55 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t66 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-1
+8
 9
-3
-select * from t44;
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
 colint	col1
-1	1
+1	8
 2	9
-select * from t55;
+3	3
+4	8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
 colint	col1
-1	1
+1	8
+2	9
+3	3
+4	8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	8
 2	9
 3	3
-select * from t66;
+4	8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+select * from t5 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t5 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t6 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint	col1
+60	9
+select * from t5 order by colint;
+colint	col1
+60	9
+select * from t6 order by colint;
+colint	col1
+60	9
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with ascii(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+select * from t55 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t55 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t66 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint	col1
+60	9
+select * from t55 order by colint;
 colint	col1
-1	9
-2	3
+60	9
+select * from t66 order by colint;
+colint	col1
+60	9
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -421,44 +2231,83 @@
 insert into t3 values (5.1230);
 insert into t3 values (13.345);
 insert into t3 values (17.987);
-insert into t4 values (1,5.1230);
-insert into t4 values (2,13.345);
-insert into t5 values (1,5.1230);
-insert into t5 values (2,13.345);
-insert into t5 values (3,17.987);
-insert into t6 values (1,13.345);
-insert into t6 values (2,17.987);
-select cast(ceiling(col1) as signed integer) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(ceiling(col1) as signed integer) from t1 order by col1;
 cast(ceiling(col1) as signed integer)
 6
 14
-select * from t1;
+select * from t1 order by col1;
 col1
 5.1230
 13.3450
-select * from t2;
+select * from t2 order by col1;
 col1
 5.1230
 13.3450
 17.9870
-select * from t3;
+select * from t3 order by col1;
 col1
 5.1230
 13.3450
 17.9870
-select * from t4;
+select * from t4 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
 colint	col1
 1	5.1230
 2	13.3450
-select * from t5;
+3	17.9870
+4	15.6540
+select * from t6 order by colint;
 colint	col1
 1	5.1230
 2	13.3450
 3	17.9870
-select * from t6;
+4	15.6540
+update t1 set col1=15.654  where col1=5.1230;
+update t2 set col1=15.654  where col1=5.1230;
+update t3 set col1=15.654  where col1=5.1230;
+update t4 set col1=15.654  where col1=5.1230;
+update t5 set col1=15.654  where col1=5.1230;
+update t6 set col1=15.654  where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t6 order by colint;
 colint	col1
-1	13.3450
-2	17.9870
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
 -------------------------------------------------------------------------
 ---  Alter tables with cast(ceiling(col1) as signed integer)
 -------------------------------------------------------------------------
@@ -508,33 +2357,309 @@
 partition by range(colint) 
 (partition p0 values less than (cast(ceiling(15) as signed integer)),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-5.1230
 13.3450
-select * from t22;
+15.6540
+select * from t22 order by col1;
 col1
-5.1230
 13.3450
+15.6540
 17.9870
-select * from t33;
+select * from t33 order by col1;
 col1
-5.1230
 13.3450
+15.6540
 17.9870
-select * from t44;
+select * from t44 order by colint;
 colint	col1
-1	5.1230
+1	15.6540
 2	13.3450
-select * from t55;
+3	17.9870
+4	15.6540
+select * from t55 order by colint;
 colint	col1
-1	5.1230
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` float(7,4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
 2	13.3450
 3	17.9870
-select * from t66;
+4	15.6540
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t5 order by colint;
 colint	col1
-1	13.3450
-2	17.9870
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t6 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+60	13.3450
+select * from t5 order by colint;
+colint	col1
+60	13.3450
+select * from t6 order by colint;
+colint	col1
+60	13.3450
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+select * from t55 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t55 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint	col1
+60	13.3450
+select * from t55 order by colint;
+colint	col1
+60	13.3450
+select * from t66 order by colint;
+colint	col1
+60	13.3450
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -604,44 +2729,83 @@
 insert into t3 values (5.1230);
 insert into t3 values (13.345);
 insert into t3 values (17.987);
-insert into t4 values (1,5.1230);
-insert into t4 values (2,13.345);
-insert into t5 values (1,5.1230);
-insert into t5 values (2,13.345);
-insert into t5 values (3,17.987);
-insert into t6 values (1,13.345);
-insert into t6 values (2,17.987);
-select cast(floor(col1) as signed) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(floor(col1) as signed) from t1 order by col1;
 cast(floor(col1) as signed)
 5
 13
-select * from t1;
+select * from t1 order by col1;
 col1
 5.1230
 13.3450
-select * from t2;
+select * from t2 order by col1;
 col1
 5.1230
 13.3450
 17.9870
-select * from t3;
+select * from t3 order by col1;
 col1
 5.1230
 13.3450
 17.9870
-select * from t4;
+select * from t4 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
 colint	col1
 1	5.1230
 2	13.3450
-select * from t5;
+3	17.9870
+4	15.6540
+select * from t6 order by colint;
 colint	col1
 1	5.1230
 2	13.3450
 3	17.9870
-select * from t6;
+4	15.6540
+update t1 set col1=15.654  where col1=5.1230;
+update t2 set col1=15.654  where col1=5.1230;
+update t3 set col1=15.654  where col1=5.1230;
+update t4 set col1=15.654  where col1=5.1230;
+update t5 set col1=15.654  where col1=5.1230;
+update t6 set col1=15.654  where col1=5.1230;
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
 colint	col1
-1	13.3450
-2	17.9870
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t6 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
 -------------------------------------------------------------------------
 ---  Alter tables with cast(floor(col1) as signed)
 -------------------------------------------------------------------------
@@ -691,33 +2855,309 @@
 partition by range(colint) 
 (partition p0 values less than (cast(floor(15.123) as signed)),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-5.1230
 13.3450
-select * from t22;
+15.6540
+select * from t22 order by col1;
 col1
-5.1230
 13.3450
+15.6540
 17.9870
-select * from t33;
+select * from t33 order by col1;
 col1
-5.1230
 13.3450
+15.6540
 17.9870
-select * from t44;
+select * from t44 order by colint;
 colint	col1
-1	5.1230
+1	15.6540
 2	13.3450
-select * from t55;
+3	17.9870
+4	15.6540
+select * from t55 order by colint;
 colint	col1
-1	5.1230
+1	15.6540
 2	13.3450
 3	17.9870
-select * from t66;
+4	15.6540
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` float(7,4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+2	13.3450
+3	17.9870
+4	15.6540
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=13.345;
+delete from t2 where col1=13.345;
+delete from t3 where col1=13.345;
+delete from t4 where col1=13.345;
+delete from t5 where col1=13.345;
+delete from t6 where col1=13.345;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+insert into t1 values (13.345);
+insert into t2 values (13.345);
+insert into t3 values (13.345);
+insert into t4 values (60,13.345);
+insert into t5 values (60,13.345);
+insert into t6 values (60,13.345);
+select * from t1 order by col1;
+col1
+13.3450
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t5 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t6 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+15.6540
+select * from t2 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t3 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t4 order by colint;
+colint	col1
+60	13.3450
+select * from t5 order by colint;
+colint	col1
+60	13.3450
+select * from t6 order by colint;
+colint	col1
+60	13.3450
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=13.345;
+delete from t22 where col1=13.345;
+delete from t33 where col1=13.345;
+delete from t44 where col1=13.345;
+delete from t55 where col1=13.345;
+delete from t66 where col1=13.345;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+15.6540
+17.9870
+select * from t44 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+select * from t55 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+insert into t11 values (13.345);
+insert into t22 values (13.345);
+insert into t33 values (13.345);
+insert into t44 values (60,13.345);
+insert into t55 values (60,13.345);
+insert into t66 values (60,13.345);
+select * from t11 order by col1;
+col1
+13.3450
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t55 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+select * from t66 order by colint;
+colint	col1
+1	15.6540
+3	17.9870
+4	15.6540
+60	13.3450
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+15.6540
+select * from t22 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t33 order by col1;
+col1
+13.3450
+15.6540
+17.9870
+select * from t44 order by colint;
 colint	col1
-1	13.3450
-2	17.9870
+60	13.3450
+select * from t55 order by colint;
+colint	col1
+60	13.3450
+select * from t66 order by colint;
+colint	col1
+60	13.3450
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -787,44 +3227,83 @@
 insert into t3 values (5.0000);
 insert into t3 values (19);
 insert into t3 values (17);
-insert into t4 values (1,5.0000);
-insert into t4 values (2,19);
-insert into t5 values (1,5.0000);
-insert into t5 values (2,19);
-insert into t5 values (3,17);
-insert into t6 values (1,19);
-insert into t6 values (2,17);
-select cast(mod(col1,10) as signed) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
+select cast(mod(col1,10) as signed) from t1 order by col1;
 cast(mod(col1,10) as signed)
 5
 9
-select * from t1;
+select * from t1 order by col1;
 col1
 5.0000
 19.0000
-select * from t2;
+select * from t2 order by col1;
 col1
 5.0000
-19.0000
 17.0000
-select * from t3;
+19.0000
+select * from t3 order by col1;
 col1
 5.0000
+17.0000
 19.0000
+select * from t4 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t6 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+update t1 set col1=15  where col1=5.0000;
+update t2 set col1=15  where col1=5.0000;
+update t3 set col1=15  where col1=5.0000;
+update t4 set col1=15  where col1=5.0000;
+update t5 set col1=15  where col1=5.0000;
+update t6 set col1=15  where col1=5.0000;
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
 17.0000
-select * from t4;
+19.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
 colint	col1
-1	5.0000
-2	19.0000
-select * from t5;
-colint	col1
-1	5.0000
-2	19.0000
-3	17.0000
-select * from t6;
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t6 order by colint;
 colint	col1
-1	19.0000
-2	17.0000
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
 -------------------------------------------------------------------------
 ---  Alter tables with cast(mod(col1,10) as signed)
 -------------------------------------------------------------------------
@@ -874,33 +3353,311 @@
 partition by range(colint) 
 (partition p0 values less than (cast(mod(15,10) as signed)),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-5.0000
+15.0000
 19.0000
-select * from t22;
+select * from t22 order by col1;
 col1
-5.0000
+15.0000
+17.0000
 19.0000
+select * from t33 order by col1;
+col1
+15.0000
 17.0000
-select * from t33;
+19.0000
+select * from t44 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t55 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t66 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-5.0000
+15.0000
+19.0000
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` float(7,4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t1 where col1=19;
+delete from t2 where col1=19;
+delete from t3 where col1=19;
+delete from t4 where col1=19;
+delete from t5 where col1=19;
+delete from t6 where col1=19;
+select * from t1 order by col1;
+col1
+15.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+select * from t4 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t5 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+insert into t1 values (19);
+insert into t2 values (19);
+insert into t3 values (19);
+insert into t4 values (60,19);
+insert into t5 values (60,19);
+insert into t6 values (60,19);
+select * from t1 order by col1;
+col1
+15.0000
+19.0000
+select * from t2 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+60	19.0000
+select * from t5 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+60	19.0000
+select * from t6 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+60	19.0000
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t4 order by colint;
+colint	col1
+60	19.0000
+select * from t5 order by colint;
+colint	col1
+60	19.0000
+select * from t6 order by colint;
+colint	col1
+60	19.0000
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+delete from t11 where col1=19;
+delete from t22 where col1=19;
+delete from t33 where col1=19;
+delete from t44 where col1=19;
+delete from t55 where col1=19;
+delete from t66 where col1=19;
+select * from t11 order by col1;
+col1
+15.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+select * from t44 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+select * from t55 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+insert into t11 values (19);
+insert into t22 values (19);
+insert into t33 values (19);
+insert into t44 values (60,19);
+insert into t55 values (60,19);
+insert into t66 values (60,19);
+select * from t11 order by col1;
+col1
+15.0000
+19.0000
+select * from t22 order by col1;
+col1
+15.0000
+17.0000
 19.0000
+select * from t33 order by col1;
+col1
+15.0000
+17.0000
+19.0000
+select * from t44 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+60	19.0000
+select * from t55 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+60	19.0000
+select * from t66 order by colint;
+colint	col1
+1	5.1230
+2	13.3450
+3	17.9870
+4	15.6540
+60	19.0000
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+15.0000
 17.0000
-select * from t44;
+19.0000
+select * from t44 order by colint;
+colint	col1
+60	19.0000
+select * from t55 order by colint;
 colint	col1
-1	5.0000
-2	19.0000
-select * from t55;
-colint	col1
-1	5.0000
-2	19.0000
-3	17.0000
-select * from t66;
+60	19.0000
+select * from t66 order by colint;
 colint	col1
-1	19.0000
-2	17.0000
+60	19.0000
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -970,44 +3727,83 @@
 insert into t3 values ('1');
 insert into t3 values ('9');
 insert into t3 values ('3');
-insert into t4 values (1,'1');
-insert into t4 values (2,'9');
-insert into t5 values (1,'1');
-insert into t5 values (2,'9');
-insert into t5 values (3,'3');
-insert into t6 values (1,'9');
-insert into t6 values (2,'3');
-select ord(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
+select ord(col1) from t1 order by col1;
 ord(col1)
 49
 57
-select * from t1;
+select * from t1 order by col1;
 col1
 1
 9
-select * from t2;
+select * from t2 order by col1;
 col1
 1
-9
 3
-select * from t3;
+9
+select * from t3 order by col1;
 col1
 1
-9
 3
-select * from t4;
+9
+select * from t4 order by colint;
 colint	col1
 1	1
 2	9
-select * from t5;
+3	3
+4	8
+select * from t5 order by colint;
 colint	col1
 1	1
 2	9
 3	3
-select * from t6;
+4	8
+select * from t6 order by colint;
 colint	col1
-1	9
-2	3
+1	1
+2	9
+3	3
+4	8
+update t1 set col1='8' where col1='1';
+update t2 set col1='8' where col1='1';
+update t3 set col1='8' where col1='1';
+update t4 set col1='8' where col1='1';
+update t5 set col1='8' where col1='1';
+update t6 set col1='8' where col1='1';
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t5 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t6 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
 -------------------------------------------------------------------------
 ---  Alter tables with ord(col1)
 -------------------------------------------------------------------------
@@ -1057,33 +3853,309 @@
 partition by range(colint) 
 (partition p0 values less than (ord('a')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-1
+8
 9
-select * from t22;
+select * from t22 order by col1;
 col1
-1
+3
+8
 9
+select * from t33 order by col1;
+col1
 3
-select * from t33;
+8
+9
+select * from t44 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t55 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+select * from t66 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-1
+8
 9
-3
-select * from t44;
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+8
+9
+alter table t55
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` char(3) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
 colint	col1
-1	1
+1	8
 2	9
-select * from t55;
+3	3
+4	8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
 colint	col1
-1	1
+1	8
+2	9
+3	3
+4	8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	8
 2	9
 3	3
-select * from t66;
+4	8
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	8
+2	9
+3	3
+4	8
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='9';
+delete from t2 where col1='9';
+delete from t3 where col1='9';
+delete from t4 where col1='9';
+delete from t5 where col1='9';
+delete from t6 where col1='9';
+select * from t1 order by col1;
+col1
+8
+select * from t2 order by col1;
+col1
+3
+8
+select * from t3 order by col1;
+col1
+3
+8
+select * from t4 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+select * from t5 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+insert into t1 values ('9');
+insert into t2 values ('9');
+insert into t3 values ('9');
+insert into t4 values (60,'9');
+insert into t5 values (60,'9');
+insert into t6 values (60,'9');
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t5 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t6 order by colint;
 colint	col1
-1	9
-2	3
+1	8
+3	3
+4	8
+60	9
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+8
+9
+select * from t2 order by col1;
+col1
+3
+8
+9
+select * from t3 order by col1;
+col1
+3
+8
+9
+select * from t4 order by colint;
+colint	col1
+60	9
+select * from t5 order by colint;
+colint	col1
+60	9
+select * from t6 order by colint;
+colint	col1
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with ord(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='9';
+delete from t22 where col1='9';
+delete from t33 where col1='9';
+delete from t44 where col1='9';
+delete from t55 where col1='9';
+delete from t66 where col1='9';
+select * from t11 order by col1;
+col1
+8
+select * from t22 order by col1;
+col1
+3
+8
+select * from t33 order by col1;
+col1
+3
+8
+select * from t44 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+select * from t55 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+insert into t11 values ('9');
+insert into t22 values ('9');
+insert into t33 values ('9');
+insert into t44 values (60,'9');
+insert into t55 values (60,'9');
+insert into t66 values (60,'9');
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t55 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+select * from t66 order by colint;
+colint	col1
+1	8
+3	3
+4	8
+60	9
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+8
+9
+select * from t22 order by col1;
+col1
+3
+8
+9
+select * from t33 order by col1;
+col1
+3
+8
+9
+select * from t44 order by colint;
+colint	col1
+60	9
+select * from t55 order by colint;
+colint	col1
+60	9
+select * from t66 order by colint;
+colint	col1
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -1153,44 +4225,83 @@
 insert into t3 values ('2006-02-03');
 insert into t3 values ('2006-01-17');
 insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select day(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select day(col1) from t1 order by col1;
 day(col1)
-3
 17
-select * from t1;
+3
+select * from t1 order by col1;
 col1
-2006-02-03
 2006-01-17
-select * from t2;
-col1
 2006-02-03
+select * from t2 order by col1;
+col1
 2006-01-17
 2006-01-25
-select * from t3;
-col1
 2006-02-03
+select * from t3 order by col1;
+col1
 2006-01-17
 2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
 colint	col1
 1	2006-02-03
 2	2006-01-17
-select * from t5;
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
 1	2006-02-03
 2	2006-01-17
 3	2006-01-25
-select * from t6;
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-01-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with day(col1)
 -------------------------------------------------------------------------
@@ -1240,33 +4351,307 @@
 partition by range(colint) 
 (partition p0 values less than (day('2006-12-21')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-02-03
 2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
 col1
-2006-02-03
 2006-01-17
 2006-01-25
-select * from t33;
+2006-02-05
+select * from t33 order by col1;
 col1
-2006-02-03
 2006-01-17
 2006-01-25
-select * from t44;
+2006-02-05
+select * from t44 order by colint;
 colint	col1
-1	2006-02-03
+1	2006-02-05
 2	2006-01-17
-select * from t55;
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
 colint	col1
-1	2006-02-03
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
 2	2006-01-17
 3	2006-01-25
-select * from t66;
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+60	2006-01-17
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with day(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t55 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t66 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-01-25
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+60	2006-01-17
+select * from t55 order by colint;
+colint	col1
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+60	2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -1336,44 +4721,83 @@
 insert into t3 values ('2006-02-03');
 insert into t3 values ('2006-01-17');
 insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-02-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-02-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-01-25');
-select dayofmonth(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofmonth(col1) from t1 order by col1;
 dayofmonth(col1)
-3
 17
-select * from t1;
+3
+select * from t1 order by col1;
 col1
-2006-02-03
 2006-01-17
-select * from t2;
-col1
 2006-02-03
+select * from t2 order by col1;
+col1
 2006-01-17
 2006-01-25
-select * from t3;
-col1
 2006-02-03
+select * from t3 order by col1;
+col1
 2006-01-17
 2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
 colint	col1
 1	2006-02-03
 2	2006-01-17
-select * from t5;
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
 1	2006-02-03
 2	2006-01-17
 3	2006-01-25
-select * from t6;
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-01-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-02-03';
+update t2 set col1='2006-02-05' where col1='2006-02-03';
+update t3 set col1='2006-02-05' where col1='2006-02-03';
+update t4 set col1='2006-02-05' where col1='2006-02-03';
+update t5 set col1='2006-02-05' where col1='2006-02-03';
+update t6 set col1='2006-02-05' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with dayofmonth(col1)
 -------------------------------------------------------------------------
@@ -1423,33 +4847,307 @@
 partition by range(colint) 
 (partition p0 values less than (dayofmonth('2006-12-24')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-02-03
 2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
 col1
-2006-02-03
 2006-01-17
 2006-01-25
-select * from t33;
+2006-02-05
+select * from t33 order by col1;
 col1
-2006-02-03
 2006-01-17
 2006-01-25
-select * from t44;
+2006-02-05
+select * from t44 order by colint;
 colint	col1
-1	2006-02-03
+1	2006-02-05
 2	2006-01-17
-select * from t55;
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
 colint	col1
-1	2006-02-03
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
 2	2006-01-17
 3	2006-01-25
-select * from t66;
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+60	2006-01-17
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t55 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-01-25
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+1	2006-02-05
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+60	2006-01-17
+select * from t55 order by colint;
+colint	col1
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+60	2006-01-17
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -1519,44 +5217,83 @@
 insert into t3 values ('2006-01-03');
 insert into t3 values ('2006-02-17');
 insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-02-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-02-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-02-17');
-insert into t6 values (2,'2006-01-25');
-select dayofweek(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofweek(col1) from t1 order by col1;
 dayofweek(col1)
 3
 6
-select * from t1;
+select * from t1 order by col1;
 col1
 2006-01-03
 2006-02-17
-select * from t2;
+select * from t2 order by col1;
 col1
 2006-01-03
-2006-02-17
 2006-01-25
-select * from t3;
+2006-02-17
+select * from t3 order by col1;
 col1
 2006-01-03
+2006-01-25
 2006-02-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
 2006-01-25
-select * from t4;
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
 colint	col1
-2	2006-02-17
-1	2006-01-03
-select * from t5;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-2	2006-02-17
+1	2006-02-03
+2	2006-01-17
 3	2006-01-25
-1	2006-01-03
-select * from t6;
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-02-17
-2	2006-01-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with dayofweek(col1)
 -------------------------------------------------------------------------
@@ -1606,33 +5343,319 @@
 partition by range(colint) 
 (partition p0 values less than (dayofweek('2006-12-24')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-02-05
 2006-02-17
-select * from t22;
+select * from t22 order by col1;
 col1
-2006-01-03
+2006-01-25
+2006-02-05
 2006-02-17
+select * from t33 order by col1;
+col1
 2006-01-25
-select * from t33;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-02-05
 2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint	col1
+60	2006-02-17
+select * from t5 order by colint;
+colint	col1
+60	2006-02-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofweek(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
 2006-01-25
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t55 order by colint;
 colint	col1
-2	2006-02-17
-1	2006-01-03
-select * from t55;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t66 order by colint;
 colint	col1
-2	2006-02-17
+1	2006-02-03
+2	2006-01-17
 3	2006-01-25
-1	2006-01-03
-select * from t66;
+4	2006-02-05
+60	2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint	col1
+60	2006-02-17
+select * from t55 order by colint;
 colint	col1
-1	2006-02-17
-2	2006-01-25
+60	2006-02-17
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -1702,44 +5725,83 @@
 insert into t3 values ('2006-01-03');
 insert into t3 values ('2006-01-17');
 insert into t3 values ('2006-02-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-02-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-02-25');
-select dayofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
 dayofyear(col1)
 3
 17
-select * from t1;
+select * from t1 order by col1;
 col1
 2006-01-03
 2006-01-17
-select * from t2;
+select * from t2 order by col1;
 col1
 2006-01-03
 2006-01-17
 2006-02-25
-select * from t3;
+select * from t3 order by col1;
 col1
 2006-01-03
 2006-01-17
 2006-02-25
-select * from t4;
+select * from t4 order by colint;
 colint	col1
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t5;
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-3	2006-02-25
-1	2006-01-03
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
 2	2006-01-17
-select * from t6;
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-02-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with dayofyear(col1)
 -------------------------------------------------------------------------
@@ -1789,33 +5851,309 @@
 partition by range(colint) 
 (partition p0 values less than (dayofyear('2006-12-25')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-01-03
 2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
 col1
-2006-01-03
 2006-01-17
+2006-02-05
 2006-02-25
-select * from t33;
+select * from t33 order by col1;
 col1
-2006-01-03
 2006-01-17
+2006-02-05
 2006-02-25
-select * from t44;
+select * from t44 order by colint;
 colint	col1
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t55;
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
 colint	col1
-3	2006-02-25
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t66;
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint	col1
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint	col1
+60	2006-01-17
+select * from t55 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-02-25
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -1885,44 +6223,83 @@
 insert into t3 values ('2006-01-03');
 insert into t3 values ('2006-01-17');
 insert into t3 values ('2006-02-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-01-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-01-17');
-insert into t5 values (3,'2006-02-25');
-insert into t6 values (1,'2006-01-17');
-insert into t6 values (2,'2006-02-25');
-select dayofyear(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select dayofyear(col1) from t1 order by col1;
 dayofyear(col1)
 3
 17
-select * from t1;
+select * from t1 order by col1;
 col1
 2006-01-03
 2006-01-17
-select * from t2;
+select * from t2 order by col1;
 col1
 2006-01-03
 2006-01-17
 2006-02-25
-select * from t3;
+select * from t3 order by col1;
 col1
 2006-01-03
 2006-01-17
 2006-02-25
-select * from t4;
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t5;
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
 colint	col1
-3	2006-02-25
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t6;
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-02-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with dayofyear(col1)
 -------------------------------------------------------------------------
@@ -1972,33 +6349,309 @@
 partition by range(colint) 
 (partition p0 values less than (dayofyear('2006-12-25')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-01-03
 2006-01-17
-select * from t22;
+2006-02-05
+select * from t22 order by col1;
 col1
-2006-01-03
 2006-01-17
+2006-02-05
 2006-02-25
-select * from t33;
+select * from t33 order by col1;
 col1
-2006-01-03
 2006-01-17
+2006-02-05
 2006-02-25
-select * from t44;
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` char(30) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
 colint	col1
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t55;
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
 colint	col1
-3	2006-02-25
-1	2006-01-03
+1	2006-02-03
 2	2006-01-17
-select * from t66;
+3	2006-01-25
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-01-17';
+delete from t2 where col1='2006-01-17';
+delete from t3 where col1='2006-01-17';
+delete from t4 where col1='2006-01-17';
+delete from t5 where col1='2006-01-17';
+delete from t6 where col1='2006-01-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-17');
+insert into t3 values ('2006-01-17');
+insert into t4 values (60,'2006-01-17');
+insert into t5 values (60,'2006-01-17');
+insert into t6 values (60,'2006-01-17');
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t4 order by colint;
+colint	col1
+60	2006-01-17
+select * from t5 order by colint;
+colint	col1
+60	2006-01-17
+select * from t6 order by colint;
+colint	col1
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with dayofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-01-17';
+delete from t22 where col1='2006-01-17';
+delete from t33 where col1='2006-01-17';
+delete from t44 where col1='2006-01-17';
+delete from t55 where col1='2006-01-17';
+delete from t66 where col1='2006-01-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-01-17');
+insert into t22 values ('2006-01-17');
+insert into t33 values ('2006-01-17');
+insert into t44 values (60,'2006-01-17');
+insert into t55 values (60,'2006-01-17');
+insert into t66 values (60,'2006-01-17');
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
 colint	col1
-1	2006-01-17
-2	2006-02-25
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+3	2006-01-25
+4	2006-02-05
+60	2006-01-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-02-05
+2006-02-25
+select * from t44 order by colint;
+colint	col1
+60	2006-01-17
+select * from t55 order by colint;
+colint	col1
+60	2006-01-17
+select * from t66 order by colint;
+colint	col1
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -2068,44 +6721,83 @@
 insert into t3 values ('2006-01-03');
 insert into t3 values ('2006-02-17');
 insert into t3 values ('2006-01-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-02-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-02-17');
-insert into t5 values (3,'2006-01-25');
-insert into t6 values (1,'2006-02-17');
-insert into t6 values (2,'2006-01-25');
-select extract(month from col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select extract(month from col1) from t1 order by col1;
 extract(month from col1)
 1
 2
-select * from t1;
+select * from t1 order by col1;
 col1
 2006-01-03
 2006-02-17
-select * from t2;
+select * from t2 order by col1;
 col1
 2006-01-03
-2006-02-17
 2006-01-25
-select * from t3;
+2006-02-17
+select * from t3 order by col1;
 col1
 2006-01-03
+2006-01-25
+2006-02-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-02-05' where col1='2006-01-03';
+update t2 set col1='2006-02-05' where col1='2006-01-03';
+update t3 set col1='2006-02-05' where col1='2006-01-03';
+update t4 set col1='2006-02-05' where col1='2006-01-03';
+update t5 set col1='2006-02-05' where col1='2006-01-03';
+update t6 set col1='2006-02-05' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-02-05
 2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
 2006-01-25
-select * from t4;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
 colint	col1
-2	2006-02-17
-1	2006-01-03
-select * from t5;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-2	2006-02-17
-1	2006-01-03
+1	2006-02-03
+2	2006-01-17
 3	2006-01-25
-select * from t6;
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-02-17
-2	2006-01-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with extract(month from col1)
 -------------------------------------------------------------------------
@@ -2155,33 +6847,309 @@
 partition by range(colint) 
 (partition p0 values less than (extract(year from '1998-11-23')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-02-05
 2006-02-17
-select * from t22;
+select * from t22 order by col1;
 col1
-2006-01-03
+2006-01-25
+2006-02-05
 2006-02-17
+select * from t33 order by col1;
+col1
 2006-01-25
-select * from t33;
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-02-05
+2006-02-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-05
 2006-02-17
+alter table t55
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-02-17';
+delete from t2 where col1='2006-02-17';
+delete from t3 where col1='2006-02-17';
+delete from t4 where col1='2006-02-17';
+delete from t5 where col1='2006-02-17';
+delete from t6 where col1='2006-02-17';
+select * from t1 order by col1;
+col1
+2006-02-05
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-02-17');
+insert into t3 values ('2006-02-17');
+insert into t4 values (60,'2006-02-17');
+insert into t5 values (60,'2006-02-17');
+insert into t6 values (60,'2006-02-17');
+select * from t1 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
+colint	col1
+60	2006-02-17
+select * from t5 order by colint;
+colint	col1
+60	2006-02-17
+select * from t6 order by colint;
+colint	col1
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with extract(month from col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-02-17';
+delete from t22 where col1='2006-02-17';
+delete from t33 where col1='2006-02-17';
+delete from t44 where col1='2006-02-17';
+delete from t55 where col1='2006-02-17';
+delete from t66 where col1='2006-02-17';
+select * from t11 order by col1;
+col1
+2006-02-05
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-02-17');
+insert into t22 values ('2006-02-17');
+insert into t33 values ('2006-02-17');
+insert into t44 values (60,'2006-02-17');
+insert into t55 values (60,'2006-02-17');
+insert into t66 values (60,'2006-02-17');
+select * from t11 order by col1;
+col1
+2006-02-05
+2006-02-17
+select * from t22 order by col1;
+col1
 2006-01-25
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
 colint	col1
-2	2006-02-17
-1	2006-01-03
-select * from t55;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+select * from t55 order by colint;
 colint	col1
-2	2006-02-17
-1	2006-01-03
+1	2006-02-03
+2	2006-01-17
 3	2006-01-25
-select * from t66;
+4	2006-02-05
+60	2006-02-17
+select * from t66 order by colint;
 colint	col1
-1	2006-02-17
-2	2006-01-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-02-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-05
+2006-02-17
+select * from t44 order by colint;
+colint	col1
+60	2006-02-17
+select * from t55 order by colint;
+colint	col1
+60	2006-02-17
+select * from t66 order by colint;
+colint	col1
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -2251,44 +7219,83 @@
 insert into t3 values ('09:09');
 insert into t3 values ('14:30');
 insert into t3 values ('21:59');
-insert into t4 values (1,'09:09');
-insert into t4 values (2,'14:30');
-insert into t5 values (1,'09:09');
-insert into t5 values (2,'14:30');
-insert into t5 values (3,'21:59');
-insert into t6 values (1,'14:30');
-insert into t6 values (2,'21:59');
-select hour(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select hour(col1) from t1 order by col1;
 hour(col1)
 9
 14
-select * from t1;
+select * from t1 order by col1;
 col1
 09:09:00
 14:30:00
-select * from t2;
+select * from t2 order by col1;
 col1
 09:09:00
 14:30:00
 21:59:00
-select * from t3;
+select * from t3 order by col1;
 col1
 09:09:00
 14:30:00
 21:59:00
-select * from t4;
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
 colint	col1
-2	14:30:00
-1	09:09:00
-select * from t5;
-colint	col1
-2	14:30:00
-1	09:09:00
-3	21:59:00
-select * from t6;
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+update t1 set col1='10:30' where col1='09:09';
+update t2 set col1='10:30' where col1='09:09';
+update t3 set col1='10:30' where col1='09:09';
+update t4 set col1='10:30' where col1='09:09';
+update t5 set col1='10:30' where col1='09:09';
+update t6 set col1='10:30' where col1='09:09';
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
 colint	col1
-1	14:30:00
-2	21:59:00
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
 -------------------------------------------------------------------------
 ---  Alter tables with hour(col1)
 -------------------------------------------------------------------------
@@ -2338,33 +7345,315 @@
 partition by range(colint) 
 (partition p0 values less than (hour('18:30')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-09:09:00
+10:30:00
 14:30:00
-select * from t22;
+select * from t22 order by col1;
 col1
-09:09:00
+10:30:00
 14:30:00
 21:59:00
-select * from t33;
+select * from t33 order by col1;
 col1
-09:09:00
+10:30:00
 14:30:00
 21:59:00
-select * from t44;
+select * from t44 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
 colint	col1
-2	14:30:00
-1	09:09:00
-select * from t55;
-colint	col1
-2	14:30:00
-1	09:09:00
-3	21:59:00
-select * from t66;
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t66 order by colint;
 colint	col1
-1	14:30:00
-2	21:59:00
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+alter table t55
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30';
+delete from t2 where col1='14:30';
+delete from t3 where col1='14:30';
+delete from t4 where col1='14:30';
+delete from t5 where col1='14:30';
+delete from t6 where col1='14:30';
+select * from t1 order by col1;
+col1
+10:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+insert into t1 values ('14:30');
+insert into t2 values ('14:30');
+insert into t3 values ('14:30');
+insert into t4 values (60,'14:30');
+insert into t5 values (60,'14:30');
+insert into t6 values (60,'14:30');
+select * from t1 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t2 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:00
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:00
+select * from t6 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:00
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t4 order by colint;
+colint	col1
+60	14:30:00
+select * from t5 order by colint;
+colint	col1
+60	14:30:00
+select * from t6 order by colint;
+colint	col1
+60	14:30:00
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with hour(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30';
+delete from t22 where col1='14:30';
+delete from t33 where col1='14:30';
+delete from t44 where col1='14:30';
+delete from t55 where col1='14:30';
+delete from t66 where col1='14:30';
+select * from t11 order by col1;
+col1
+10:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+21:59:00
+select * from t44 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+insert into t11 values ('14:30');
+insert into t22 values ('14:30');
+insert into t33 values ('14:30');
+insert into t44 values (60,'14:30');
+insert into t55 values (60,'14:30');
+insert into t66 values (60,'14:30');
+select * from t11 order by col1;
+col1
+10:30:00
+14:30:00
+select * from t22 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:00
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:00
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:00
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+14:30:00
+21:59:00
+select * from t33 order by col1;
+col1
+10:30:00
+14:30:00
+21:59:00
+select * from t44 order by colint;
+colint	col1
+60	14:30:00
+select * from t55 order by colint;
+colint	col1
+60	14:30:00
+select * from t66 order by colint;
+colint	col1
+60	14:30:00
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -2434,44 +7723,83 @@
 insert into t3 values ('09:09:15.000002');
 insert into t3 values ('04:30:01.000018');
 insert into t3 values ('00:59:22.000024');
-insert into t4 values (1,'09:09:15.000002');
-insert into t4 values (2,'04:30:01.000018');
-insert into t5 values (1,'09:09:15.000002');
-insert into t5 values (2,'04:30:01.000018');
-insert into t5 values (3,'00:59:22.000024');
-insert into t6 values (1,'04:30:01.000018');
-insert into t6 values (2,'00:59:22.000024');
-select microsecond(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select microsecond(col1) from t1 order by col1;
 microsecond(col1)
 0
 0
-select * from t1;
+select * from t1 order by col1;
 col1
+04:30:01
 09:09:15
+select * from t2 order by col1;
+col1
+00:59:22
 04:30:01
-select * from t2;
+09:09:15
+select * from t3 order by col1;
 col1
+00:59:22
+04:30:01
 09:09:15
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
+update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
+select * from t1 order by col1;
+col1
 04:30:01
-00:59:22
-select * from t3;
+05:30:34
+select * from t2 order by col1;
 col1
-09:09:15
+00:59:22
 04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
 00:59:22
-select * from t4;
+04:30:01
+05:30:34
+select * from t4 order by colint;
 colint	col1
-1	09:09:15
+1	05:30:34
 2	04:30:01
-select * from t5;
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
 colint	col1
-1	09:09:15
+1	05:30:34
 2	04:30:01
 3	00:59:22
-select * from t6;
+4	05:30:34
+select * from t6 order by colint;
 colint	col1
-1	04:30:01
-2	00:59:22
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
 -------------------------------------------------------------------------
 ---  Alter tables with microsecond(col1)
 -------------------------------------------------------------------------
@@ -2521,33 +7849,301 @@
 partition by range(colint) 
 (partition p0 values less than (microsecond('10:30:10.000010')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-09:09:15
 04:30:01
-select * from t22;
+05:30:34
+select * from t22 order by col1;
 col1
-09:09:15
+00:59:22
 04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
 00:59:22
-select * from t33;
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint	col1
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
+colint	col1
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t66 order by colint;
+colint	col1
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-09:09:15
 04:30:01
-00:59:22
-select * from t44;
+05:30:34
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+alter table t55
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
 colint	col1
-1	09:09:15
+1	05:30:34
 2	04:30:01
-select * from t55;
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
 colint	col1
-1	09:09:15
+1	05:30:34
 2	04:30:01
 3	00:59:22
-select * from t66;
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	05:30:34
+2	04:30:01
+3	00:59:22
+4	05:30:34
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='04:30:01.000018';
+delete from t2 where col1='04:30:01.000018';
+delete from t3 where col1='04:30:01.000018';
+delete from t4 where col1='04:30:01.000018';
+delete from t5 where col1='04:30:01.000018';
+delete from t6 where col1='04:30:01.000018';
+select * from t1 order by col1;
+col1
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t4 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+insert into t1 values ('04:30:01.000018');
+insert into t2 values ('04:30:01.000018');
+insert into t3 values ('04:30:01.000018');
+insert into t4 values (60,'04:30:01.000018');
+insert into t5 values (60,'04:30:01.000018');
+insert into t6 values (60,'04:30:01.000018');
+select * from t1 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+60	04:30:01
+select * from t5 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+60	04:30:01
+select * from t6 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+60	04:30:01
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t4 order by colint;
+colint	col1
+60	04:30:01
+select * from t5 order by colint;
+colint	col1
+60	04:30:01
+select * from t6 order by colint;
+colint	col1
+60	04:30:01
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with microsecond(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='04:30:01.000018';
+delete from t22 where col1='04:30:01.000018';
+delete from t33 where col1='04:30:01.000018';
+delete from t44 where col1='04:30:01.000018';
+delete from t55 where col1='04:30:01.000018';
+delete from t66 where col1='04:30:01.000018';
+select * from t11 order by col1;
+col1
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+05:30:34
+select * from t44 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
 colint	col1
-1	04:30:01
-2	00:59:22
+1	05:30:34
+3	00:59:22
+4	05:30:34
+insert into t11 values ('04:30:01.000018');
+insert into t22 values ('04:30:01.000018');
+insert into t33 values ('04:30:01.000018');
+insert into t44 values (60,'04:30:01.000018');
+insert into t55 values (60,'04:30:01.000018');
+insert into t66 values (60,'04:30:01.000018');
+select * from t11 order by col1;
+col1
+04:30:01
+05:30:34
+select * from t22 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+60	04:30:01
+select * from t55 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+60	04:30:01
+select * from t66 order by colint;
+colint	col1
+1	05:30:34
+3	00:59:22
+4	05:30:34
+60	04:30:01
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+00:59:22
+04:30:01
+05:30:34
+select * from t44 order by colint;
+colint	col1
+60	04:30:01
+select * from t55 order by colint;
+colint	col1
+60	04:30:01
+select * from t66 order by colint;
+colint	col1
+60	04:30:01
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -2617,44 +8213,83 @@
 insert into t3 values ('09:09:15');
 insert into t3 values ('14:30:45');
 insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:15');
-insert into t4 values (2,'14:30:45');
-insert into t5 values (1,'09:09:15');
-insert into t5 values (2,'14:30:45');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:45');
-insert into t6 values (2,'21:59:22');
-select minute(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select minute(col1) from t1 order by col1;
 minute(col1)
 9
 30
-select * from t1;
+select * from t1 order by col1;
 col1
 09:09:15
 14:30:45
-select * from t2;
+select * from t2 order by col1;
 col1
 09:09:15
 14:30:45
 21:59:22
-select * from t3;
+select * from t3 order by col1;
 col1
 09:09:15
 14:30:45
 21:59:22
-select * from t4;
+select * from t4 order by colint;
 colint	col1
-2	14:30:45
 1	09:09:15
-select * from t5;
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
 colint	col1
-2	14:30:45
 1	09:09:15
-3	21:59:22
-select * from t6;
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+update t1 set col1='10:24:23' where col1='09:09:15';
+update t2 set col1='10:24:23' where col1='09:09:15';
+update t3 set col1='10:24:23' where col1='09:09:15';
+update t4 set col1='10:24:23' where col1='09:09:15';
+update t5 set col1='10:24:23' where col1='09:09:15';
+update t6 set col1='10:24:23' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
 colint	col1
-1	14:30:45
-2	21:59:22
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
 -------------------------------------------------------------------------
 ---  Alter tables with minute(col1)
 -------------------------------------------------------------------------
@@ -2704,33 +8339,321 @@
 partition by range(colint) 
 (partition p0 values less than (minute('18:30')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-09:09:15
+10:24:23
 14:30:45
-select * from t22;
+select * from t22 order by col1;
 col1
-09:09:15
+10:24:23
 14:30:45
 21:59:22
-select * from t33;
+select * from t33 order by col1;
 col1
-09:09:15
+10:24:23
 14:30:45
 21:59:22
-select * from t44;
+select * from t44 order by colint;
 colint	col1
-2	14:30:45
-1	09:09:15
-select * from t55;
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
 colint	col1
-2	14:30:45
-1	09:09:15
-3	21:59:22
-select * from t66;
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t66 order by colint;
 colint	col1
-1	14:30:45
-2	21:59:22
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:45';
+delete from t2 where col1='14:30:45';
+delete from t3 where col1='14:30:45';
+delete from t4 where col1='14:30:45';
+delete from t5 where col1='14:30:45';
+delete from t6 where col1='14:30:45';
+select * from t1 order by col1;
+col1
+10:24:23
+select * from t2 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+insert into t1 values ('14:30:45');
+insert into t2 values ('14:30:45');
+insert into t3 values ('14:30:45');
+insert into t4 values (60,'14:30:45');
+insert into t5 values (60,'14:30:45');
+insert into t6 values (60,'14:30:45');
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:45
+select * from t5 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:45
+select * from t6 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:45
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t2 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint	col1
+60	14:30:45
+select * from t5 order by colint;
+colint	col1
+60	14:30:45
+select * from t6 order by colint;
+colint	col1
+60	14:30:45
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with minute(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:45';
+delete from t22 where col1='14:30:45';
+delete from t33 where col1='14:30:45';
+delete from t44 where col1='14:30:45';
+delete from t55 where col1='14:30:45';
+delete from t66 where col1='14:30:45';
+select * from t11 order by col1;
+col1
+10:24:23
+select * from t22 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+insert into t11 values ('14:30:45');
+insert into t22 values ('14:30:45');
+insert into t33 values ('14:30:45');
+insert into t44 values (60,'14:30:45');
+insert into t55 values (60,'14:30:45');
+insert into t66 values (60,'14:30:45');
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:45
+select * from t55 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:45
+select * from t66 order by colint;
+colint	col1
+1	10:24:23
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:45
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:24:23
+14:30:45
+select * from t22 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:24:23
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint	col1
+60	14:30:45
+select * from t55 order by colint;
+colint	col1
+60	14:30:45
+select * from t66 order by colint;
+colint	col1
+60	14:30:45
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -2800,44 +8723,83 @@
 insert into t3 values ('09:09:09');
 insert into t3 values ('14:30:20');
 insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:09');
-insert into t4 values (2,'14:30:20');
-insert into t5 values (1,'09:09:09');
-insert into t5 values (2,'14:30:20');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:20');
-insert into t6 values (2,'21:59:22');
-select second(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
 second(col1)
 9
 20
-select * from t1;
+select * from t1 order by col1;
 col1
 09:09:09
 14:30:20
-select * from t2;
+select * from t2 order by col1;
 col1
 09:09:09
 14:30:20
 21:59:22
-select * from t3;
+select * from t3 order by col1;
 col1
 09:09:09
 14:30:20
 21:59:22
-select * from t4;
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
 colint	col1
-2	14:30:20
-1	09:09:09
-select * from t5;
-colint	col1
-2	14:30:20
-3	21:59:22
-1	09:09:09
-select * from t6;
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
 colint	col1
-1	14:30:20
-2	21:59:22
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t6 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
 -------------------------------------------------------------------------
 ---  Alter tables with second(col1)
 -------------------------------------------------------------------------
@@ -2887,33 +8849,321 @@
 partition by range(colint) 
 (partition p0 values less than (second('18:30:14')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-09:09:09
+10:22:33
 14:30:20
-select * from t22;
+select * from t22 order by col1;
 col1
-09:09:09
+10:22:33
 14:30:20
 21:59:22
-select * from t33;
+select * from t33 order by col1;
 col1
-09:09:09
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` time DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:20
+select * from t5 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:20
+select * from t6 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint	col1
+60	14:30:20
+select * from t5 order by colint;
+colint	col1
+60	14:30:20
+select * from t6 order by colint;
+colint	col1
+60	14:30:20
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:20
+select * from t55 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:20
+select * from t66 order by colint;
+colint	col1
+1	09:09:15
+2	04:30:01
+3	00:59:22
+4	05:30:34
+60	14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
 14:30:20
 21:59:22
-select * from t44;
+select * from t44 order by colint;
 colint	col1
-2	14:30:20
-1	09:09:09
-select * from t55;
-colint	col1
-2	14:30:20
-3	21:59:22
-1	09:09:09
-select * from t66;
+60	14:30:20
+select * from t55 order by colint;
 colint	col1
-1	14:30:20
-2	21:59:22
+60	14:30:20
+select * from t66 order by colint;
+colint	col1
+60	14:30:20
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -2983,44 +9233,83 @@
 insert into t3 values ('09:09:09');
 insert into t3 values ('14:30:20');
 insert into t3 values ('21:59:22');
-insert into t4 values (1,'09:09:09');
-insert into t4 values (2,'14:30:20');
-insert into t5 values (1,'09:09:09');
-insert into t5 values (2,'14:30:20');
-insert into t5 values (3,'21:59:22');
-insert into t6 values (1,'14:30:20');
-insert into t6 values (2,'21:59:22');
-select second(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
+select second(col1) from t1 order by col1;
 second(col1)
 9
 20
-select * from t1;
+select * from t1 order by col1;
 col1
 09:09:09
 14:30:20
-select * from t2;
+select * from t2 order by col1;
 col1
 09:09:09
 14:30:20
 21:59:22
-select * from t3;
+select * from t3 order by col1;
 col1
 09:09:09
 14:30:20
 21:59:22
-select * from t4;
+select * from t4 order by colint;
 colint	col1
-2	14:30:20
-1	09:09:09
-select * from t5;
-colint	col1
-2	14:30:20
-3	21:59:22
-1	09:09:09
-select * from t6;
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t5 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t6 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+update t1 set col1='10:22:33' where col1='09:09:09';
+update t2 set col1='10:22:33' where col1='09:09:09';
+update t3 set col1='10:22:33' where col1='09:09:09';
+update t4 set col1='10:22:33' where col1='09:09:09';
+update t5 set col1='10:22:33' where col1='09:09:09';
+update t6 set col1='10:22:33' where col1='09:09:09';
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
 colint	col1
-1	14:30:20
-2	21:59:22
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t5 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t6 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
 -------------------------------------------------------------------------
 ---  Alter tables with second(col1)
 -------------------------------------------------------------------------
@@ -3070,33 +9359,321 @@
 partition by range(colint) 
 (partition p0 values less than (second('18:30:14')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-09:09:09
+10:22:33
 14:30:20
-select * from t22;
+select * from t22 order by col1;
 col1
-09:09:09
+10:22:33
 14:30:20
 21:59:22
-select * from t33;
+select * from t33 order by col1;
 col1
-09:09:09
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t55 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t66 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` char(30) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='14:30:20';
+delete from t2 where col1='14:30:20';
+delete from t3 where col1='14:30:20';
+delete from t4 where col1='14:30:20';
+delete from t5 where col1='14:30:20';
+delete from t6 where col1='14:30:20';
+select * from t1 order by col1;
+col1
+10:22:33
+select * from t2 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t5 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+insert into t1 values ('14:30:20');
+insert into t2 values ('14:30:20');
+insert into t3 values ('14:30:20');
+insert into t4 values (60,'14:30:20');
+insert into t5 values (60,'14:30:20');
+insert into t6 values (60,'14:30:20');
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t4 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+60	14:30:20
+select * from t5 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+60	14:30:20
+select * from t6 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+60	14:30:20
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t2 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+10:22:33
 14:30:20
 21:59:22
-select * from t44;
+select * from t4 order by colint;
 colint	col1
-2	14:30:20
-1	09:09:09
-select * from t55;
-colint	col1
-2	14:30:20
-3	21:59:22
-1	09:09:09
-select * from t66;
+60	14:30:20
+select * from t5 order by colint;
+colint	col1
+60	14:30:20
+select * from t6 order by colint;
+colint	col1
+60	14:30:20
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with second(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='14:30:20';
+delete from t22 where col1='14:30:20';
+delete from t33 where col1='14:30:20';
+delete from t44 where col1='14:30:20';
+delete from t55 where col1='14:30:20';
+delete from t66 where col1='14:30:20';
+select * from t11 order by col1;
+col1
+10:22:33
+select * from t22 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+21:59:22
+select * from t44 order by colint;
 colint	col1
-1	14:30:20
-2	21:59:22
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+select * from t55 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+insert into t11 values ('14:30:20');
+insert into t22 values ('14:30:20');
+insert into t33 values ('14:30:20');
+insert into t44 values (60,'14:30:20');
+insert into t55 values (60,'14:30:20');
+insert into t66 values (60,'14:30:20');
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+60	14:30:20
+select * from t55 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+60	14:30:20
+select * from t66 order by colint;
+colint	col1
+1	09:09:15.000002
+2	04:30:01.000018
+3	00:59:22.000024
+4	05:30:34.000037
+60	14:30:20
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+10:22:33
+14:30:20
+select * from t22 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t33 order by col1;
+col1
+10:22:33
+14:30:20
+21:59:22
+select * from t44 order by colint;
+colint	col1
+60	14:30:20
+select * from t55 order by colint;
+colint	col1
+60	14:30:20
+select * from t66 order by colint;
+colint	col1
+60	14:30:20
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -3166,44 +9743,83 @@
 insert into t3 values ('2006-01-03');
 insert into t3 values ('2006-12-17');
 insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-12-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-12-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-12-17');
-insert into t6 values (2,'2006-05-25');
-select month(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select month(col1) from t1 order by col1;
 month(col1)
 1
 12
-select * from t1;
+select * from t1 order by col1;
 col1
 2006-01-03
 2006-12-17
-select * from t2;
+select * from t2 order by col1;
 col1
 2006-01-03
 2006-05-25
 2006-12-17
-select * from t3;
+select * from t3 order by col1;
 col1
 2006-01-03
+2006-05-25
+2006-12-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-11-06' where col1='2006-01-03';
+update t2 set col1='2006-11-06' where col1='2006-01-03';
+update t3 set col1='2006-11-06' where col1='2006-01-03';
+update t4 set col1='2006-11-06' where col1='2006-01-03';
+update t5 set col1='2006-11-06' where col1='2006-01-03';
+update t6 set col1='2006-11-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
 2006-12-17
+select * from t3 order by col1;
+col1
 2006-05-25
-select * from t4;
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-2	2006-12-17
-1	2006-01-03
-select * from t5;
-colint	col1
-2	2006-12-17
-1	2006-01-03
-3	2006-05-25
-select * from t6;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-12-17
-2	2006-05-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with month(col1)
 -------------------------------------------------------------------------
@@ -3253,33 +9869,315 @@
 partition by range(colint) 
 (partition p0 values less than (month('2006-10-14')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-11-06
 2006-12-17
-select * from t22;
+select * from t22 order by col1;
 col1
-2006-01-03
 2006-05-25
+2006-11-06
 2006-12-17
-select * from t33;
+select * from t33 order by col1;
 col1
-2006-01-03
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-11-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-06
 2006-12-17
+select * from t3 order by col1;
+col1
 2006-05-25
-select * from t44;
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t5 order by colint;
 colint	col1
-2	2006-12-17
-1	2006-01-03
-select * from t55;
-colint	col1
-2	2006-12-17
-1	2006-01-03
-3	2006-05-25
-select * from t66;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t6 order by colint;
 colint	col1
-1	2006-12-17
-2	2006-05-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t4 order by colint;
+colint	col1
+60	2006-12-17
+select * from t5 order by colint;
+colint	col1
+60	2006-12-17
+select * from t6 order by colint;
+colint	col1
+60	2006-12-17
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with month(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-11-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+2006-11-06
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
+colint	col1
+60	2006-12-17
+select * from t55 order by colint;
+colint	col1
+60	2006-12-17
+select * from t66 order by colint;
+colint	col1
+60	2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
 drop table if exists t1 ;
 drop table if exists t2 ;
 drop table if exists t3 ;
@@ -3349,44 +10247,83 @@
 insert into t3 values ('2006-01-03');
 insert into t3 values ('2006-12-17');
 insert into t3 values ('2006-09-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-12-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-12-17');
-insert into t5 values (3,'2006-09-25');
-insert into t6 values (1,'2006-12-17');
-insert into t6 values (2,'2006-09-25');
-select quarter(col1) from t1;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
+load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
+select quarter(col1) from t1 order by col1;
 quarter(col1)
 1
 4
-select * from t1;
+select * from t1 order by col1;
 col1
 2006-01-03
 2006-12-17
-select * from t2;
+select * from t2 order by col1;
 col1
 2006-01-03
-2006-12-17
 2006-09-25
-select * from t3;
+2006-12-17
+select * from t3 order by col1;
 col1
 2006-01-03
+2006-09-25
 2006-12-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+update t1 set col1='2006-07-30' where col1='2006-01-03';
+update t2 set col1='2006-07-30' where col1='2006-01-03';
+update t3 set col1='2006-07-30' where col1='2006-01-03';
+update t4 set col1='2006-07-30' where col1='2006-01-03';
+update t5 set col1='2006-07-30' where col1='2006-01-03';
+update t6 set col1='2006-07-30' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
 2006-09-25
-select * from t4;
+2006-12-17
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-2	2006-12-17
-1	2006-01-03
-select * from t5;
-colint	col1
-2	2006-12-17
-1	2006-01-03
-3	2006-09-25
-select * from t6;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t6 order by colint;
 colint	col1
-1	2006-12-17
-2	2006-09-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
 -------------------------------------------------------------------------
 ---  Alter tables with quarter(col1)
 -------------------------------------------------------------------------
@@ -3436,33 +10373,313 @@
 partition by range(colint) 
 (partition p0 values less than (quarter('2006-10-14')),
 partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-07-30
 2006-12-17
-select * from t22;
+select * from t22 order by col1;
 col1
-2006-01-03
+2006-07-30
+2006-09-25
 2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
 2006-09-25
-select * from t33;
+2006-12-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+---------------------------
+---- some alter table begin
+---------------------------
+alter table t11
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t11 order by col1;
 col1
-2006-01-03
+2006-07-30
+2006-12-17
+alter table t11
+reorganize partition s1 into
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-07-30
 2006-12-17
+alter table t55
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 5 
+(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
+partition p1 values in (11,12,13,14,15,16,17,18,19,20),
+partition p2 values in (21,22,23,24,25,26,27,28,29,30),
+partition p3 values in (31,32,33,34,35,36,37,38,39,40),
+partition p4 values in (41,42,43,44,45,46,47,48,49,50),
+partition p5 values in (51,52,53,54,55,56,57,58,59,60)
+);
+show create table t55;
+Table	Create Table
+t55	CREATE TABLE `t55` (
+  `colint` int(11) DEFAULT NULL,
+  `col1` date DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = InnoDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = InnoDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = InnoDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = InnoDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = InnoDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = InnoDB) */
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-12-17';
+delete from t2 where col1='2006-12-17';
+delete from t3 where col1='2006-12-17';
+delete from t4 where col1='2006-12-17';
+delete from t5 where col1='2006-12-17';
+delete from t6 where col1='2006-12-17';
+select * from t1 order by col1;
+col1
+2006-07-30
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t3 order by col1;
+col1
+2006-07-30
 2006-09-25
-select * from t44;
+select * from t4 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t5 order by colint;
 colint	col1
-2	2006-12-17
-1	2006-01-03
-select * from t55;
-colint	col1
-2	2006-12-17
-1	2006-01-03
-3	2006-09-25
-select * from t66;
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-12-17');
+insert into t3 values ('2006-12-17');
+insert into t4 values (60,'2006-12-17');
+insert into t5 values (60,'2006-12-17');
+insert into t6 values (60,'2006-12-17');
+select * from t1 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
 colint	col1
-1	2006-12-17
-2	2006-09-25
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t5 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t6 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+alter table t1 drop partition p0;
+alter table t2 drop partition p0;
+alter table t4 drop partition p0;
+alter table t5 drop partition p0;
+alter table t6 drop partition p0;
+select * from t1 order by col1;
+col1
+select * from t2 order by col1;
+col1
+select * from t3 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t4 order by colint;
+colint	col1
+60	2006-12-17
+select * from t5 order by colint;
+colint	col1
+60	2006-12-17
+select * from t6 order by colint;
+colint	col1
+4	2006-02-05
+60	2006-12-17
+-------------------------------------------------------------------------
+---  Delete rows and partitions of tables with quarter(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-12-17';
+delete from t22 where col1='2006-12-17';
+delete from t33 where col1='2006-12-17';
+delete from t44 where col1='2006-12-17';
+delete from t55 where col1='2006-12-17';
+delete from t66 where col1='2006-12-17';
+select * from t11 order by col1;
+col1
+2006-07-30
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+insert into t11 values ('2006-12-17');
+insert into t22 values ('2006-12-17');
+insert into t33 values ('2006-12-17');
+insert into t44 values (60,'2006-12-17');
+insert into t55 values (60,'2006-12-17');
+insert into t66 values (60,'2006-12-17');
+select * from t11 order by col1;
+col1
+2006-07-30
+2006-12-17
+select * from t22 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t55 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+select * from t66 order by colint;
+colint	col1
+1	2006-02-03
+2	2006-01-17
+3	2006-01-25
+4	2006-02-05
+60	2006-12-17
+alter table t11 drop partition p0;
+alter table t22 drop partition p0;
+alter table t44 drop partition p0;
+alter table t55 drop partition p0;
+alter table t66 drop partition p0;
+select * from t11 order by col1;
+col1
+select * from t22 order by col1;
+col1
+select * from t33 order by col1;
+col1
+2006-07-30
+2006-09-25
+2006-12-17
+select * from t44 order by colint;
+colint	col1
+60	2006-12-17
+select * from t55 order by colint;
+colint	col1
+60	2006-12-17
+select * from t66 order by colint;
+colint	col1
+4	2006-02-05
Thread
bk commit into 5.1 tree (hhunger:1.2557)hhunger @ mysql . com5 Apr