summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_max_relay_size.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_relayrotate.test4
-rw-r--r--mysql-test/include/federated.inc5
-rw-r--r--mysql-test/include/federated_cleanup.inc2
-rw-r--r--mysql-test/include/not_embedded.inc2
-rw-r--r--mysql-test/lib/mtr_cases.pl4
-rwxr-xr-xmysql-test/mysql-test-run.pl14
-rw-r--r--mysql-test/r/binlog_statement_insert_delayed.result12
-rw-r--r--mysql-test/r/date_formats.result18
-rw-r--r--mysql-test/r/distinct.result14
-rw-r--r--mysql-test/r/func_sapdb.result6
-rw-r--r--mysql-test/r/func_time.result10
-rw-r--r--mysql-test/r/grant.result123
-rw-r--r--mysql-test/r/information_schema_db.result71
-rw-r--r--mysql-test/r/mysql_protocols.result1
-rw-r--r--mysql-test/r/mysqlbinlog2.result34
-rw-r--r--mysql-test/r/ndb_dd_basic.result7
-rw-r--r--mysql-test/r/ndb_restore.result31
-rw-r--r--mysql-test/r/ps_2myisam.result7
-rw-r--r--mysql-test/r/ps_3innodb.result7
-rw-r--r--mysql-test/r/ps_4heap.result7
-rw-r--r--mysql-test/r/ps_5merge.result14
-rw-r--r--mysql-test/r/ps_7ndb.result7
-rw-r--r--mysql-test/r/row.result18
-rw-r--r--mysql-test/r/rpl_log_pos.result2
-rw-r--r--mysql-test/r/rpl_ndb_basic.result27
-rw-r--r--mysql-test/r/select.result9
-rw-r--r--mysql-test/r/sp-security.result35
-rw-r--r--mysql-test/r/sp.result40
-rw-r--r--mysql-test/r/sp_trans_log.result27
-rw-r--r--mysql-test/r/strict.result7
-rw-r--r--mysql-test/r/subselect.result71
-rw-r--r--mysql-test/r/subselect3.result4
-rw-r--r--mysql-test/r/truncate.result27
-rw-r--r--mysql-test/r/type_date.result26
-rw-r--r--mysql-test/r/type_datetime.result35
-rw-r--r--mysql-test/r/view.result10
-rw-r--r--mysql-test/r/view_grant.result97
-rw-r--r--mysql-test/suite/funcs_1/r/a_version_check.result2
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc93
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc53
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in45
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in4
-rw-r--r--mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc39
-rw-r--r--mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result10887
-rw-r--r--mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result10887
-rw-r--r--mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result13724
-rw-r--r--mysql-test/suite/partitions/r/partition_t55.out68
-rw-r--r--mysql-test/suite/partitions/t/disabled.def2
-rw-r--r--mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test10
-rw-r--r--mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test6
-rw-r--r--mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test40
-rw-r--r--mysql-test/suite/row_lock/include/row_lock.inc83
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab.inc94
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc93
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_trig.inc96
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view.inc89
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_mix.inc92
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_storedp.inc126
-rw-r--r--mysql-test/suite/row_lock/include/row_lock_view_trig.inc99
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_1.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_2.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_3.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_4.result142
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_5.result32
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result97
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result145
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result113
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result151
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result37
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result34
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result48
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result40
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result312
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result47
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result183
-rw-r--r--mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_1.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_2.result31
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_3.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_4.result139
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_5.result30
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result177
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result357
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result255
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result148
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result35
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result194
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result200
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result169
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result38
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result309
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result46
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result180
-rw-r--r--mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result36
-rw-r--r--mysql-test/suite/row_lock/readme.txt9
-rw-r--r--mysql-test/suite/row_lock/summary_of_sel_test.txt36
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_3.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_4.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_5.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test10
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test9
-rw-r--r--mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test9
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_3.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_4.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_5.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test7
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test6
-rw-r--r--mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test6
-rw-r--r--mysql-test/t/date_formats.test2
-rw-r--r--mysql-test/t/disabled.def1
-rw-r--r--mysql-test/t/distinct.test13
-rw-r--r--mysql-test/t/federated_server.test5
-rw-r--r--mysql-test/t/func_sapdb.test2
-rw-r--r--mysql-test/t/grant.test229
-rw-r--r--mysql-test/t/information_schema_db.test55
-rw-r--r--mysql-test/t/myisam-system.test6
-rw-r--r--mysql-test/t/mysqlbinlog2.test8
-rw-r--r--mysql-test/t/ndb_autodiscover.test32
-rw-r--r--mysql-test/t/ndb_dd_basic.test8
-rw-r--r--mysql-test/t/ndb_loaddatalocal.test8
-rw-r--r--mysql-test/t/ndb_restore.test40
-rw-r--r--mysql-test/t/row.test25
-rw-r--r--mysql-test/t/rpl_flushlog_loop.test3
-rw-r--r--mysql-test/t/rpl_loaddatalocal.test4
-rw-r--r--mysql-test/t/rpl_log_pos.test2
-rw-r--r--mysql-test/t/rpl_misc_functions.test4
-rw-r--r--mysql-test/t/rpl_ndb_basic.test31
-rw-r--r--mysql-test/t/rpl_rbr_to_sbr.test4
-rw-r--r--mysql-test/t/rpl_row_NOW.test4
-rw-r--r--mysql-test/t/rpl_row_sp001.test4
-rw-r--r--mysql-test/t/rpl_row_sp011.test4
-rw-r--r--mysql-test/t/select.test13
-rw-r--r--mysql-test/t/show_check.test3
-rw-r--r--mysql-test/t/sp-security.test77
-rw-r--r--mysql-test/t/sp.test64
-rw-r--r--mysql-test/t/sp_trans_log.test43
-rw-r--r--mysql-test/t/strict.test9
-rw-r--r--mysql-test/t/subselect.test37
-rw-r--r--mysql-test/t/subselect3.test3
-rw-r--r--mysql-test/t/truncate.test32
-rw-r--r--mysql-test/t/type_date.test13
-rw-r--r--mysql-test/t/type_datetime.test22
-rw-r--r--mysql-test/t/view.test2
-rw-r--r--mysql-test/t/view_grant.test110
174 files changed, 41035 insertions, 1961 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
index 5b995374ba0..d05fefe916b 100644
--- a/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
+++ b/mysql-test/extra/rpl_tests/rpl_max_relay_size.test
@@ -6,6 +6,9 @@
# Requires statement logging
-- source include/master-slave.inc
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+sync_slave_with_master;
connection slave;
stop slave;
connection master;
diff --git a/mysql-test/extra/rpl_tests/rpl_relayrotate.test b/mysql-test/extra/rpl_tests/rpl_relayrotate.test
index dc91f9e7fff..0d2f25e2b4a 100644
--- a/mysql-test/extra/rpl_tests/rpl_relayrotate.test
+++ b/mysql-test/extra/rpl_tests/rpl_relayrotate.test
@@ -10,6 +10,10 @@
-- source include/master-slave.inc
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+connection master;
+sync_slave_with_master;
connection slave;
stop slave;
connection master;
diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc
index c8e8ededa11..dde24cd8198 100644
--- a/mysql-test/include/federated.inc
+++ b/mysql-test/include/federated.inc
@@ -5,6 +5,11 @@ source ./include/master-slave.inc;
# remote table creation
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+connection master;
+sync_slave_with_master;
+
connection slave;
#--replicate-ignore-db=federated
stop slave;
diff --git a/mysql-test/include/federated_cleanup.inc b/mysql-test/include/federated_cleanup.inc
index 17a6e1e5100..06fd7f6737a 100644
--- a/mysql-test/include/federated_cleanup.inc
+++ b/mysql-test/include/federated_cleanup.inc
@@ -2,10 +2,8 @@ connection master;
--disable_warnings
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
---enable_warnings
connection slave;
---disable_warnings
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
--enable_warnings
diff --git a/mysql-test/include/not_embedded.inc b/mysql-test/include/not_embedded.inc
index fcc1756caab..360f268ad4f 100644
--- a/mysql-test/include/not_embedded.inc
+++ b/mysql-test/include/not_embedded.inc
@@ -1,5 +1,5 @@
-- require r/not_embedded.require
disable_query_log;
-select version() like N'%embedded%' as 'have_embedded';
+select version() like '%embedded%' as 'have_embedded';
enable_query_log;
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 28c78fbffeb..2c563f23e5a 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -534,7 +534,7 @@ sub collect_one_test_case($$$$$$$) {
! ( $tinfo->{'binlog_format'} eq $::used_binlog_format ) )
{
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Not running with binlog format '$tinfo->{'binlog_format'}'";
+ $tinfo->{'comment'}= "Requiring binlog format '$tinfo->{'binlog_format'}'";
return;
}
@@ -599,7 +599,7 @@ our @tags=
(
["include/have_innodb.inc", "innodb_test", 1],
["include/have_binlog_format_row.inc", "binlog_format", "row"],
- ["include/have_binlog_format_statement.inc", "binlog_format", "stmt"],
+ ["include/have_binlog_format_statement.inc", "binlog_format", "statement"],
["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 46938ea7cde..7f775bd0942 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -3278,9 +3278,9 @@ sub do_after_run_mysqltest($)
}
-sub run_testcase_mark_logs($)
+sub run_testcase_mark_logs($$)
{
- my ($log_msg)= @_;
+ my ($tinfo, $log_msg)= @_;
# Write a marker to all log files
@@ -3293,6 +3293,12 @@ sub run_testcase_mark_logs($)
mtr_tofile($mysqld->{path_myerr}, $log_msg);
}
+ if ( $tinfo->{'component_id'} eq 'im')
+ {
+ mtr_tofile($instance_manager->{path_err}, $log_msg);
+ mtr_tofile($instance_manager->{path_log}, $log_msg);
+ }
+
# ndbcluster log file
mtr_tofile($path_ndb_testrun_log, $log_msg);
@@ -3419,7 +3425,7 @@ sub run_testcase ($) {
}
# Write to all log files to indicate start of testcase
- run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n");
+ run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
my $died= mtr_record_dead_children();
if ($died or $master_restart or $slave_restart)
@@ -3493,7 +3499,7 @@ sub run_testcase ($) {
# Stop Instance Manager if we are processing an IM-test case.
# ----------------------------------------------------------------------
if ( $tinfo->{'component_id'} eq 'im' and
- !mtr_im_stop($instance_manager, $tinfo->{'name'}) )
+ !mtr_im_stop($instance_manager, $tinfo->{'name'}))
{
mtr_error("Failed to stop Instance Manager.")
}
diff --git a/mysql-test/r/binlog_statement_insert_delayed.result b/mysql-test/r/binlog_statement_insert_delayed.result
index 7a1b9a7ec9b..3a2dc441632 100644
--- a/mysql-test/r/binlog_statement_insert_delayed.result
+++ b/mysql-test/r/binlog_statement_insert_delayed.result
@@ -3,13 +3,13 @@ set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1;
insert delayed into t1 values (207);
insert delayed into t1 values (null);
insert delayed into t1 values (300);
-show binlog events from 102;
+show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
-master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (207)
-master-bin.000001 # Intvar 1 # INSERT_ID=208
-master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (null)
-master-bin.000001 # Query 1 # use `test`; insert delayed into t1 values (300)
+master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
+master-bin.000001 # Query # # use `test`; insert delayed into t1 values (207)
+master-bin.000001 # Intvar # # INSERT_ID=208
+master-bin.000001 # Query # # use `test`; insert delayed into t1 values (null)
+master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300)
insert delayed into t1 values (null),(null),(null),(null);
insert delayed into t1 values (null),(null),(400),(null);
11 == 11
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 9d8de75fe60..7375260d863 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -91,6 +91,8 @@ create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
@@ -122,6 +124,8 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
date format str_to_date
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
@@ -153,6 +157,8 @@ select date,format,concat('',str_to_date(date, format)) as con from t1;
date format con
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
@@ -184,6 +190,8 @@ select date,format,cast(str_to_date(date, format) as datetime) as datetime from
date format datetime
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
@@ -215,6 +223,8 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1;
date format date2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 2003-01-02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 0003-01-02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 2003-01-02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 2003-01-02
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02
@@ -246,6 +256,8 @@ select date,format,TIME(str_to_date(date, format)) as time from t1;
date format time
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
@@ -277,6 +289,8 @@ select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
date format time2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
03-01-02 8:11:2.123456 %y-%m-%d %H:%i:%S.%# 08:11:02
+0003-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
+03-01-02 8:11:2.123456 %Y-%m-%d %H:%i:%S.%# 08:11:02
2003-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 22:11:12
2003-01-02 01:11:12.12345AM %Y-%m-%d %h:%i:%S.%f%p 01:11:12.123450
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
@@ -402,14 +416,14 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
date format str_to_date
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
-03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
+03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
Warnings:
Warning 1292 Incorrect datetime value: '10:20:10AM'
select date,format,concat(str_to_date(date, format),'') as con from t1;
date format con
10:20:10AM %h:%i:%s 0000-00-00 10:20:10
2003-01-02 10:11:12 %Y-%m-%d %h:%i:%S 2003-01-02 10:11:12
-03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 0003-01-02 22:11:12
+03-01-02 10:11:12 PM %Y-%m-%d %h:%i:%S %p 2003-01-02 22:11:12
Warnings:
Warning 1292 Incorrect datetime value: '10:20:10AM'
drop table t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 109ddcd02e1..20538694218 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -668,3 +668,17 @@ NULL
3
4
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
+SELECT DISTINCT a, b FROM t1;
+a b
+1 1
+1 2
+1 3
+SELECT DISTINCT a, a, b FROM t1;
+a a b
+1 1 1
+1 1 2
+1 1 3
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index 124b20e9b46..b7dbfc670a8 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -75,6 +75,12 @@ NULL
select weekofyear("1997-11-30 23:59:59.000001");
weekofyear("1997-11-30 23:59:59.000001")
48
+select makedate(03,1);
+makedate(03,1)
+2003-01-01
+select makedate('0003',1);
+makedate('0003',1)
+2003-01-01
select makedate(1997,1);
makedate(1997,1)
1997-01-01
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 16a1e5d01d7..2d59a32218c 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1225,13 +1225,13 @@ TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s")
End of 5.0 tests
select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND)
-NULL
+0049-12-31 23:59:59
select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND)
-NULL
+0198-12-31 23:59:59
select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND)
-NULL
+0200-01-01 00:00:01
select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND)
0199-12-31 23:59:59
@@ -1252,8 +1252,8 @@ date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND)
1989-12-31 23:59:59
select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
-NULL
+0068-12-31 23:59:59
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
-NULL
+0168-12-31 23:59:59
End of 5.1 tests
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 2ac5953c456..f82e52d6370 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1,3 +1,4 @@
+SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
drop database if exists mysqltest;
SET NAMES binary;
@@ -1059,6 +1060,128 @@ DROP DATABASE bug23556;
DROP USER bug23556@localhost;
GRANT PROCESS ON * TO user@localhost;
ERROR 3D000: No database selected
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+DROP DATABASE IF EXISTS mysqltest4;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE DATABASE mysqltest3;
+CREATE DATABASE mysqltest4;
+CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
+SELECT 1;
+CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
+SELECT 1;
+CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
+RETURN 1;
+CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
+RETURN 1;
+GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
+GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
+
+---> connection: bug9504_con1
+use mysqltest1;
+use mysqltest2;
+use mysqltest3;
+use mysqltest4;
+use test;
+CALL mysqltest1.p_def();
+1
+1
+CALL mysqltest2.p_inv();
+1
+1
+SELECT mysqltest3.f_def();
+mysqltest3.f_def()
+1
+SELECT mysqltest4.f_inv();
+mysqltest4.f_inv()
+1
+
+---> connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP DATABASE mysqltest3;
+DROP DATABASE mysqltest4;
+DROP USER mysqltest_1@localhost;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost;
+CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER
+SELECT 1;
+
+---> connection: bug27337_con1
+CREATE TABLE t1(c INT);
+ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
+CALL mysqltest1.p1();
+1
+1
+CREATE TABLE t1(c INT);
+ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
+
+---> connection: bug27337_con2
+CREATE TABLE t1(c INT);
+ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1'
+SHOW TABLES;
+Tables_in_mysqltest2
+
+---> connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_1@localhost;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest1.t1(c INT);
+CREATE TABLE mysqltest2.t2(c INT);
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost;
+
+---> connection: bug27337_con1
+SHOW TABLES FROM mysqltest1;
+Tables_in_mysqltest1
+t1
+PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1';
+EXECUTE stmt1;
+Tables_in_mysqltest1
+t1
+
+---> connection: bug27337_con2
+SHOW COLUMNS FROM mysqltest2.t2;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2';
+EXECUTE stmt2;
+Field Type Null Key Default Extra
+c int(11) YES NULL
+
+---> connection: default
+REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost;
+
+---> connection: bug27337_con1
+SHOW TABLES FROM mysqltest1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1'
+EXECUTE stmt1;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1'
+
+---> connection: bug27337_con2
+SHOW COLUMNS FROM mysqltest2.t2;
+ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
+EXECUTE stmt2;
+ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
+
+---> connection: default
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_1@localhost;
End of 5.0 tests
set names utf8;
grant select on test.* to юзер_юзер@localhost;
diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result
index 2a6a3e6e0fb..94ebc213122 100644
--- a/mysql-test/r/information_schema_db.result
+++ b/mysql-test/r/information_schema_db.result
@@ -117,16 +117,82 @@ use testdb_1;
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
+create view v5 as select f1 from t1;
+grant show view on v5 to testdb_2@localhost;
+create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
+ERROR 42000: Access denied; you need the SUPER privilege for this operation
+use testdb_1;
+create view v6 as select f1 from t1;
+grant show view on v6 to testdb_2@localhost;
+create table t2 (f1 char(4));
+create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
+Warnings:
+Note 1449 There is no 'no_such_user'@'no_such_host' registered
+show fields from testdb_1.v6;
+Field Type Null Key Default Extra
+f1 char(4) YES NULL
+show create view testdb_1.v6;
+View Create View
+v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1`
+show create view testdb_1.v7;
+View Create View
+v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
+Warnings:
+Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+show fields from testdb_1.v7;
+Field Type Null Key Default Extra
+f1 null YES NULL
+Warnings:
+Note 1449 There is no 'no_such_user'@'no_such_host' registered
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
+show fields from testdb_1.v5;
+Field Type Null Key Default Extra
+f1 char(4) YES NULL
+show create view testdb_1.v5;
+View Create View
+v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
+show fields from testdb_1.v6;
+Field Type Null Key Default Extra
+f1 char(4) YES NULL
+show create view testdb_1.v6;
+View Create View
+v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
+show fields from testdb_1.v7;
+Field Type Null Key Default Extra
+f1 null YES NULL
+Warnings:
+Note 1449 There is no 'no_such_user'@'no_such_host' registered
+show create view testdb_1.v7;
+View Create View
+v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
+Warnings:
+Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
revoke insert(f1) on v3 from testdb_2@localhost;
+revoke show view on v5 from testdb_2@localhost;
+use testdb_1;
+revoke show view on v6 from testdb_2@localhost;
+show fields from testdb_1.v5;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
+show create view testdb_1.v5;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
+show fields from testdb_1.v6;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
+show create view testdb_1.v6;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
+show fields from testdb_1.v7;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
+show create view testdb_1.v7;
+ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
show create view v4;
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
show fields from v4;
-ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
+Field Type Null Key Default Extra
+f1 null YES NULL
+f2 char(4) YES NULL
show fields from v2;
Field Type Null Key Default Extra
f1 char(4) YES NULL
@@ -151,7 +217,8 @@ where a.table_name = 'testdb_1.v1';
view_definition
select * from v2;
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
-drop view testdb_1.v1,v2, testdb_1.v3, v4;
+use test;
+drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
diff --git a/mysql-test/r/mysql_protocols.result b/mysql-test/r/mysql_protocols.result
index cbead9254a2..c6207c4f4f5 100644
--- a/mysql-test/r/mysql_protocols.result
+++ b/mysql-test/r/mysql_protocols.result
@@ -7,3 +7,4 @@ SOCKET
ERROR 2047 (HY000): Wrong or unknown protocol
ERROR 2047 (HY000): Wrong or unknown protocol
Unknown option to protocol: NullS
+Alternatives are: 'TCP','SOCKET','PIPE','MEMORY'
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index e76ab71fd54..ef6e4ee80fd 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -122,6 +122,23 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+--- start and stop positions ---
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+SET INSERT_ID=4/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1579609946/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+insert into t1 values(null, "d")/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
@@ -482,6 +499,23 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+--- start and stop positions ---
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+SET INSERT_ID=4/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1579609946/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+insert into t1 values(null, "d")/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
diff --git a/mysql-test/r/ndb_dd_basic.result b/mysql-test/r/ndb_dd_basic.result
index 470c2cb9c0e..7aeb156869b 100644
--- a/mysql-test/r/ndb_dd_basic.result
+++ b/mysql-test/r/ndb_dd_basic.result
@@ -468,6 +468,13 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x');
delete from t1 where a = 0;
commit;
+delete from t1;
+begin;
+insert into t1 values (1, 'x');
+select * from t1;
+a b
+1 x
+rollback;
set autocommit = 1;
drop table t1;
create table test.t1 (f1 varchar(50) primary key, f2 text,f3 int)
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index b946d97bea1..b57fc2e14ba 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -2,12 +2,12 @@ use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
CREATE TABLE `t1_c` (
-`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+`capgoaledatta` mediumint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
`maturegarbagefa` varchar(32) NOT NULL default '',
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
-INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(400,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3000,'20','threetrees.qt');
CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
@@ -16,9 +16,9 @@ CREATE TABLE `t2_c` (
`descrpooppo` varchar(64) default NULL,
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
-KEY `i_quadaddsvr` (`gotod`)
+KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
-INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0',
@@ -36,7 +36,7 @@ PRIMARY KEY (`fa`,`realm`),
KEY `capfa` (`capfa`),
KEY `i_quadentity` (`fa`,`realm`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
-INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(2200,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32000,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(290000000,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
CREATE TABLE `t5_c` (
`capfa` bigint(20) unsigned NOT NULL default '0',
`gotod` smallint(5) unsigned NOT NULL default '0',
@@ -53,7 +53,7 @@ PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '',
-`dardtestard` tinyint(3) unsigned NOT NULL default '0',
+`dardtestard` tinyint(3) unsigned NOT NULL auto_increment,
`FastFA` char(5) NOT NULL default '',
`FastCode` char(6) NOT NULL default '',
`Fastca` char(1) NOT NULL default '',
@@ -118,6 +118,7 @@ PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
CREATE TABLE t10_c (a INT AUTO_INCREMENT KEY) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO t10_c VALUES (1),(2),(3);
+insert into t10_c values (10000),(2000),(3000);
create table t1 engine=myisam as select * from t1_c;
create table t2 engine=myisam as select * from t2_c;
create table t3 engine=myisam as select * from t3_c;
@@ -240,6 +241,24 @@ a
1
2
3
+2000
+3000
+10000
+show table status like 't1_c';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+X X X X X X X X X X 3001 X X X X X X X
+show table status like 't2_c';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+X X X X X X X X X X 501 X X X X X X X
+show table status like 't4_c';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+X X X X X X X X X X 290000001 X X X X X X X
+show table status like 't7_c';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+X X X X X X X X X X 29 X X X X X X X
+show table status like 't10_c';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+X X X X X X X X X X 10001 X X X X X X X
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index af7a762c5a8..d18bb8dc434 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -2961,20 +2961,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -3005,6 +3011,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 8c0b9f1e19b..e6ff668760c 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -2944,20 +2944,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index 7ad6e3ea722..046992806cc 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -2945,20 +2945,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2989,6 +2995,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 1e2c27e6e4f..bbdb80df5d4 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -2881,20 +2881,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2925,6 +2931,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
@@ -5895,20 +5902,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -5939,6 +5952,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index e43f6b4ed6c..20d38ba84bd 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -2944,20 +2944,26 @@ delete from t9 ;
test_sequence
-- insert into date/time columns --
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c17' at row 1
Warnings:
Warning 1264 Out of range value for column 'c13' at row 1
@@ -2988,6 +2994,7 @@ Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
Warnings:
+Note 1265 Data truncated for column 'c13' at row 1
Warning 1265 Data truncated for column 'c15' at row 1
Warning 1264 Out of range value for column 'c16' at row 1
Warning 1264 Out of range value for column 'c17' at row 1
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 26d616df2f3..e6dea211fdc 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -175,6 +175,24 @@ ROW(2,10) <=> ROW(3,4)
SELECT ROW(NULL,10) <=> ROW(3,NULL);
ROW(NULL,10) <=> ROW(3,NULL)
0
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
+ERROR 21000: Operand should contain 3 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
+ERROR 21000: Operand should contain 2 column(s)
+SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
+ERROR 21000: Operand should contain 1 column(s)
+SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
+ERROR 21000: Operand should contain 1 column(s)
SELECT ROW(1,1,1) = ROW(1,1,1) as `1`, ROW(1,1,1) = ROW(1,2,1) as `0`, ROW(1,NULL,1) = ROW(2,2,1) as `0`, ROW(1,NULL,1) = ROW(1,2,2) as `0`, ROW(1,NULL,1) = ROW(1,2,1) as `null` ;
1 0 0 0 null
1 0 0 0 NULL
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index 60fba96fb6a..28ddbaf33a0 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -27,7 +27,7 @@ change master to master_log_pos=178;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 # Yes 0 0 178 # None 0 No # No
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 <Binlog_Ignore_DB>
diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result
index 9a99ddd2137..4dab05b31de 100644
--- a/mysql-test/r/rpl_ndb_basic.result
+++ b/mysql-test/r/rpl_ndb_basic.result
@@ -24,6 +24,33 @@ nid nom prenom
select * from t1 order by nid;
nid nom prenom
1 XYZ2 ABC2
+delete from t1;
+insert into t1 values(1,"AA", "AA");
+insert into t1 values(2,"BB", "BB");
+insert into t1 values(3,"CC", "CC");
+insert into t1 values(4,"DD", "DD");
+begin;
+delete from t1 where nid = 1;
+insert into t1 values (1,"A2", "A2");
+update t1 set nom="B2" where nid = 2;
+delete from t1 where nid = 2;
+update t1 set nom = "D2" where nid = 4;
+delete from t1 where nid = 4;
+insert into t1 values (4, "D3", "D3");
+update t1 set nom = "D4" where nid = 4;
+insert into t1 values (5, "EE", "EE");
+delete from t1 where nid = 5;
+commit;
+select * from t1 order by 1;
+nid nom prenom
+1 A2 A2
+3 CC CC
+4 D4 D3
+select * from t1 order by 1;
+nid nom prenom
+1 A2 A2
+3 CC CC
+4 D4 D3
DROP table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index f88f046f0ac..6ffb769292f 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3971,4 +3971,13 @@ t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
faq_id
265
DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, b INT, KEY inx (b,a));
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7);
+EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
+ON ( f1.b=f2.b AND f1.a<f2.a )
+WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE f1 index inx inx 10 NULL 7 Using where; Using index
+1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where; Using index
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index b2fdf6a864e..7315ef40083 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -8,22 +8,29 @@ create procedure db1_secret.dummy() begin end;
drop procedure db1_secret.dummy;
use db1_secret;
create table t1 ( u varchar(64), i int );
+insert into t1 values('test', 0);
create procedure stamp(i int)
insert into db1_secret.t1 values (user(), i);
show procedure status like 'stamp';
Db Name Type Definer Modified Created Security_type Comment
db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
-create function db() returns varchar(64) return database();
+create function db() returns varchar(64)
+begin
+declare v varchar(64);
+select u into v from t1 limit 1;
+return v;
+end|
show function status like 'db';
Db Name Type Definer Modified Created Security_type Comment
db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call stamp(1);
select * from t1;
u i
+test 0
root@localhost 1
select db();
db()
-db1_secret
+test
grant execute on procedure db1_secret.stamp to user1@'%';
grant execute on function db1_secret.db to user1@'%';
grant execute on procedure db1_secret.stamp to ''@'%';
@@ -31,25 +38,34 @@ grant execute on function db1_secret.db to ''@'%';
call db1_secret.stamp(2);
select db1_secret.db();
db1_secret.db()
-db1_secret
+test
select * from db1_secret.t1;
ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+drop procedure db1_secret.stamp;
+ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.stamp'
+drop function db1_secret.db;
+ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db1_secret.db'
call db1_secret.stamp(3);
select db1_secret.db();
db1_secret.db()
-db1_secret
+test
select * from db1_secret.t1;
ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
create procedure db1_secret.dummy() begin end;
ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
+drop procedure db1_secret.stamp;
+ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.stamp'
+drop function db1_secret.db;
+ERROR 42000: alter routine command denied to user ''@'%' for routine 'db1_secret.db'
select * from t1;
u i
+test 0
root@localhost 1
user1@localhost 2
anon@localhost 3
@@ -64,21 +80,22 @@ db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 IN
call stamp(4);
select * from t1;
u i
+test 0
root@localhost 1
user1@localhost 2
anon@localhost 3
root@localhost 4
select db();
db()
-db1_secret
+test
call db1_secret.stamp(5);
-ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
+ERROR 42000: INSERT command denied to user 'user1'@'localhost' for table 't1'
select db1_secret.db();
-ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
+ERROR 42000: SELECT command denied to user 'user1'@'localhost' for table 't1'
call db1_secret.stamp(6);
-ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
+ERROR 42000: INSERT command denied to user ''@'localhost' for table 't1'
select db1_secret.db();
-ERROR 42000: Access denied for user ''@'%' to database 'db1_secret'
+ERROR 42000: SELECT command denied to user ''@'localhost' for table 't1'
drop database if exists db2;
create database db2;
use db2;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 312bb6857a5..44abc11029a 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -6061,6 +6061,21 @@ SUM(f2) bug25373(f1)
21.300000071526 NULL
DROP FUNCTION bug25373|
DROP TABLE t3|
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+CREATE DATABASE mysqltest1|
+CREATE DATABASE mysqltest2|
+CREATE PROCEDURE mysqltest1.p1()
+DROP DATABASE mysqltest2|
+use mysqltest2|
+CALL mysqltest1.p1()|
+Warnings:
+Note 1049 Unknown database 'mysqltest2'
+SELECT DATABASE()|
+DATABASE()
+NULL
+DROP DATABASE mysqltest1|
+use test|
drop function if exists bug20777|
drop table if exists examplebug20777|
create function bug20777(f1 bigint unsigned) returns bigint unsigned
@@ -6147,3 +6162,28 @@ bug20777(18446744073709551613)+1
drop function bug20777;
End of 5.0 tests.
drop table t1,t2;
+CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
+CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
+set @a=0;
+CREATE function bug27354() RETURNS int deterministic
+begin
+insert into t1 values (null);
+set @a=@a+1;
+return @a;
+end|
+update t2 set b=1 where a=bug27354();
+select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
+count(t_1.a) count(t_2.a)
+0 0
+insert into t2 values (1,1),(2,2),(3,3);
+update t2 set b=-b where a=bug27354();
+select * from t2 /* must return 1,-1 ... */;
+a b
+1 -1
+2 -2
+3 -3
+select count(*) from t1 /* must be 3 */;
+count(*)
+3
+drop table t1,t2;
+drop function bug27354;
diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result
new file mode 100644
index 00000000000..a835b06858b
--- /dev/null
+++ b/mysql-test/r/sp_trans_log.result
@@ -0,0 +1,27 @@
+drop function if exists bug23333|
+drop table if exists t1,t2|
+CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
+CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
+insert into t2 values (1,1)|
+create function bug23333()
+RETURNS int(11)
+DETERMINISTIC
+begin
+insert into t1 values (null);
+select count(*) from t1 into @a;
+return @a;
+end|
+reset master|
+insert into t2 values (bug23333(),1)|
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+show binlog events from 106 /* with fixes for #23333 will show there is the query */|
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Table_map 1 # #
+master-bin.000001 # Write_rows 1 # #
+master-bin.000001 # Query 1 # #
+select count(*),@a from t1 /* must be 1,1 */|
+count(*) @a
+1 1
+drop table t1,t2;
+drop function if exists bug23333;
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 74cd723e130..94f4637cd05 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -206,6 +206,8 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+Warnings:
+Note 1265 Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -1386,4 +1388,9 @@ ERROR 01000: Data truncated for column 'a' at row 1
insert into t1 values ('2E3x');
ERROR 01000: Data truncated for column 'a' at row 1
drop table t1;
+set sql_mode='traditional';
+create table t1 (f1 set('a','a'));
+ERROR HY000: Column 'f1' has duplicated value 'a' in SET
+create table t1 (f1 enum('a','a'));
+ERROR HY000: Column 'f1' has duplicated value 'a' in ENUM
End of 5.0 tests
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 089fb10aaae..8263350fe58 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -48,7 +48,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1276 Field or reference 'a' of SELECT #3 was resolved in SELECT #1
+Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
Note 1003 select 1 AS `1` from (select 1 AS `a`) `b` having ((select '1' AS `a`) = 1)
SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
@@ -330,7 +330,7 @@ patient_uq clinic_uq
explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t6 ALL NULL NULL NULL NULL 4 100.00 Using where
-2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 t6.clinic_uq 1 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
Warnings:
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 AS `Not_used` from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
@@ -1741,7 +1741,7 @@ Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `tes
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
-2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 tt.id 1 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
Warnings:
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
@@ -3924,6 +3924,71 @@ c a (SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
3 3 4
1 4 2,2
DROP table t1,t2;
+CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
+(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
+(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
+SELECT a, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+FROM t1 GROUP BY a;
+a MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT a x, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
+FROM t1 GROUP BY a;
+x MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT a, AVG(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
+FROM t1 WHERE t1.d=0 GROUP BY a;
+a AVG(b) test
+1 4.0000 d
+2 2.0000 g
+3 2.5000 NULL
+SELECT tt.a,
+(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 as tt;
+a test
+1 n
+1 n
+1 n
+1 n
+1 n
+1 n
+1 n
+2 o
+2 o
+2 o
+2 o
+3 p
+3 p
+3 p
+3 p
+3 p
+SELECT tt.a,
+(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1)
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 as tt GROUP BY tt.a;
+a test
+1 n
+2 o
+3 p
+SELECT tt.a, MAX(
+(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1)
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+FROM t1 as tt GROUP BY tt.a;
+a test
+1 n
+2 o
+3 p
+DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 4b8ece1c931..18feb7cb6b9 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -432,7 +432,7 @@ alter table t1 add index idx(oref,ie);
explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 7
-2 DEPENDENT SUBQUERY t1 ref_or_null idx idx 10 t2.oref,func 4 Using where; Using index; Full scan on NULL key
+2 DEPENDENT SUBQUERY t1 ref_or_null idx idx 10 test.t2.oref,func 4 Using where; Using index; Full scan on NULL key
select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
oref a Z
ee NULL NULL
@@ -457,7 +457,7 @@ group by grp having min(ie) > 1) Z
from t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 7
-2 DEPENDENT SUBQUERY t1 ref idx idx 5 t2.oref 2 Using where; Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t1 ref idx idx 5 test.t2.oref 2 Using where; Using temporary; Using filesort
select oref, a,
a in (select min(ie) from t1 where oref=t2.oref
group by grp having min(ie) > 1) Z
diff --git a/mysql-test/r/truncate.result b/mysql-test/r/truncate.result
index 74a6cb72cc6..6c21db0e2b8 100644
--- a/mysql-test/r/truncate.result
+++ b/mysql-test/r/truncate.result
@@ -53,3 +53,30 @@ a
3
4
drop table t1;
+create table t1 (s1 int);
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v1 as select * from t1;
+truncate table v1;
+select count(*) from t1;
+count(*)
+0
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v2 as select * from t1 where s1 > 3;
+truncate table v2;
+select * from t1;
+s1
+1
+2
+3
+select * from v2;
+s1
+delete from t1;
+create table t2 (s1 int, s2 int);
+create view v3 as select a.s1, b.s2 from t1 a join t2 b on a.s1 = b.s1 where a.s1 > 3;
+truncate table v3;
+ERROR HY000: Can not delete from join view 'test.v3'
+create view v4 as select * from t1 limit 1,1;
+truncate table v4;
+ERROR HY000: The target table v4 of the TRUNCATE is not updatable
+drop view v1, v2, v3, v4;
+drop table t1, t2;
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 644d4d971c6..6d5218873ce 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -110,3 +110,29 @@ select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_dat
1
1
drop table t1;
+select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
+@d:=1111 year(@d) month(@d) day(@d) cast(@d as date)
+1111 2000 11 11 2000-11-11
+select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
+@d:=011111 year(@d) month(@d) day(@d) cast(@d as date)
+11111 2001 11 11 2001-11-11
+select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
+@d:=1311 year(@d) month(@d) day(@d) cast(@d as date)
+1311 NULL NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '1311'
+Warning 1292 Incorrect datetime value: '1311'
+Warning 1292 Incorrect datetime value: '1311'
+Warning 1292 Incorrect datetime value: '1311'
+create table t1 (d date , dt datetime , ts timestamp);
+insert into t1 values (9912101,9912101,9912101);
+Warnings:
+Warning 1264 Out of range value for column 'd' at row 1
+Warning 1264 Out of range value for column 'dt' at row 1
+Warning 1265 Data truncated for column 'ts' at row 1
+insert into t1 values (11111,11111,11111);
+select * from t1;
+d dt ts
+0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00
+2001-11-11 2001-11-11 00:00:00 2001-11-11 00:00:00
+drop table t1;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index e40ec689127..045a6cd1c0a 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -192,3 +192,38 @@ CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMA
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6))
101112.098700
+set @org_mode=@@sql_mode;
+create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `da` date DEFAULT '1962-03-03',
+ `dt` datetime DEFAULT '1962-03-03 00:00:00'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ();
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+set @@sql_mode='ansi,traditional';
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+insert into t1 set dt='2007-03-23 13:49:38',da=dt;
+Warnings:
+Note 1265 Data truncated for column 'da' at row 1
+insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
+ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1
+select * from t1;
+da dt
+1962-03-03 1962-03-03 00:00:00
+2007-03-23 2007-03-23 13:49:38
+2007-03-23 2007-03-23 13:49:38
+2007-03-23 2007-03-23 13:49:38
+drop table t1;
+create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
+ERROR 42000: Invalid default value for 'da'
+create table t1 (t time default '916:00:00 a');
+ERROR 42000: Invalid default value for 't'
+set @@sql_mode= @org_mode;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 0fa7cda1187..a542d3270a2 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2385,6 +2385,16 @@ Table Op Msg_type Msg_text
test.v1 optimize error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
+ANALYZE TABLE v1;
+Table Op Msg_type Msg_text
+test.v1 analyze error 'test.v1' is not BASE TABLE
+Warnings:
+Error 1347 'test.v1' is not BASE TABLE
+REPAIR TABLE v1;
+Table Op Msg_type Msg_text
+test.v1 repair error 'test.v1' is not BASE TABLE
+Warnings:
+Error 1347 'test.v1' is not BASE TABLE
DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1;
show create view v1;
diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result
index 2a0bedc1443..51d131f0044 100644
--- a/mysql-test/r/view_grant.result
+++ b/mysql-test/r/view_grant.result
@@ -284,15 +284,6 @@ create view mysqltest.v3 as select b from mysqltest.t2;
grant create view, update on mysqltest.v3 to mysqltest_1@localhost;
drop view mysqltest.v3;
create view mysqltest.v3 as select b from mysqltest.t2;
-grant create view, update, insert on mysqltest.v3 to mysqltest_1@localhost;
-drop view mysqltest.v3;
-create view mysqltest.v3 as select b from mysqltest.t2;
-ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 'v3'
-create table mysqltest.v3 (b int);
-grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
-drop table mysqltest.v3;
-create view mysqltest.v3 as select b from mysqltest.t2;
-ERROR 42000: create view command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 'v3'
create view v4 as select b+1 from mysqltest.t2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't2'
grant create view,update,select on test.* to mysqltest_1@localhost;
@@ -796,6 +787,94 @@ View Create View
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1`
DROP USER u26813@localhost;
DROP DATABASE db26813;
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE TABLE mysqltest1.t1(c1 INT);
+CREATE TABLE mysqltest1.t2(c2 INT);
+CREATE TABLE mysqltest1.t3(c3 INT);
+CREATE TABLE mysqltest1.t4(c4 INT);
+INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
+INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
+INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
+INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
+GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
+GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
+GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
+GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
+
+---> connection: bug24040_con
+SELECT * FROM mysqltest1.t1;
+c1
+11
+12
+13
+14
+INSERT INTO mysqltest1.t2 VALUES(25);
+UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
+DELETE FROM mysqltest1.t4 WHERE c4 = 44;
+CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
+CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
+CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
+SELECT * FROM v1;
+c1
+11
+12
+13
+14
+INSERT INTO v2 VALUES(26);
+UPDATE v3 SET c3 = 332 WHERE c3 = 32;
+DELETE FROM v4 WHERE c4 = 43;
+CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v12'
+CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
+CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
+CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c1' in table 'v21'
+CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c3' in table 'v23'
+CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c4' in table 'v24'
+CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
+CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v32'
+CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
+CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
+CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
+ERROR 42000: create view command denied to user 'mysqltest_u1'@'localhost' for column 'c2' in table 'v42'
+CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
+
+---> connection: default
+SELECT * FROM mysqltest1.t1;
+c1
+11
+12
+13
+14
+SELECT * FROM mysqltest1.t2;
+c2
+21
+22
+23
+24
+25
+26
+SELECT * FROM mysqltest1.t3;
+c3
+331
+332
+33
+34
+SELECT * FROM mysqltest1.t4;
+c4
+41
+42
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_u1@localhost;
End of 5.0 tests.
DROP VIEW IF EXISTS v1;
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/funcs_1/r/a_version_check.result b/mysql-test/suite/funcs_1/r/a_version_check.result
index 1569c40e4e5..da6ba0846fd 100644
--- a/mysql-test/suite/funcs_1/r/a_version_check.result
+++ b/mysql-test/suite/funcs_1/r/a_version_check.result
@@ -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 ' '
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc
index f74fce39a7d..b2e102f8e07 100644
--- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs.inc
@@ -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 ($val1);
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);
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval load data infile '$MYSQL_TEST_DIR/suite/partitions/include/$infile' into table t5;
-eval insert into t6 values (1,$val2);
-eval insert into t6 values (2,$val3);
+--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;
+eval select $sqlfunc from t1 order by col1;
-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;
if ($do_long_tests)
{
@@ -111,12 +110,12 @@ if ($do_long_tests)
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 by range(colint)
(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 @@ if ($do_long_tests)
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 ;
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc
index c733d750fab..76e8bd6dcc6 100644
--- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_delete.inc
@@ -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 $t4 where col1=$val2;
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 insert into $t4 values (60,$val2);
+eval insert into $t5 values (60,$val2);
+eval insert into $t6 values (60,$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 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 $t4 drop partition p0;
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;
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in
new file mode 100644
index 00000000000..8ae6e5fc807
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in
@@ -0,0 +1,4 @@
+1 1
+2 9
+3 3
+4 8 \ No newline at end of file
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in
new file mode 100644
index 00000000000..9eb41fb007b
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_date.in
@@ -0,0 +1,4 @@
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05 \ No newline at end of file
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in
new file mode 100644
index 00000000000..34d8b1d1c4d
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_float.in
@@ -0,0 +1,4 @@
+1 5.1230
+2 13.345
+3 17.987
+4 15.654
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in
new file mode 100644
index 00000000000..d2f5c82a241
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_int.in
@@ -0,0 +1,45 @@
+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 \ No newline at end of file
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in
new file mode 100644
index 00000000000..941ba418f32
--- /dev/null
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_int_time.in
@@ -0,0 +1,4 @@
+1 09:09:15.000002
+2 04:30:01.000018
+3 00:59:22.000024
+4 05:30:34.000037
diff --git a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc
index ccfdd7a2ece..b0ec63d39a9 100644
--- a/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc
+++ b/mysql-test/suite/partitions/include/partition_supported_sql_funcs_main.inc
@@ -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 $val4 = 15 ;
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 $val4 = '8';
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 $val4 = 15.654 ;
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 $val4 = 15.654 ;
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 $val4 = 15 ;
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 $val4 = '8';
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 $val4 = '2006-02-05';
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 $val4 = '2006-02-05';
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 $val4 = '2006-02-05';
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 $coltype = char(30);
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 $val4 = '2006-02-05';
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 $val4 = '10:30';
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 $val4 = '10:24:23';
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 $coltype = char(30);
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 $val4 = '2006-11-06';
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 $val4 = '2006-07-30';
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 $val4 = '10:33:11';
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 $val4 = '2006-02-06';
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 $val4 = '2006-02-06';
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 $val4 = '2006-09-06';
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 $val4 = '2002-02-15';
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';
diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result
index bb25ac5fc73..196f7930bb0 100644
--- a/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result
+++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_innodb.result
@@ -55,44 +55,329 @@ insert into t2 values (17 );
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 @@ alter table t66
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
+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
+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 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
-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
+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 5
+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
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13
-2 17
+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 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 t2 values ('3');
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
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+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 9
-2 3
+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 ascii(col1)
-------------------------------------------------------------------------
@@ -325,33 +1857,311 @@ alter table t66
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 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 1
+1 8
2 9
-select * from t55;
+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 1
+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
+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
-select * from t66;
+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 9
-2 3
+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
+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 t2 values (17.987);
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
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+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 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(ceiling(col1) as signed integer)
-------------------------------------------------------------------------
@@ -508,33 +2357,309 @@ alter table t66
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
-select * from t66;
+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 13.3450
-2 17.9870
+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
+-------------------------------------------------------------------------
+--- 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 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 t2 values (17.987);
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
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+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 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(floor(col1) as signed)
-------------------------------------------------------------------------
@@ -691,33 +2855,309 @@ alter table t66
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
+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
-select * from t66;
+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 13.3450
-2 17.9870
+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
+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 t2 values (17);
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
19.0000
+select * from t3 order by col1;
+col1
+15.0000
17.0000
-select * from t4;
+19.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t5;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
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 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 @@ alter table t66
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 t44;
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t55;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
-1 5.0000
-2 19.0000
-3 17.0000
-select * from t66;
+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
+19.0000
+select * from t44 order by colint;
+colint col1
+60 19.0000
+select * from t55 order by colint;
+colint col1
+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 t2 values ('3');
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
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+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 9
-2 3
+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 @@ alter table t66
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 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 1
+1 8
2 9
-select * from t55;
+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 1
+1 8
2 9
3 3
-select * from t66;
+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
+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 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
-1 9
-2 3
+-------------------------------------------------------------------------
+--- 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 t2 values ('2006-01-25');
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
+3 2006-01-25
+4 2006-02-05
+select * from t5 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 t6 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
3 2006-01-25
-select * from t6;
+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-01-17
-2 2006-01-25
+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 @@ alter table t66
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
-select * from t66;
+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
+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-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
-1 2006-01-17
-2 2006-01-25
+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 t2 values ('2006-01-25');
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 @@ alter table t66
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
-select * from t66;
+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
+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 t2 values ('2006-01-25');
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 @@ alter table t66
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
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t55;
+60 2006-02-17
+select * from t5 order by colint;
colint col1
-2 2006-02-17
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+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
+-------------------------------------------------------------------------
+--- 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-17
-2 2006-01-25
+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
+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
+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
+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
+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 t2 values ('2006-02-25');
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
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 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
+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-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 @@ alter table t66
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-01-17
-2 2006-02-25
+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
+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 t2 values ('2006-02-25');
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
+3 2006-01-25
+4 2006-02-05
+select * from t5 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 t6 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
+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-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
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 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
-------------------------------------------------------------------------
--- Alter tables with dayofyear(col1)
-------------------------------------------------------------------------
@@ -1972,33 +6349,309 @@ alter table t66
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-01-17
-2 2006-02-25
+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-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
+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 t2 values ('2006-01-25');
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 @@ alter table t66
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
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 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 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 t66;
+4 2006-02-05
+60 2006-02-17
+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
+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
+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
+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
+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
+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 t2 values ('21:59');
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
-2 14:30:00
-1 09:09:00
-select * from t5;
+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
-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
+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 14:30:00
-2 21:59:00
+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 hour(col1)
-------------------------------------------------------------------------
@@ -2338,33 +7345,315 @@ alter table t66
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 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: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;
+select * from t44 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-select * from t55;
+60 14:30:00
+select * from t55 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-3 21:59:00
-select * from t66;
+60 14:30:00
+select * from t66 order by colint;
colint col1
-1 14:30:00
-2 21:59:00
+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 t2 values ('00:59:22.000024');
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 @@ alter table t66
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 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 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 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 09:09:15
+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
-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
+-------------------------------------------------------------------------
+--- 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 04:30:01
-2 00:59:22
+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 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 t2 values ('21:59:22');
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 14:30:45
-2 21:59:22
+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 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with minute(col1)
-------------------------------------------------------------------------
@@ -2704,33 +8339,321 @@ alter table t66
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 t2 values ('21:59:22');
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;
+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='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
-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
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -2887,33 +8849,321 @@ alter table t66
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;
+select * from t44 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t55;
+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
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+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 14:30:20
-2 21:59:22
+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 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 ;
@@ -2983,44 +9233,83 @@ insert into t2 values ('21:59:22');
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.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
-2 14:30:20
-1 09:09:09
-select * from t5;
+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
-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 t6 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
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -3070,33 +9359,321 @@ alter table t66
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;
+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
-2 14:30:20
-1 09:09:09
-select * from t55;
+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
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+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 t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+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.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 t2 values ('2006-05-25');
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
-2 2006-12-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-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 @@ alter table t66
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
+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
+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
+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
-select * from t44;
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t55;
+60 2006-12-17
+select * from t55 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-05-25
-select * from t66;
+60 2006-12-17
+select * from t66 order by colint;
colint col1
-1 2006-12-17
-2 2006-05-25
+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 t2 values ('2006-09-25');
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
-2 2006-12-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-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 @@ alter table t66
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 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-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-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
-select * from t44;
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-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-12-17
+select * from t55 order by colint;
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
+60 2006-12-17
+select * from t66 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
+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
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3532,44 +10749,83 @@ insert into t2 values ('21:59:22');
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 time_to_sec(col1)-(time_to_sec(col1)-20) 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 time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
time_to_sec(col1)-(time_to_sec(col1)-20)
20
20
-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
1 09:09:15
-2 14:30:45
-select * from t5;
+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 14:30:45
-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 14:30:45
-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:33:11' where col1='09:09:15';
+update t2 set col1='10:33:11' where col1='09:09:15';
+update t3 set col1='10:33:11' where col1='09:09:15';
+update t4 set col1='10:33:11' where col1='09:09:15';
+update t5 set col1='10:33:11' where col1='09:09:15';
+update t6 set col1='10:33:11' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
-------------------------------------------------------------------------
@@ -3619,33 +10875,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 09:09:15
-2 14:30:45
-select * from t55;
+1 10:33:11
+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 14:30:45
-3 21:59:22
-select * from t66;
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) 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 (time_to_sec(col1)-(time_to_sec(col1)-20)) 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:33:11
+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:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+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:33:11
+select * from t2 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t4 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+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:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+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
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+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:33:11
+select * from t22 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+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:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+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
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3715,44 +11257,83 @@ insert into t2 values ('2006-01-25');
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 to_days(col1)-to_days('2006-01-01') 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 to_days(col1)-to_days('2006-01-01') from t1 order by col1;
to_days(col1)-to_days('2006-01-01')
-33
16
-select * from t1;
+33
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
+2006-02-03
+select * from t2 order by col1;
col1
2006-01-17
2006-01-25
2006-02-03
-select * from t3;
+select * from t3 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
colint col1
-2 2006-01-17
1 2006-02-03
-select * from t5;
+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
-select * from t6;
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-02-03';
+update t2 set col1='2006-02-06' where col1='2006-02-03';
+update t3 set col1='2006-02-06' where col1='2006-02-03';
+update t4 set col1='2006-02-06' where col1='2006-02-03';
+update t5 set col1='2006-02-06' where col1='2006-02-03';
+update t6 set col1='2006-02-06' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with to_days(col1)-to_days('2006-01-01')
-------------------------------------------------------------------------
@@ -3802,33 +11383,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
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-06
+select * from t22 order by col1;
col1
2006-01-17
2006-01-25
-2006-02-03
-select * from t33;
+2006-02-06
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-06
+select * from t44 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
-1 2006-02-03
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
3 2006-01-25
-1 2006-02-03
-select * from t66;
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+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-06
+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-06
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) 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 (to_days(col1)-to_days('2006-01-01')) 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-06
+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-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+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-06
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+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 to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+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-06
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+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 ;
@@ -3898,44 +11757,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-12-03');
insert into t3 values ('2006-11-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-12-03');
-insert into t4 values (2,'2006-11-17');
-insert into t5 values (1,'2006-12-03');
-insert into t5 values (2,'2006-11-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-11-17');
-insert into t6 values (2,'2006-05-25');
-select weekday(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 weekday(col1) from t1 order by col1;
weekday(col1)
-6
4
-select * from t1;
+6
+select * from t1 order by col1;
col1
+2006-11-17
2006-12-03
+select * from t2 order by col1;
+col1
+2006-05-25
2006-11-17
-select * from t2;
+2006-12-03
+select * from t3 order by col1;
col1
+2006-05-25
+2006-11-17
2006-12-03
+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-06' where col1='2006-12-03';
+update t2 set col1='2006-02-06' where col1='2006-12-03';
+update t3 set col1='2006-02-06' where col1='2006-12-03';
+update t4 set col1='2006-02-06' where col1='2006-12-03';
+update t5 set col1='2006-02-06' where col1='2006-12-03';
+update t6 set col1='2006-02-06' where col1='2006-12-03';
+select * from t1 order by col1;
+col1
+2006-02-06
2006-11-17
-2006-05-25
-select * from t3;
+select * from t2 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t4;
+2006-11-17
+select * from t4 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-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
-1 2006-12-03
-2 2006-11-17
-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-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with weekday(col1)
-------------------------------------------------------------------------
@@ -3985,33 +11883,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekday('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-12-03
+2006-02-06
2006-11-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t33;
+2006-11-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-12-03
+2006-02-06
2006-11-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-06
+2006-11-17
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(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 (weekday(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 (weekday('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 (weekday('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 weekday(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-11-17';
+delete from t2 where col1='2006-11-17';
+delete from t3 where col1='2006-11-17';
+delete from t4 where col1='2006-11-17';
+delete from t5 where col1='2006-11-17';
+delete from t6 where col1='2006-11-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+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-11-17');
+insert into t2 values ('2006-11-17');
+insert into t3 values ('2006-11-17');
+insert into t4 values (60,'2006-11-17');
+insert into t5 values (60,'2006-11-17');
+insert into t6 values (60,'2006-11-17');
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-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-11-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-11-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-11-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-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+60 2006-11-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-11-17';
+delete from t22 where col1='2006-11-17';
+delete from t33 where col1='2006-11-17';
+delete from t44 where col1='2006-11-17';
+delete from t55 where col1='2006-11-17';
+delete from t66 where col1='2006-11-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-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-11-17');
+insert into t22 values ('2006-11-17');
+insert into t33 values ('2006-11-17');
+insert into t44 values (60,'2006-11-17');
+insert into t55 values (60,'2006-11-17');
+insert into t66 values (60,'2006-11-17');
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t44;
+2006-11-17
+select * from t44 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t55 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-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-11-17
+select * from t66 order by colint;
colint col1
-1 2006-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-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-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+60 2006-11-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4081,44 +12257,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-03-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-03-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-03-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-03-17');
-insert into t6 values (2,'2006-05-25');
-select weekofyear(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 weekofyear(col1) from t1 order by col1;
weekofyear(col1)
1
11
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-03-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-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
-1 2006-01-03
-2 2006-03-17
-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-03-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-09-06' where col1='2006-01-03';
+update t2 set col1='2006-09-06' where col1='2006-01-03';
+update t3 set col1='2006-09-06' where col1='2006-01-03';
+update t4 set col1='2006-09-06' where col1='2006-01-03';
+update t5 set col1='2006-09-06' where col1='2006-01-03';
+update t6 set col1='2006-09-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+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 weekofyear(col1)
-------------------------------------------------------------------------
@@ -4168,33 +12383,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekofyear('2006-02-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-03-17
-select * from t22;
+2006-09-06
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t33;
+2006-09-06
+select * from t33 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t44;
+2006-09-06
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-select * from t55;
+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-01-03
-2 2006-03-17
-3 2006-05-25
-select * from t66;
+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-03-17
-2 2006-05-25
+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-03-17
+2006-09-06
+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-03-17
+2006-09-06
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(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 (weekofyear(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 (weekofyear('2006-02-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 (weekofyear('2006-02-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 weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-03-17';
+delete from t2 where col1='2006-03-17';
+delete from t3 where col1='2006-03-17';
+delete from t4 where col1='2006-03-17';
+delete from t5 where col1='2006-03-17';
+delete from t6 where col1='2006-03-17';
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-09-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-03-17');
+insert into t2 values ('2006-03-17');
+insert into t3 values ('2006-03-17');
+insert into t4 values (60,'2006-03-17');
+insert into t5 values (60,'2006-03-17');
+insert into t6 values (60,'2006-03-17');
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+60 2006-03-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-03-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-03-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-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+60 2006-03-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-03-17';
+delete from t22 where col1='2006-03-17';
+delete from t33 where col1='2006-03-17';
+delete from t44 where col1='2006-03-17';
+delete from t55 where col1='2006-03-17';
+delete from t66 where col1='2006-03-17';
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-09-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-03-17');
+insert into t22 values ('2006-03-17');
+insert into t33 values ('2006-03-17');
+insert into t44 values (60,'2006-03-17');
+insert into t55 values (60,'2006-03-17');
+insert into t66 values (60,'2006-03-17');
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+60 2006-03-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-03-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-03-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-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+60 2006-03-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4264,44 +12765,83 @@ insert into t2 values ('2004-05-25');
insert into t3 values ('1996-01-03');
insert into t3 values ('2000-02-17');
insert into t3 values ('2004-05-25');
-insert into t4 values (1,'1996-01-03');
-insert into t4 values (2,'2000-02-17');
-insert into t5 values (1,'1996-01-03');
-insert into t5 values (2,'2000-02-17');
-insert into t5 values (3,'2004-05-25');
-insert into t6 values (1,'2000-02-17');
-insert into t6 values (2,'2004-05-25');
-select year(col1)-1990 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 year(col1)-1990 from t1 order by col1;
year(col1)-1990
6
10
-select * from t1;
+select * from t1 order by col1;
col1
1996-01-03
2000-02-17
-select * from t2;
+select * from t2 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t3;
+select * from t3 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-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
-1 1996-01-03
-2 2000-02-17
-3 2004-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-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2002-02-15' where col1='1996-01-03';
+update t2 set col1='2002-02-15' where col1='1996-01-03';
+update t3 set col1='2002-02-15' where col1='1996-01-03';
+update t4 set col1='2002-02-15' where col1='1996-01-03';
+update t5 set col1='2002-02-15' where col1='1996-01-03';
+update t6 set col1='2002-02-15' where col1='1996-01-03';
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-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 year(col1)-1990
-------------------------------------------------------------------------
@@ -4351,33 +12891,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (year('2005-10-14')-1990),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
-select * from t22;
+2002-02-15
+select * from t22 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
2004-05-25
-select * from t33;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-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
+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
+2000-02-17
+2002-02-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
+2000-02-17
+2002-02-15
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) 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 (year(col1)-1990) 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 (year('2005-10-14')-1990),
+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 (year('2005-10-14')-1990),
+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 year(col1)-1990
+-------------------------------------------------------------------------
+delete from t1 where col1='2000-02-17';
+delete from t2 where col1='2000-02-17';
+delete from t3 where col1='2000-02-17';
+delete from t4 where col1='2000-02-17';
+delete from t5 where col1='2000-02-17';
+delete from t6 where col1='2000-02-17';
+select * from t1 order by col1;
+col1
+2002-02-15
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2002-02-15
+2004-05-25
+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 ('2000-02-17');
+insert into t2 values ('2000-02-17');
+insert into t3 values ('2000-02-17');
+insert into t4 values (60,'2000-02-17');
+insert into t5 values (60,'2000-02-17');
+insert into t6 values (60,'2000-02-17');
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+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 2000-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 2000-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 2000-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
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+60 2000-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t11 where col1='2000-02-17';
+delete from t22 where col1='2000-02-17';
+delete from t33 where col1='2000-02-17';
+delete from t44 where col1='2000-02-17';
+delete from t55 where col1='2000-02-17';
+delete from t66 where col1='2000-02-17';
+select * from t11 order by col1;
+col1
+2002-02-15
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2002-02-15
+2004-05-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 ('2000-02-17');
+insert into t22 values ('2000-02-17');
+insert into t33 values ('2000-02-17');
+insert into t44 values (60,'2000-02-17');
+insert into t55 values (60,'2000-02-17');
+insert into t66 values (60,'2000-02-17');
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
2004-05-25
-select * from t44;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-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
+60 2000-02-17
+select * from t55 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t66 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-3 2004-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-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
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-25
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+60 2000-02-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4447,44 +13269,83 @@ insert into t2 values ('2006-03-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-08-17');
insert into t3 values ('2006-03-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-08-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-08-17');
-insert into t5 values (3,'2006-03-25');
-insert into t6 values (1,'2006-08-17');
-insert into t6 values (2,'2006-03-25');
-select yearweek(col1)-200600 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 yearweek(col1)-200600 from t1 order by col1;
yearweek(col1)-200600
1
33
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-08-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-25
2006-08-17
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
+2006-03-25
2006-08-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-15' where col1='2006-01-03';
+update t2 set col1='2006-11-15' where col1='2006-01-03';
+update t3 set col1='2006-11-15' where col1='2006-01-03';
+update t4 set col1='2006-11-15' where col1='2006-01-03';
+update t5 set col1='2006-11-15' where col1='2006-01-03';
+update t6 set col1='2006-11-15' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t4;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-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
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-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-08-17
-2 2006-03-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with yearweek(col1)-200600
-------------------------------------------------------------------------
@@ -4534,33 +13395,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (yearweek('2006-10-14')-200600),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-08-17
-select * from t22;
+2006-11-15
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-25
2006-08-17
-select * from t33;
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-17
+2006-11-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
+2006-08-17
+2006-11-15
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) 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 (yearweek(col1)-200600) 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 (yearweek('2006-10-14')-200600),
+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 (yearweek('2006-10-14')-200600),
+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 yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-08-17';
+delete from t2 where col1='2006-08-17';
+delete from t3 where col1='2006-08-17';
+delete from t4 where col1='2006-08-17';
+delete from t5 where col1='2006-08-17';
+delete from t6 where col1='2006-08-17';
+select * from t1 order by col1;
+col1
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-11-15
+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-08-17');
+insert into t2 values ('2006-08-17');
+insert into t3 values ('2006-08-17');
+insert into t4 values (60,'2006-08-17');
+insert into t5 values (60,'2006-08-17');
+insert into t6 values (60,'2006-08-17');
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-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-08-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-08-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-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t44;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+60 2006-08-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-08-17';
+delete from t22 where col1='2006-08-17';
+delete from t33 where col1='2006-08-17';
+delete from t44 where col1='2006-08-17';
+delete from t55 where col1='2006-08-17';
+delete from t66 where col1='2006-08-17';
+select * from t11 order by col1;
+col1
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-11-15
+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-08-17');
+insert into t22 values ('2006-08-17');
+insert into t33 values ('2006-08-17');
+insert into t44 values (60,'2006-08-17');
+insert into t55 values (60,'2006-08-17');
+insert into t66 values (60,'2006-08-17');
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-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-08-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-08-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-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-select * from t55;
+60 2006-08-17
+select * from t55 order by colint;
colint col1
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-select * from t66;
+60 2006-08-17
+select * from t66 order by colint;
colint col1
-1 2006-08-17
-2 2006-03-25
+60 2006-08-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result
index 73d69e5c90a..86742038990 100644
--- a/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result
+++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_myisam.result
@@ -55,44 +55,329 @@ insert into t2 values (17 );
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 @@ alter table t66
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
+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
+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 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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-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
+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 5
+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
+alter table t66
+reorganize partition p0,p1 into
+(partition s1 values less than maxvalue);
+select * from t66 order by colint;
colint col1
-1 13
-2 17
+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 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 t2 values ('3');
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
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+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 9
-2 3
+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 ascii(col1)
-------------------------------------------------------------------------
@@ -325,33 +1857,311 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 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 1
+1 8
2 9
-select * from t55;
+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 1
+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
+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
-select * from t66;
+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 9
-2 3
+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
+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 t2 values (17.987);
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
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+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 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(ceiling(col1) as signed integer)
-------------------------------------------------------------------------
@@ -508,33 +2357,309 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-select * from t66;
+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 13.3450
-2 17.9870
+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
+-------------------------------------------------------------------------
+--- 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 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 t2 values (17.987);
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
-select * from t5;
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
1 5.1230
2 13.3450
3 17.9870
-select * from t6;
+4 15.6540
+select * from t6 order by colint;
colint col1
-1 13.3450
-2 17.9870
+1 5.1230
+2 13.3450
+3 17.9870
+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 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
-------------------------------------------------------------------------
--- Alter tables with cast(floor(col1) as signed)
-------------------------------------------------------------------------
@@ -691,33 +2855,309 @@ alter table t66
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
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-select * from t66;
+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 13.3450
-2 17.9870
+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
+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 t2 values (17);
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
19.0000
+select * from t3 order by col1;
+col1
+15.0000
17.0000
-select * from t4;
+19.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t5;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
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 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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 t44;
+select * from t3 order by col1;
+col1
+15.0000
+17.0000
+select * from t4 order by colint;
colint col1
-1 5.0000
-2 19.0000
-select * from t55;
+1 5.1230
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t5 order by colint;
colint col1
-1 5.0000
-2 19.0000
-3 17.0000
-select * from t66;
+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
+19.0000
+select * from t44 order by colint;
+colint col1
+60 19.0000
+select * from t55 order by colint;
+colint col1
+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 t2 values ('3');
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
+4 8
+select * from t6 order by colint;
colint col1
1 1
2 9
3 3
-select * from t6;
+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 9
-2 3
+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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 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 1
+1 8
2 9
-select * from t55;
+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 1
+1 8
2 9
3 3
-select * from t66;
+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
+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 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
-1 9
-2 3
+-------------------------------------------------------------------------
+--- 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 t2 values ('2006-01-25');
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
+3 2006-01-25
+4 2006-02-05
+select * from t5 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 t6 order by colint;
colint col1
1 2006-02-03
2 2006-01-17
3 2006-01-25
-select * from t6;
+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-01-17
-2 2006-01-25
+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 @@ alter table t66
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
-select * from t66;
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
+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-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
-1 2006-01-17
-2 2006-01-25
+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 t2 values ('2006-01-25');
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 @@ alter table t66
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
-select * from t66;
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
+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 t2 values ('2006-01-25');
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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 order by colint;
colint col1
-2 2006-02-17
-1 2006-01-03
-select * from t55;
+60 2006-02-17
+select * from t5 order by colint;
colint col1
-2 2006-02-17
+60 2006-02-17
+select * from t6 order by colint;
+colint col1
+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
+-------------------------------------------------------------------------
+--- 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-17
-2 2006-01-25
+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
+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
+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
+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
+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 t2 values ('2006-02-25');
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
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 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
+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-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 @@ alter table t66
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-01-17
-2 2006-02-25
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
+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 t2 values ('2006-02-25');
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
+3 2006-01-25
+4 2006-02-05
+select * from t5 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 t6 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
+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-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
-select * from t6;
+3 2006-01-25
+4 2006-02-05
+select * from t6 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
-------------------------------------------------------------------------
--- Alter tables with dayofyear(col1)
-------------------------------------------------------------------------
@@ -1972,33 +6349,309 @@ alter table t66
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-01-17
-2 2006-02-25
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
+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 t2 values ('2006-01-25');
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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-select * from t44;
+2006-02-05
+2006-02-17
+select * from t4 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 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 t66;
+4 2006-02-05
+60 2006-02-17
+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
+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
+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
+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
+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
+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 t2 values ('21:59');
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
-2 14:30:00
-1 09:09:00
-select * from t5;
+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
-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
+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 14:30:00
-2 21:59:00
+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 hour(col1)
-------------------------------------------------------------------------
@@ -2338,33 +7345,315 @@ alter table t66
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 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: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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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;
+select * from t44 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-select * from t55;
+60 14:30:00
+select * from t55 order by colint;
colint col1
-2 14:30:00
-1 09:09:00
-3 21:59:00
-select * from t66;
+60 14:30:00
+select * from t66 order by colint;
colint col1
-1 14:30:00
-2 21:59:00
+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 t2 values ('00:59:22.000024');
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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 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 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 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 09:09:15
+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
-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
+-------------------------------------------------------------------------
+--- 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 04:30:01
-2 00:59:22
+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 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 t2 values ('21:59:22');
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 14:30:45
-2 21:59:22
+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 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with minute(col1)
-------------------------------------------------------------------------
@@ -2704,33 +8339,321 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 t2 values ('21:59:22');
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;
+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='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
-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
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -2887,33 +8849,321 @@ alter table t66
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;
+select * from t44 order by colint;
colint col1
-2 14:30:20
-1 09:09:09
-select * from t55;
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+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 14:30:20
-2 21:59:22
+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 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 ;
@@ -2983,44 +9233,83 @@ insert into t2 values ('21:59:22');
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.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
-2 14:30:20
-1 09:09:09
-select * from t5;
+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
-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 t6 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
-------------------------------------------------------------------------
--- Alter tables with second(col1)
-------------------------------------------------------------------------
@@ -3070,33 +9359,321 @@ alter table t66
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;
+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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
-2 14:30:20
-1 09:09:09
-select * from t55;
+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
-2 14:30:20
-3 21:59:22
-1 09:09:09
-select * from t66;
+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 t4 order by colint;
+colint col1
+60 14:30:20
+select * from t5 order by colint;
colint col1
-1 14:30:20
-2 21:59:22
+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.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 t2 values ('2006-05-25');
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
-2 2006-12-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-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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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
+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
+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
+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
-select * from t44;
+2006-11-06
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-select * from t55;
+60 2006-12-17
+select * from t55 order by colint;
colint col1
-2 2006-12-17
-1 2006-01-03
-3 2006-05-25
-select * from t66;
+60 2006-12-17
+select * from t66 order by colint;
colint col1
-1 2006-12-17
-2 2006-05-25
+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 t2 values ('2006-09-25');
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
-2 2006-12-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-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 @@ alter table t66
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=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 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-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-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
-select * from t44;
+2006-12-17
+select * from t44 order by colint;
colint col1
-2 2006-12-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-12-17
+select * from t55 order by colint;
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
+60 2006-12-17
+select * from t66 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
+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
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3532,44 +10749,83 @@ insert into t2 values ('21:59:22');
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 time_to_sec(col1)-(time_to_sec(col1)-20) 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 time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
time_to_sec(col1)-(time_to_sec(col1)-20)
20
20
-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
1 09:09:15
-2 14:30:45
-select * from t5;
+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 14:30:45
-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 14:30:45
-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:33:11' where col1='09:09:15';
+update t2 set col1='10:33:11' where col1='09:09:15';
+update t3 set col1='10:33:11' where col1='09:09:15';
+update t4 set col1='10:33:11' where col1='09:09:15';
+update t5 set col1='10:33:11' where col1='09:09:15';
+update t6 set col1='10:33:11' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
-------------------------------------------------------------------------
--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
-------------------------------------------------------------------------
@@ -3619,33 +10875,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
-select * from t22;
+select * from t22 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t33;
+select * from t33 order by col1;
col1
-09:09:15
+10:33:11
14:30:45
21:59:22
-select * from t44;
+select * from t44 order by colint;
colint col1
-1 09:09:15
-2 14:30:45
-select * from t55;
+1 10:33:11
+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 14:30:45
-3 21:59:22
-select * from t66;
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) 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=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+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:33:11
+select * from t2 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t4 order by colint;
colint col1
-1 14:30:45
-2 21:59:22
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+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:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+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
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+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:33:11
+select * from t22 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+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:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+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
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -3715,44 +11257,83 @@ insert into t2 values ('2006-01-25');
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 to_days(col1)-to_days('2006-01-01') 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 to_days(col1)-to_days('2006-01-01') from t1 order by col1;
to_days(col1)-to_days('2006-01-01')
-33
16
-select * from t1;
+33
+select * from t1 order by col1;
col1
-2006-02-03
2006-01-17
-select * from t2;
+2006-02-03
+select * from t2 order by col1;
col1
2006-01-17
2006-01-25
2006-02-03
-select * from t3;
+select * from t3 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t4;
+2006-02-03
+select * from t4 order by colint;
colint col1
-2 2006-01-17
1 2006-02-03
-select * from t5;
+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
-select * from t6;
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-02-06' where col1='2006-02-03';
+update t2 set col1='2006-02-06' where col1='2006-02-03';
+update t3 set col1='2006-02-06' where col1='2006-02-03';
+update t4 set col1='2006-02-06' where col1='2006-02-03';
+update t5 set col1='2006-02-06' where col1='2006-02-03';
+update t6 set col1='2006-02-06' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with to_days(col1)-to_days('2006-01-01')
-------------------------------------------------------------------------
@@ -3802,33 +11383,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
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-06
+select * from t22 order by col1;
col1
2006-01-17
2006-01-25
-2006-02-03
-select * from t33;
+2006-02-06
+select * from t33 order by col1;
col1
-2006-02-03
2006-01-17
2006-01-25
-select * from t44;
+2006-02-06
+select * from t44 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
-1 2006-02-03
-select * from t55;
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
colint col1
+1 2006-02-06
2 2006-01-17
3 2006-01-25
-1 2006-02-03
-select * from t66;
+4 2006-02-05
+select * from t66 order by colint;
colint col1
-1 2006-01-17
-2 2006-01-25
+1 2006-02-06
+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-06
+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-06
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) 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=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+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-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+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-06
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+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 to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+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-06
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+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 ;
@@ -3898,44 +11757,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-12-03');
insert into t3 values ('2006-11-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-12-03');
-insert into t4 values (2,'2006-11-17');
-insert into t5 values (1,'2006-12-03');
-insert into t5 values (2,'2006-11-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-11-17');
-insert into t6 values (2,'2006-05-25');
-select weekday(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 weekday(col1) from t1 order by col1;
weekday(col1)
-6
4
-select * from t1;
+6
+select * from t1 order by col1;
col1
+2006-11-17
2006-12-03
+select * from t2 order by col1;
+col1
+2006-05-25
2006-11-17
-select * from t2;
+2006-12-03
+select * from t3 order by col1;
col1
+2006-05-25
+2006-11-17
2006-12-03
+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-06' where col1='2006-12-03';
+update t2 set col1='2006-02-06' where col1='2006-12-03';
+update t3 set col1='2006-02-06' where col1='2006-12-03';
+update t4 set col1='2006-02-06' where col1='2006-12-03';
+update t5 set col1='2006-02-06' where col1='2006-12-03';
+update t6 set col1='2006-02-06' where col1='2006-12-03';
+select * from t1 order by col1;
+col1
+2006-02-06
2006-11-17
-2006-05-25
-select * from t3;
+select * from t2 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t4;
+2006-11-17
+select * from t4 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-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
-1 2006-12-03
-2 2006-11-17
-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-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with weekday(col1)
-------------------------------------------------------------------------
@@ -3985,33 +11883,311 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekday('2006-10-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-12-03
+2006-02-06
2006-11-17
-select * from t22;
+select * from t22 order by col1;
col1
-2006-12-03
+2006-02-06
+2006-05-25
2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t33;
+2006-11-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-12-03
+2006-02-06
2006-11-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-06
+2006-11-17
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(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=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 (weekday('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 (weekday('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 weekday(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-11-17';
+delete from t2 where col1='2006-11-17';
+delete from t3 where col1='2006-11-17';
+delete from t4 where col1='2006-11-17';
+delete from t5 where col1='2006-11-17';
+delete from t6 where col1='2006-11-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+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-11-17');
+insert into t2 values ('2006-11-17');
+insert into t3 values ('2006-11-17');
+insert into t4 values (60,'2006-11-17');
+insert into t5 values (60,'2006-11-17');
+insert into t6 values (60,'2006-11-17');
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-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-11-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-11-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-11-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-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+60 2006-11-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-11-17';
+delete from t22 where col1='2006-11-17';
+delete from t33 where col1='2006-11-17';
+delete from t44 where col1='2006-11-17';
+delete from t55 where col1='2006-11-17';
+delete from t66 where col1='2006-11-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-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-11-17');
+insert into t22 values ('2006-11-17');
+insert into t33 values ('2006-11-17');
+insert into t44 values (60,'2006-11-17');
+insert into t55 values (60,'2006-11-17');
+insert into t66 values (60,'2006-11-17');
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
2006-05-25
-select * from t44;
+2006-11-17
+select * from t44 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-17
+select * from t55 order by colint;
colint col1
-1 2006-12-03
-2 2006-11-17
-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-11-17
+select * from t66 order by colint;
colint col1
-1 2006-11-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2006-11-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-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+60 2006-11-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4081,44 +12257,83 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-03-17');
insert into t3 values ('2006-05-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-03-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-03-17');
-insert into t5 values (3,'2006-05-25');
-insert into t6 values (1,'2006-03-17');
-insert into t6 values (2,'2006-05-25');
-select weekofyear(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 weekofyear(col1) from t1 order by col1;
weekofyear(col1)
1
11
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-03-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
2006-03-17
2006-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-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
-1 2006-01-03
-2 2006-03-17
-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-03-17
-2 2006-05-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2006-09-06' where col1='2006-01-03';
+update t2 set col1='2006-09-06' where col1='2006-01-03';
+update t3 set col1='2006-09-06' where col1='2006-01-03';
+update t4 set col1='2006-09-06' where col1='2006-01-03';
+update t5 set col1='2006-09-06' where col1='2006-01-03';
+update t6 set col1='2006-09-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+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 weekofyear(col1)
-------------------------------------------------------------------------
@@ -4168,33 +12383,319 @@ alter table t66
partition by range(colint)
(partition p0 values less than (weekofyear('2006-02-14')),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-03-17
-select * from t22;
+2006-09-06
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t33;
+2006-09-06
+select * from t33 order by col1;
col1
-2006-01-03
2006-03-17
2006-05-25
-select * from t44;
+2006-09-06
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-03-17
-select * from t55;
+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-01-03
-2 2006-03-17
-3 2006-05-25
-select * from t66;
+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-03-17
-2 2006-05-25
+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-03-17
+2006-09-06
+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-03-17
+2006-09-06
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(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=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 (weekofyear('2006-02-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 (weekofyear('2006-02-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 weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-03-17';
+delete from t2 where col1='2006-03-17';
+delete from t3 where col1='2006-03-17';
+delete from t4 where col1='2006-03-17';
+delete from t5 where col1='2006-03-17';
+delete from t6 where col1='2006-03-17';
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-09-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-03-17');
+insert into t2 values ('2006-03-17');
+insert into t3 values ('2006-03-17');
+insert into t4 values (60,'2006-03-17');
+insert into t5 values (60,'2006-03-17');
+insert into t6 values (60,'2006-03-17');
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+60 2006-03-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-03-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-03-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-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+60 2006-03-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-03-17';
+delete from t22 where col1='2006-03-17';
+delete from t33 where col1='2006-03-17';
+delete from t44 where col1='2006-03-17';
+delete from t55 where col1='2006-03-17';
+delete from t66 where col1='2006-03-17';
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-09-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-03-17');
+insert into t22 values ('2006-03-17');
+insert into t33 values ('2006-03-17');
+insert into t44 values (60,'2006-03-17');
+insert into t55 values (60,'2006-03-17');
+insert into t66 values (60,'2006-03-17');
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+60 2006-03-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-03-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-03-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-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+60 2006-03-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4264,44 +12765,83 @@ insert into t2 values ('2004-05-25');
insert into t3 values ('1996-01-03');
insert into t3 values ('2000-02-17');
insert into t3 values ('2004-05-25');
-insert into t4 values (1,'1996-01-03');
-insert into t4 values (2,'2000-02-17');
-insert into t5 values (1,'1996-01-03');
-insert into t5 values (2,'2000-02-17');
-insert into t5 values (3,'2004-05-25');
-insert into t6 values (1,'2000-02-17');
-insert into t6 values (2,'2004-05-25');
-select year(col1)-1990 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 year(col1)-1990 from t1 order by col1;
year(col1)-1990
6
10
-select * from t1;
+select * from t1 order by col1;
col1
1996-01-03
2000-02-17
-select * from t2;
+select * from t2 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t3;
+select * from t3 order by col1;
col1
1996-01-03
2000-02-17
2004-05-25
-select * from t4;
+select * from t4 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-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
-1 1996-01-03
-2 2000-02-17
-3 2004-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-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+update t1 set col1='2002-02-15' where col1='1996-01-03';
+update t2 set col1='2002-02-15' where col1='1996-01-03';
+update t3 set col1='2002-02-15' where col1='1996-01-03';
+update t4 set col1='2002-02-15' where col1='1996-01-03';
+update t5 set col1='2002-02-15' where col1='1996-01-03';
+update t6 set col1='2002-02-15' where col1='1996-01-03';
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-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 year(col1)-1990
-------------------------------------------------------------------------
@@ -4351,33 +12891,315 @@ alter table t66
partition by range(colint)
(partition p0 values less than (year('2005-10-14')-1990),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
-select * from t22;
+2002-02-15
+select * from t22 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
2004-05-25
-select * from t33;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-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
+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
+2000-02-17
+2002-02-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
+2000-02-17
+2002-02-15
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) 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=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 (year('2005-10-14')-1990),
+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 (year('2005-10-14')-1990),
+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 year(col1)-1990
+-------------------------------------------------------------------------
+delete from t1 where col1='2000-02-17';
+delete from t2 where col1='2000-02-17';
+delete from t3 where col1='2000-02-17';
+delete from t4 where col1='2000-02-17';
+delete from t5 where col1='2000-02-17';
+delete from t6 where col1='2000-02-17';
+select * from t1 order by col1;
+col1
+2002-02-15
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2002-02-15
+2004-05-25
+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 ('2000-02-17');
+insert into t2 values ('2000-02-17');
+insert into t3 values ('2000-02-17');
+insert into t4 values (60,'2000-02-17');
+insert into t5 values (60,'2000-02-17');
+insert into t6 values (60,'2000-02-17');
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+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 2000-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 2000-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 2000-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
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+60 2000-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t11 where col1='2000-02-17';
+delete from t22 where col1='2000-02-17';
+delete from t33 where col1='2000-02-17';
+delete from t44 where col1='2000-02-17';
+delete from t55 where col1='2000-02-17';
+delete from t66 where col1='2000-02-17';
+select * from t11 order by col1;
+col1
+2002-02-15
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2002-02-15
+2004-05-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 ('2000-02-17');
+insert into t22 values ('2000-02-17');
+insert into t33 values ('2000-02-17');
+insert into t44 values (60,'2000-02-17');
+insert into t55 values (60,'2000-02-17');
+insert into t66 values (60,'2000-02-17');
+select * from t11 order by col1;
col1
-1996-01-03
2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
2004-05-25
-select * from t44;
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-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
+60 2000-02-17
+select * from t55 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-select * from t55;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-02-17
+select * from t66 order by colint;
colint col1
-1 1996-01-03
-2 2000-02-17
-3 2004-05-25
-select * from t66;
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+60 2000-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
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
colint col1
-1 2000-02-17
-2 2004-05-25
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+60 2000-02-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
@@ -4447,44 +13269,83 @@ insert into t2 values ('2006-03-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-08-17');
insert into t3 values ('2006-03-25');
-insert into t4 values (1,'2006-01-03');
-insert into t4 values (2,'2006-08-17');
-insert into t5 values (1,'2006-01-03');
-insert into t5 values (2,'2006-08-17');
-insert into t5 values (3,'2006-03-25');
-insert into t6 values (1,'2006-08-17');
-insert into t6 values (2,'2006-03-25');
-select yearweek(col1)-200600 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 yearweek(col1)-200600 from t1 order by col1;
yearweek(col1)-200600
1
33
-select * from t1;
+select * from t1 order by col1;
col1
2006-01-03
2006-08-17
-select * from t2;
+select * from t2 order by col1;
col1
2006-01-03
2006-03-25
2006-08-17
-select * from t3;
+select * from t3 order by col1;
col1
2006-01-03
+2006-03-25
2006-08-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-15' where col1='2006-01-03';
+update t2 set col1='2006-11-15' where col1='2006-01-03';
+update t3 set col1='2006-11-15' where col1='2006-01-03';
+update t4 set col1='2006-11-15' where col1='2006-01-03';
+update t5 set col1='2006-11-15' where col1='2006-01-03';
+update t6 set col1='2006-11-15' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t4;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-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
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-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-08-17
-2 2006-03-25
+1 2006-02-03
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
-------------------------------------------------------------------------
--- Alter tables with yearweek(col1)-200600
-------------------------------------------------------------------------
@@ -4534,33 +13395,321 @@ alter table t66
partition by range(colint)
(partition p0 values less than (yearweek('2006-10-14')-200600),
partition p1 values less than maxvalue);
-select * from t11;
+select * from t11 order by col1;
col1
-2006-01-03
2006-08-17
-select * from t22;
+2006-11-15
+select * from t22 order by col1;
col1
-2006-01-03
2006-03-25
2006-08-17
-select * from t33;
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-17
+2006-11-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
+2006-08-17
+2006-11-15
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) 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=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+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 (yearweek('2006-10-14')-200600),
+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 (yearweek('2006-10-14')-200600),
+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 yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-08-17';
+delete from t2 where col1='2006-08-17';
+delete from t3 where col1='2006-08-17';
+delete from t4 where col1='2006-08-17';
+delete from t5 where col1='2006-08-17';
+delete from t6 where col1='2006-08-17';
+select * from t1 order by col1;
+col1
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-11-15
+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-08-17');
+insert into t2 values ('2006-08-17');
+insert into t3 values ('2006-08-17');
+insert into t4 values (60,'2006-08-17');
+insert into t5 values (60,'2006-08-17');
+insert into t6 values (60,'2006-08-17');
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-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-08-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-08-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-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
2006-03-25
-select * from t44;
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+60 2006-08-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-08-17';
+delete from t22 where col1='2006-08-17';
+delete from t33 where col1='2006-08-17';
+delete from t44 where col1='2006-08-17';
+delete from t55 where col1='2006-08-17';
+delete from t66 where col1='2006-08-17';
+select * from t11 order by col1;
+col1
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-11-15
+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-08-17');
+insert into t22 values ('2006-08-17');
+insert into t33 values ('2006-08-17');
+insert into t44 values (60,'2006-08-17');
+insert into t55 values (60,'2006-08-17');
+insert into t66 values (60,'2006-08-17');
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-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-08-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-08-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-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
colint col1
-1 2006-01-03
-2 2006-08-17
-select * from t55;
+60 2006-08-17
+select * from t55 order by colint;
colint col1
-3 2006-03-25
-1 2006-01-03
-2 2006-08-17
-select * from t66;
+60 2006-08-17
+select * from t66 order by colint;
colint col1
-1 2006-08-17
-2 2006-03-25
+60 2006-08-17
+-------------------------
+---- some alter table end
+-------------------------
drop table if exists t1 ;
drop table if exists t2 ;
drop table if exists t3 ;
diff --git a/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result b/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result
new file mode 100644
index 00000000000..5dc27d16538
--- /dev/null
+++ b/mysql-test/suite/partitions/r/partition_supported_sql_func_ndb.result
@@ -0,0 +1,13724 @@
+-------------------------------------------------------------------------
+--- abs(col1) in partition with coltype int
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with abs(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 int) engine='NDB'
+partition by range(abs(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 int) engine='NDB'
+partition by list(abs(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 int) engine='NDB'
+partition by hash(abs(col1));
+create table t4 (colint int, col1 int) engine='NDB'
+partition by range(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 int) engine='NDB'
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 int) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with abs(col1)
+-------------------------------------------------------------------------
+insert into t1 values (5 );
+insert into t1 values (13 );
+insert into t2 values (5 );
+insert into t2 values (13 );
+insert into t2 values (17 );
+insert into t3 values (5 );
+insert into t3 values (13 );
+insert into t3 values (17 );
+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 order by col1;
+col1
+5
+13
+select * from t2 order by col1;
+col1
+5
+13
+17
+select * from t3 order by col1;
+col1
+5
+13
+17
+select * from t4 order by colint;
+colint col1
+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
+select * from t5 order by colint;
+colint col1
+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
+select * from t6 order by colint;
+colint col1
+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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(abs(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(abs(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(abs(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(abs(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (abs(15)),
+partition p1 values less than maxvalue);
+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
+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 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
+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
+---------------------------
+---- 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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- ascii(col1) in partition with coltype char(1)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with ascii(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(1)) engine='NDB'
+partition by range(ascii(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(1)) engine='NDB'
+partition by list(ascii(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 char(1)) engine='NDB'
+partition by hash(ascii(col1));
+create table t4 (colint int, col1 char(1)) engine='NDB'
+partition by range(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(1)) engine='NDB'
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 char(1)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with ascii(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('1');
+insert into t1 values ('9');
+insert into t2 values ('1');
+insert into t2 values ('9');
+insert into t2 values ('3');
+insert into t3 values ('1');
+insert into t3 values ('9');
+insert into t3 values ('3');
+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 order by col1;
+col1
+1
+9
+select * from t2 order by col1;
+col1
+1
+3
+9
+select * from t3 order by col1;
+col1
+1
+3
+9
+select * from t4 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+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 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Alter tables with ascii(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(ascii(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(ascii(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(ascii(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(ascii(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (ascii('5')),
+partition p1 values less than maxvalue);
+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
+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
+8
+9
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 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
+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
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- cast(ceiling(col1) as signed integer) in partition with coltype float(7,4)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+create table t1 (col1 float(7,4)) engine='NDB'
+partition by range(cast(ceiling(col1) as signed integer))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 float(7,4)) engine='NDB'
+partition by list(cast(ceiling(col1) as signed integer))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 float(7,4)) engine='NDB'
+partition by hash(cast(ceiling(col1) as signed integer));
+create table t4 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 float(7,4)) engine='NDB'
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+insert into t1 values (5.1230);
+insert into t1 values (13.345);
+insert into t2 values (5.1230);
+insert into t2 values (13.345);
+insert into t2 values (17.987);
+insert into t3 values (5.1230);
+insert into t3 values (13.345);
+insert into t3 values (17.987);
+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 order by col1;
+col1
+5.1230
+13.3450
+select * from t2 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+select * from t3 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+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.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 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Alter tables with cast(ceiling(col1) as signed integer)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(cast(ceiling(col1) as signed integer))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(cast(ceiling(col1) as signed integer))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(cast(ceiling(col1) as signed integer));
+alter table t44
+partition by range(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (cast(ceiling(15) as signed integer)),
+partition p1 values less than maxvalue);
+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
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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 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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- cast(floor(col1) as signed) in partition with coltype float(7,4)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+create table t1 (col1 float(7,4)) engine='NDB'
+partition by range(cast(floor(col1) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 float(7,4)) engine='NDB'
+partition by list(cast(floor(col1) as signed))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 float(7,4)) engine='NDB'
+partition by hash(cast(floor(col1) as signed));
+create table t4 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 float(7,4)) engine='NDB'
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+insert into t1 values (5.1230);
+insert into t1 values (13.345);
+insert into t2 values (5.1230);
+insert into t2 values (13.345);
+insert into t2 values (17.987);
+insert into t3 values (5.1230);
+insert into t3 values (13.345);
+insert into t3 values (17.987);
+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 order by col1;
+col1
+5.1230
+13.3450
+select * from t2 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+select * from t3 order by col1;
+col1
+5.1230
+13.3450
+17.9870
+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.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 15.6540
+2 13.3450
+3 17.9870
+4 15.6540
+-------------------------------------------------------------------------
+--- Alter tables with cast(floor(col1) as signed)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(cast(floor(col1) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(cast(floor(col1) as signed))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(cast(floor(col1) as signed));
+alter table t44
+partition by range(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (cast(floor(15.123) as signed)),
+partition p1 values less than maxvalue);
+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
+2 13.3450
+3 17.9870
+4 15.6540
+select * from t55 order by colint;
+colint col1
+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(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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- cast(mod(col1,10) as signed) in partition with coltype float(7,4)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+create table t1 (col1 float(7,4)) engine='NDB'
+partition by range(cast(mod(col1,10) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 float(7,4)) engine='NDB'
+partition by list(cast(mod(col1,10) as signed))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 float(7,4)) engine='NDB'
+partition by hash(cast(mod(col1,10) as signed));
+create table t4 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 float(7,4)) engine='NDB'
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 float(7,4)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+insert into t1 values (5.0000);
+insert into t1 values (19);
+insert into t2 values (5.0000);
+insert into t2 values (19);
+insert into t2 values (17);
+insert into t3 values (5.0000);
+insert into t3 values (19);
+insert into t3 values (17);
+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 order by col1;
+col1
+5.0000
+19.0000
+select * from t2 order by col1;
+col1
+5.0000
+17.0000
+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
+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
+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
+-------------------------------------------------------------------------
+--- Alter tables with cast(mod(col1,10) as signed)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(cast(mod(col1,10) as signed))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(cast(mod(col1,10) as signed))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(cast(mod(col1,10) as signed));
+alter table t44
+partition by range(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (cast(mod(15,10) as signed)),
+partition p1 values less than maxvalue);
+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
+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
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+19.0000
+select * from t44 order by colint;
+colint col1
+60 19.0000
+select * from t55 order by colint;
+colint col1
+60 19.0000
+select * from t66 order by colint;
+colint col1
+60 19.0000
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- ord(col1) in partition with coltype char(3)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with ord(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(3)) engine='NDB'
+partition by range(ord(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(3)) engine='NDB'
+partition by list(ord(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 char(3)) engine='NDB'
+partition by hash(ord(col1));
+create table t4 (colint int, col1 char(3)) engine='NDB'
+partition by range(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(3)) engine='NDB'
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 char(3)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with ord(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('1');
+insert into t1 values ('9');
+insert into t2 values ('1');
+insert into t2 values ('9');
+insert into t2 values ('3');
+insert into t3 values ('1');
+insert into t3 values ('9');
+insert into t3 values ('3');
+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 order by col1;
+col1
+1
+9
+select * from t2 order by col1;
+col1
+1
+3
+9
+select * from t3 order by col1;
+col1
+1
+3
+9
+select * from t4 order by colint;
+colint col1
+1 1
+2 9
+3 3
+4 8
+select * from t5 order by colint;
+colint col1
+1 1
+2 9
+3 3
+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 8
+2 9
+3 3
+4 8
+-------------------------------------------------------------------------
+--- Alter tables with ord(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(ord(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(ord(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(ord(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(ord(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (ord('a')),
+partition p1 values less than maxvalue);
+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
+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
+8
+9
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 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
+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
+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 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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- day(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with day(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(day(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(day(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(day(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with day(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-02-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-02-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-02-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-01-25');
+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)
+17
+3
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-03
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+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-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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(day(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(day(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(day(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(day(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (day('2006-12-21')),
+partition p1 values less than maxvalue);
+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
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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-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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofmonth(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(dayofmonth(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(dayofmonth(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(dayofmonth(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofmonth(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-02-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-02-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-02-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-01-25');
+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)
+17
+3
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-03
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+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-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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofmonth(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofmonth(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(dayofmonth(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofmonth(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofmonth('2006-12-24')),
+partition p1 values less than maxvalue);
+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
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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-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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofweek(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofweek(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(dayofweek(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(dayofweek(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(dayofweek(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofweek(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-02-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-02-17');
+insert into t3 values ('2006-01-25');
+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 order by col1;
+col1
+2006-01-03
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-25
+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
+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
+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 dayofweek(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofweek(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofweek(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(dayofweek(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofweek(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofweek('2006-12-24')),
+partition p1 values less than maxvalue);
+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
+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-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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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
+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
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofyear(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofyear(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(dayofyear(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(dayofyear(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofyear(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-02-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-02-25');
+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 order by col1;
+col1
+2006-01-03
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+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-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
+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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofyear(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(dayofyear(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+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
+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` date DEFAULT NULL
+) ENGINE=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- dayofyear(col1) in partition with coltype char(30)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with dayofyear(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(30)) engine='NDB'
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(30)) engine='NDB'
+partition by list(dayofyear(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 char(30)) engine='NDB'
+partition by hash(dayofyear(col1));
+create table t4 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(30)) engine='NDB'
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with dayofyear(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-02-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-02-25');
+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 order by col1;
+col1
+2006-01-03
+2006-01-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-01-17
+2006-02-25
+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-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
+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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(dayofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(dayofyear(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(dayofyear(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(dayofyear(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (dayofyear('2006-12-25')),
+partition p1 values less than maxvalue);
+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
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- extract(month from col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with extract(month from col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(extract(month from col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(extract(month from col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(extract(month from col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with extract(month from col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-02-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-02-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-02-17');
+insert into t3 values ('2006-01-25');
+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 order by col1;
+col1
+2006-01-03
+2006-02-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-01-25
+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
+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
+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 extract(month from col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(extract(month from col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(extract(month from col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(extract(month from col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(extract(month from col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (extract(year from '1998-11-23')),
+partition p1 values less than maxvalue);
+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
+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-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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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
+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
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- hour(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with hour(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(hour(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(hour(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(hour(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with hour(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09');
+insert into t1 values ('14:30');
+insert into t2 values ('09:09');
+insert into t2 values ('14:30');
+insert into t2 values ('21:59');
+insert into t3 values ('09:09');
+insert into t3 values ('14:30');
+insert into t3 values ('21:59');
+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 order by col1;
+col1
+09:09:00
+14:30:00
+select * from t2 order by col1;
+col1
+09:09:00
+14:30:00
+21:59:00
+select * from t3 order by col1;
+col1
+09:09: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 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 09:09:15
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with hour(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(hour(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(hour(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(hour(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(hour(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (hour('18:30')),
+partition p1 values less than maxvalue);
+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
+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: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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- microsecond(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with microsecond(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(microsecond(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(microsecond(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(microsecond(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with microsecond(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:15.000002');
+insert into t1 values ('04:30:01.000018');
+insert into t2 values ('09:09:15.000002');
+insert into t2 values ('04:30:01.000018');
+insert into t2 values ('00:59:22.000024');
+insert into t3 values ('09:09:15.000002');
+insert into t3 values ('04:30:01.000018');
+insert into t3 values ('00:59:22.000024');
+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 order by col1;
+col1
+04:30:01
+09:09:15
+select * from t2 order by col1;
+col1
+00:59:22
+04:30:01
+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
+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
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 05:30:34
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with microsecond(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(microsecond(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(microsecond(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(microsecond(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(microsecond(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (microsecond('10:30:10.000010')),
+partition p1 values less than maxvalue);
+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
+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
+04:30:01
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 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
+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 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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- minute(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with minute(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(minute(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(minute(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(minute(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with minute(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:15');
+insert into t1 values ('14:30:45');
+insert into t2 values ('09:09:15');
+insert into t2 values ('14:30:45');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:15');
+insert into t3 values ('14:30:45');
+insert into t3 values ('21:59:22');
+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 order by col1;
+col1
+09:09:15
+14:30:45
+select * from t2 order by col1;
+col1
+09:09:15
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:15
+14:30:45
+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
+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 10:24:23
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with minute(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(minute(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(minute(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(minute(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(minute(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (minute('18:30')),
+partition p1 values less than maxvalue);
+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
+select * from t55 order by colint;
+colint col1
+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 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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- second(col1) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with second(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(second(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(second(col1));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with second(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:09');
+insert into t1 values ('14:30:20');
+insert into t2 values ('09:09:09');
+insert into t2 values ('14:30:20');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:09');
+insert into t3 values ('14:30:20');
+insert into t3 values ('21:59:22');
+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 order by col1;
+col1
+09:09:09
+14:30:20
+select * from t2 order by col1;
+col1
+09:09:09
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:09
+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
+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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(second(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(second(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+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
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- second(col1) in partition with coltype char(30)
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with second(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 char(30)) engine='NDB'
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 char(30)) engine='NDB'
+partition by list(second(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 char(30)) engine='NDB'
+partition by hash(second(col1));
+create table t4 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 char(30)) engine='NDB'
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 char(30)) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with second(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:09');
+insert into t1 values ('14:30:20');
+insert into t2 values ('09:09:09');
+insert into t2 values ('14:30:20');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:09');
+insert into t3 values ('14:30:20');
+insert into t3 values ('21:59:22');
+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 order by col1;
+col1
+09:09:09
+14:30:20
+select * from t2 order by col1;
+col1
+09:09:09
+14:30:20
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:09
+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
+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 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)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(second(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(second(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(second(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(second(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (second('18:30:14')),
+partition p1 values less than maxvalue);
+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
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 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.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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- month(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with month(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(month(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(month(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(month(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with month(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-12-17');
+insert into t2 values ('2006-05-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-12-17');
+insert into t3 values ('2006-05-25');
+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 order by col1;
+col1
+2006-01-03
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-05-25
+2006-12-17
+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
+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
+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 month(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(month(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(month(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(month(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(month(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (month('2006-10-14')),
+partition p1 values less than maxvalue);
+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
+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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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
+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
+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
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- quarter(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with quarter(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(quarter(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(quarter(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(quarter(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with quarter(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-12-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-12-17');
+insert into t2 values ('2006-09-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-12-17');
+insert into t3 values ('2006-09-25');
+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 order by col1;
+col1
+2006-01-03
+2006-12-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-09-25
+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
+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
+-------------------------------------------------------------------------
+--- Alter tables with quarter(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(quarter(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(quarter(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(quarter(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(quarter(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (quarter('2006-10-14')),
+partition p1 values less than maxvalue);
+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
+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-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=NDB 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 = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 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-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-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
+60 2006-12-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- time_to_sec(col1)-(time_to_sec(col1)-20) in partition with coltype time
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+create table t1 (col1 time) engine='NDB'
+partition by range(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 time) engine='NDB'
+partition by list(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 time) engine='NDB'
+partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
+create table t4 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 time) engine='NDB'
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 time) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+insert into t1 values ('09:09:15');
+insert into t1 values ('14:30:45');
+insert into t2 values ('09:09:15');
+insert into t2 values ('14:30:45');
+insert into t2 values ('21:59:22');
+insert into t3 values ('09:09:15');
+insert into t3 values ('14:30:45');
+insert into t3 values ('21:59:22');
+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 time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
+time_to_sec(col1)-(time_to_sec(col1)-20)
+20
+20
+select * from t1 order by col1;
+col1
+09:09:15
+14:30:45
+select * from t2 order by col1;
+col1
+09:09:15
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+09:09:15
+14:30:45
+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
+update t1 set col1='10:33:11' where col1='09:09:15';
+update t2 set col1='10:33:11' where col1='09:09:15';
+update t3 set col1='10:33:11' where col1='09:09:15';
+update t4 set col1='10:33:11' where col1='09:09:15';
+update t5 set col1='10:33:11' where col1='09:09:15';
+update t6 set col1='10:33:11' where col1='09:09:15';
+select * from t1 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t6 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(time_to_sec(col1)-(time_to_sec(col1)-20))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
+alter table t44
+partition by range(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+10:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+14:30:45
+alter table t55
+partition by list(colint)
+subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) 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=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+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:33:11
+select * from t2 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t5 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t4 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+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:33:11
+14:30:45
+select * from t2 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t3 order by col1;
+col1
+10:33:11
+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
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
+-------------------------------------------------------------------------
+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:33:11
+select * from t22 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+2 04:30:01
+3 00:59:22
+4 05:30:34
+select * from t55 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t44 order by colint;
+colint col1
+1 10:33:11
+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:33:11
+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:33:11
+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:33:11
+14:30:45
+select * from t22 order by col1;
+col1
+10:33:11
+14:30:45
+21:59:22
+select * from t33 order by col1;
+col1
+10:33:11
+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
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- to_days(col1)-to_days('2006-01-01') in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(to_days(col1)-to_days('2006-01-01'));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+insert into t1 values ('2006-02-03');
+insert into t1 values ('2006-01-17');
+insert into t2 values ('2006-02-03');
+insert into t2 values ('2006-01-17');
+insert into t2 values ('2006-01-25');
+insert into t3 values ('2006-02-03');
+insert into t3 values ('2006-01-17');
+insert into t3 values ('2006-01-25');
+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 to_days(col1)-to_days('2006-01-01') from t1 order by col1;
+to_days(col1)-to_days('2006-01-01')
+16
+33
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-03
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-03
+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-06' where col1='2006-02-03';
+update t2 set col1='2006-02-06' where col1='2006-02-03';
+update t3 set col1='2006-02-06' where col1='2006-02-03';
+update t4 set col1='2006-02-06' where col1='2006-02-03';
+update t5 set col1='2006-02-06' where col1='2006-02-03';
+update t6 set col1='2006-02-06' where col1='2006-02-03';
+select * from t1 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Alter tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(to_days(col1)-to_days('2006-01-01'))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(to_days(col1)-to_days('2006-01-01'));
+alter table t44
+partition by range(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-01-17
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+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-06
+alter table t55
+partition by list(colint)
+subpartition by hash(to_days(col1)-to_days('2006-01-01')) 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=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+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-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+alter table t66
+reorganize partition s1 into
+(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
+partition p1 values less than maxvalue);
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+2 2006-01-17
+3 2006-01-25
+4 2006-02-05
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+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-06
+select * from t2 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t4 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t5 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t6 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t2 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t3 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+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 to_days(col1)-to_days('2006-01-01')
+-------------------------------------------------------------------------
+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-06
+select * from t22 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t44 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t55 order by colint;
+colint col1
+1 2006-02-06
+3 2006-01-25
+4 2006-02-05
+60 2006-01-17
+select * from t66 order by colint;
+colint col1
+1 2006-02-06
+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-06
+select * from t22 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+select * from t33 order by col1;
+col1
+2006-01-17
+2006-01-25
+2006-02-06
+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 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- weekday(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with weekday(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(weekday(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(weekday(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(weekday(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with weekday(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-12-03');
+insert into t1 values ('2006-11-17');
+insert into t2 values ('2006-12-03');
+insert into t2 values ('2006-11-17');
+insert into t2 values ('2006-05-25');
+insert into t3 values ('2006-12-03');
+insert into t3 values ('2006-11-17');
+insert into t3 values ('2006-05-25');
+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 weekday(col1) from t1 order by col1;
+weekday(col1)
+4
+6
+select * from t1 order by col1;
+col1
+2006-11-17
+2006-12-03
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-11-17
+2006-12-03
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-11-17
+2006-12-03
+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-06' where col1='2006-12-03';
+update t2 set col1='2006-02-06' where col1='2006-12-03';
+update t3 set col1='2006-02-06' where col1='2006-12-03';
+update t4 set col1='2006-02-06' where col1='2006-12-03';
+update t5 set col1='2006-02-06' where col1='2006-12-03';
+update t6 set col1='2006-02-06' where col1='2006-12-03';
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-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
+-------------------------------------------------------------------------
+--- Alter tables with weekday(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(weekday(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(weekday(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(weekday(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (weekday('2006-10-14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-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-02-06
+2006-11-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-06
+2006-11-17
+alter table t55
+partition by list(colint)
+subpartition by hash(weekday(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=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 (weekday('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 (weekday('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 weekday(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-11-17';
+delete from t2 where col1='2006-11-17';
+delete from t3 where col1='2006-11-17';
+delete from t4 where col1='2006-11-17';
+delete from t5 where col1='2006-11-17';
+delete from t6 where col1='2006-11-17';
+select * from t1 order by col1;
+col1
+2006-02-06
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+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-11-17');
+insert into t2 values ('2006-11-17');
+insert into t3 values ('2006-11-17');
+insert into t4 values (60,'2006-11-17');
+insert into t5 values (60,'2006-11-17');
+insert into t6 values (60,'2006-11-17');
+select * from t1 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t2 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t3 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-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-11-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-11-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-11-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-02-06
+2006-05-25
+2006-11-17
+select * from t4 order by colint;
+colint col1
+60 2006-11-17
+select * from t5 order by colint;
+colint col1
+60 2006-11-17
+select * from t6 order by colint;
+colint col1
+60 2006-11-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekday(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-11-17';
+delete from t22 where col1='2006-11-17';
+delete from t33 where col1='2006-11-17';
+delete from t44 where col1='2006-11-17';
+delete from t55 where col1='2006-11-17';
+delete from t66 where col1='2006-11-17';
+select * from t11 order by col1;
+col1
+2006-02-06
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-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-11-17');
+insert into t22 values ('2006-11-17');
+insert into t33 values ('2006-11-17');
+insert into t44 values (60,'2006-11-17');
+insert into t55 values (60,'2006-11-17');
+insert into t66 values (60,'2006-11-17');
+select * from t11 order by col1;
+col1
+2006-02-06
+2006-11-17
+select * from t22 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-17
+select * from t33 order by col1;
+col1
+2006-02-06
+2006-05-25
+2006-11-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-11-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-11-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-11-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-02-06
+2006-05-25
+2006-11-17
+select * from t44 order by colint;
+colint col1
+60 2006-11-17
+select * from t55 order by colint;
+colint col1
+60 2006-11-17
+select * from t66 order by colint;
+colint col1
+60 2006-11-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- weekofyear(col1) in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with weekofyear(col1)
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(weekofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(weekofyear(col1))
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(weekofyear(col1));
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with weekofyear(col1)
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-03-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-03-17');
+insert into t2 values ('2006-05-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-03-17');
+insert into t3 values ('2006-05-25');
+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 weekofyear(col1) from t1 order by col1;
+weekofyear(col1)
+1
+11
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-03-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-03-17
+2006-05-25
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-03-17
+2006-05-25
+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-09-06' where col1='2006-01-03';
+update t2 set col1='2006-09-06' where col1='2006-01-03';
+update t3 set col1='2006-09-06' where col1='2006-01-03';
+update t4 set col1='2006-09-06' where col1='2006-01-03';
+update t5 set col1='2006-09-06' where col1='2006-01-03';
+update t6 set col1='2006-09-06' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+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 weekofyear(col1)
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(weekofyear(col1))
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(weekofyear(col1))
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(weekofyear(col1));
+alter table t44
+partition by range(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(col1)) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (weekofyear('2006-02-14')),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+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-03-17
+2006-09-06
+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-03-17
+2006-09-06
+alter table t55
+partition by list(colint)
+subpartition by hash(weekofyear(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=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 (weekofyear('2006-02-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 (weekofyear('2006-02-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 weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-03-17';
+delete from t2 where col1='2006-03-17';
+delete from t3 where col1='2006-03-17';
+delete from t4 where col1='2006-03-17';
+delete from t5 where col1='2006-03-17';
+delete from t6 where col1='2006-03-17';
+select * from t1 order by col1;
+col1
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-05-25
+2006-09-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-03-17');
+insert into t2 values ('2006-03-17');
+insert into t3 values ('2006-03-17');
+insert into t4 values (60,'2006-03-17');
+insert into t5 values (60,'2006-03-17');
+insert into t6 values (60,'2006-03-17');
+select * from t1 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+60 2006-03-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-03-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-03-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-09-06
+select * from t2 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t3 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t4 order by colint;
+colint col1
+60 2006-03-17
+select * from t5 order by colint;
+colint col1
+60 2006-03-17
+select * from t6 order by colint;
+colint col1
+60 2006-03-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with weekofyear(col1)
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-03-17';
+delete from t22 where col1='2006-03-17';
+delete from t33 where col1='2006-03-17';
+delete from t44 where col1='2006-03-17';
+delete from t55 where col1='2006-03-17';
+delete from t66 where col1='2006-03-17';
+select * from t11 order by col1;
+col1
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-05-25
+2006-09-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-03-17');
+insert into t22 values ('2006-03-17');
+insert into t33 values ('2006-03-17');
+insert into t44 values (60,'2006-03-17');
+insert into t55 values (60,'2006-03-17');
+insert into t66 values (60,'2006-03-17');
+select * from t11 order by col1;
+col1
+2006-03-17
+2006-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-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
+60 2006-03-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-03-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-03-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-09-06
+select * from t22 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t33 order by col1;
+col1
+2006-03-17
+2006-05-25
+2006-09-06
+select * from t44 order by colint;
+colint col1
+60 2006-03-17
+select * from t55 order by colint;
+colint col1
+60 2006-03-17
+select * from t66 order by colint;
+colint col1
+60 2006-03-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- year(col1)-1990 in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with year(col1)-1990
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(year(col1)-1990)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(year(col1)-1990)
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(year(col1)-1990);
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with year(col1)-1990
+-------------------------------------------------------------------------
+insert into t1 values ('1996-01-03');
+insert into t1 values ('2000-02-17');
+insert into t2 values ('1996-01-03');
+insert into t2 values ('2000-02-17');
+insert into t2 values ('2004-05-25');
+insert into t3 values ('1996-01-03');
+insert into t3 values ('2000-02-17');
+insert into t3 values ('2004-05-25');
+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 year(col1)-1990 from t1 order by col1;
+year(col1)-1990
+6
+10
+select * from t1 order by col1;
+col1
+1996-01-03
+2000-02-17
+select * from t2 order by col1;
+col1
+1996-01-03
+2000-02-17
+2004-05-25
+select * from t3 order by col1;
+col1
+1996-01-03
+2000-02-17
+2004-05-25
+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='2002-02-15' where col1='1996-01-03';
+update t2 set col1='2002-02-15' where col1='1996-01-03';
+update t3 set col1='2002-02-15' where col1='1996-01-03';
+update t4 set col1='2002-02-15' where col1='1996-01-03';
+update t5 set col1='2002-02-15' where col1='1996-01-03';
+update t6 set col1='2002-02-15' where col1='1996-01-03';
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+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
+-------------------------------------------------------------------------
+--- Alter tables with year(col1)-1990
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(year(col1)-1990)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(year(col1)-1990)
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(year(col1)-1990);
+alter table t44
+partition by range(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (year('2005-10-14')-1990),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-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
+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
+2000-02-17
+2002-02-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
+2000-02-17
+2002-02-15
+alter table t55
+partition by list(colint)
+subpartition by hash(year(col1)-1990) 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=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 (year('2005-10-14')-1990),
+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 (year('2005-10-14')-1990),
+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 year(col1)-1990
+-------------------------------------------------------------------------
+delete from t1 where col1='2000-02-17';
+delete from t2 where col1='2000-02-17';
+delete from t3 where col1='2000-02-17';
+delete from t4 where col1='2000-02-17';
+delete from t5 where col1='2000-02-17';
+delete from t6 where col1='2000-02-17';
+select * from t1 order by col1;
+col1
+2002-02-15
+select * from t2 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2002-02-15
+2004-05-25
+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 ('2000-02-17');
+insert into t2 values ('2000-02-17');
+insert into t3 values ('2000-02-17');
+insert into t4 values (60,'2000-02-17');
+insert into t5 values (60,'2000-02-17');
+insert into t6 values (60,'2000-02-17');
+select * from t1 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t2 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+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 2000-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 2000-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 2000-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
+2002-02-15
+2004-05-25
+select * from t3 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t4 order by colint;
+colint col1
+60 2000-02-17
+select * from t5 order by colint;
+colint col1
+60 2000-02-17
+select * from t6 order by colint;
+colint col1
+60 2000-02-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with year(col1)-1990
+-------------------------------------------------------------------------
+delete from t11 where col1='2000-02-17';
+delete from t22 where col1='2000-02-17';
+delete from t33 where col1='2000-02-17';
+delete from t44 where col1='2000-02-17';
+delete from t55 where col1='2000-02-17';
+delete from t66 where col1='2000-02-17';
+select * from t11 order by col1;
+col1
+2002-02-15
+select * from t22 order by col1;
+col1
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2002-02-15
+2004-05-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 ('2000-02-17');
+insert into t22 values ('2000-02-17');
+insert into t33 values ('2000-02-17');
+insert into t44 values (60,'2000-02-17');
+insert into t55 values (60,'2000-02-17');
+insert into t66 values (60,'2000-02-17');
+select * from t11 order by col1;
+col1
+2000-02-17
+2002-02-15
+select * from t22 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-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
+60 2000-02-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 2000-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 2000-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
+2002-02-15
+2004-05-25
+select * from t33 order by col1;
+col1
+2000-02-17
+2002-02-15
+2004-05-25
+select * from t44 order by colint;
+colint col1
+60 2000-02-17
+select * from t55 order by colint;
+colint col1
+60 2000-02-17
+select * from t66 order by colint;
+colint col1
+60 2000-02-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+-------------------------------------------------------------------------
+--- yearweek(col1)-200600 in partition with coltype date
+-------------------------------------------------------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+-------------------------------------------------------------------------
+--- Create tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+create table t1 (col1 date) engine='NDB'
+partition by range(yearweek(col1)-200600)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t2 (col1 date) engine='NDB'
+partition by list(yearweek(col1)-200600)
+(partition p0 values in (0,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)
+);
+create table t3 (col1 date) engine='NDB'
+partition by hash(yearweek(col1)-200600);
+create table t4 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+create table t5 (colint int, col1 date) engine='NDB'
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(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)
+);
+create table t6 (colint int, col1 date) engine='NDB'
+partition by range(colint)
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+-------------------------------------------------------------------------
+--- Access tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+insert into t1 values ('2006-01-03');
+insert into t1 values ('2006-08-17');
+insert into t2 values ('2006-01-03');
+insert into t2 values ('2006-08-17');
+insert into t2 values ('2006-03-25');
+insert into t3 values ('2006-01-03');
+insert into t3 values ('2006-08-17');
+insert into t3 values ('2006-03-25');
+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 yearweek(col1)-200600 from t1 order by col1;
+yearweek(col1)-200600
+1
+33
+select * from t1 order by col1;
+col1
+2006-01-03
+2006-08-17
+select * from t2 order by col1;
+col1
+2006-01-03
+2006-03-25
+2006-08-17
+select * from t3 order by col1;
+col1
+2006-01-03
+2006-03-25
+2006-08-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-15' where col1='2006-01-03';
+update t2 set col1='2006-11-15' where col1='2006-01-03';
+update t3 set col1='2006-11-15' where col1='2006-01-03';
+update t4 set col1='2006-11-15' where col1='2006-01-03';
+update t5 set col1='2006-11-15' where col1='2006-01-03';
+update t6 set col1='2006-11-15' where col1='2006-01-03';
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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
+-------------------------------------------------------------------------
+--- Alter tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
+create table t11 engine='NDB' as select * from t1;
+create table t22 engine='NDB' as select * from t2;
+create table t33 engine='NDB' as select * from t3;
+create table t44 engine='NDB' as select * from t4;
+create table t55 engine='NDB' as select * from t5;
+create table t66 engine='NDB' as select * from t6;
+alter table t11
+partition by range(yearweek(col1)-200600)
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t22
+partition by list(yearweek(col1)-200600)
+(partition p0 values in (0,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)
+);
+alter table t33
+partition by hash(yearweek(col1)-200600);
+alter table t44
+partition by range(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(partition p0 values less than (15),
+partition p1 values less than maxvalue);
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) subpartitions 2
+(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)
+);
+alter table t66
+partition by range(colint)
+(partition p0 values less than (yearweek('2006-10-14')-200600),
+partition p1 values less than maxvalue);
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-17
+2006-11-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
+2006-08-17
+2006-11-15
+alter table t55
+partition by list(colint)
+subpartition by hash(yearweek(col1)-200600) 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=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
+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 (yearweek('2006-10-14')-200600),
+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 (yearweek('2006-10-14')-200600),
+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 yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t1 where col1='2006-08-17';
+delete from t2 where col1='2006-08-17';
+delete from t3 where col1='2006-08-17';
+delete from t4 where col1='2006-08-17';
+delete from t5 where col1='2006-08-17';
+delete from t6 where col1='2006-08-17';
+select * from t1 order by col1;
+col1
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-11-15
+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-08-17');
+insert into t2 values ('2006-08-17');
+insert into t3 values ('2006-08-17');
+insert into t4 values (60,'2006-08-17');
+insert into t5 values (60,'2006-08-17');
+insert into t6 values (60,'2006-08-17');
+select * from t1 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-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-08-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-08-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-08-17
+2006-11-15
+select * from t2 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t3 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t4 order by colint;
+colint col1
+60 2006-08-17
+select * from t5 order by colint;
+colint col1
+60 2006-08-17
+select * from t6 order by colint;
+colint col1
+60 2006-08-17
+-------------------------------------------------------------------------
+--- Delete rows and partitions of tables with yearweek(col1)-200600
+-------------------------------------------------------------------------
+delete from t11 where col1='2006-08-17';
+delete from t22 where col1='2006-08-17';
+delete from t33 where col1='2006-08-17';
+delete from t44 where col1='2006-08-17';
+delete from t55 where col1='2006-08-17';
+delete from t66 where col1='2006-08-17';
+select * from t11 order by col1;
+col1
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-11-15
+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-08-17');
+insert into t22 values ('2006-08-17');
+insert into t33 values ('2006-08-17');
+insert into t44 values (60,'2006-08-17');
+insert into t55 values (60,'2006-08-17');
+insert into t66 values (60,'2006-08-17');
+select * from t11 order by col1;
+col1
+2006-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+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-08-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-08-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-08-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-08-17
+2006-11-15
+select * from t22 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t33 order by col1;
+col1
+2006-03-25
+2006-08-17
+2006-11-15
+select * from t44 order by colint;
+colint col1
+60 2006-08-17
+select * from t55 order by colint;
+colint col1
+60 2006-08-17
+select * from t66 order by colint;
+colint col1
+60 2006-08-17
+-------------------------
+---- some alter table end
+-------------------------
+drop table if exists t1 ;
+drop table if exists t2 ;
+drop table if exists t3 ;
+drop table if exists t4 ;
+drop table if exists t5 ;
+drop table if exists t6 ;
+drop table if exists t11 ;
+drop table if exists t22 ;
+drop table if exists t33 ;
+drop table if exists t44 ;
+drop table if exists t55 ;
+drop table if exists t66 ;
diff --git a/mysql-test/suite/partitions/r/partition_t55.out b/mysql-test/suite/partitions/r/partition_t55.out
new file mode 100644
index 00000000000..d86ceda8c38
--- /dev/null
+++ b/mysql-test/suite/partitions/r/partition_t55.out
@@ -0,0 +1,68 @@
+show create table t55;
+Table Create Table
+t55 CREATE TABLE `t55` (
+ `colint` int(11) DEFAULT NULL,
+ `col1` int(11) DEFAULT NULL
+) ENGINE=MyISAM 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 = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
+27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYI
+36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYI
+36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYI
+27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYI
+18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYI
+45 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYI
+0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYI
+9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYD
+1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYI
+8594 MYSQL_TEST_DIR/var/master-data/test/t55.frm
+408 MYSQL_TEST_DIR/var/master-data/test/t55.par
diff --git a/mysql-test/suite/partitions/t/disabled.def b/mysql-test/suite/partitions/t/disabled.def
index ede5d6b6e60..212ca0206e2 100644
--- a/mysql-test/suite/partitions/t/disabled.def
+++ b/mysql-test/suite/partitions/t/disabled.def
@@ -13,4 +13,4 @@ partition_alter2_ndb : cannot create t1
partition_char_innodb : crash. Bug? More investigations
partition_sessions : needs system_3_init.inc
partition_engine_ndb : cannot create t1
-
+partition_supported_sql_func_ndb : cannot create t1
diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test
index 4440f814d1e..135c869c841 100644
--- a/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test
+++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_innodb.test
@@ -2,8 +2,8 @@
# t/partition_supported_sql_funcs_innodb.test #
# #
# Purpose: #
-# Tests around sql functions #
-# INNODB branch #
+# Tests which SQL functions are allowed in partinioning clauses with #
+# INNODB. #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
@@ -18,16 +18,12 @@
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
-# Please read the README at the end of include/partition.pre before changing
-# any of the variables.
-#
-
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
-let $do_long_tests= 0;
+let $do_long_tests= 1;
# The server must support partitioning.
--source include/have_partition.inc
diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test
index 3daa72c7ff7..131a5e23f39 100644
--- a/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test
+++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_myisam.test
@@ -2,8 +2,8 @@
# t/partition_supported_sql_funcs_myisam.test #
# #
# Purpose: #
-# Tests around sql functions #
-# MyISAM branch #
+# Tests which SQL functions are allowed in partinioning clauses with #
+# MYISAM. #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
@@ -27,7 +27,7 @@
##### Options, for debugging support #####
let $debug= 0;
-let $do_long_tests= 0;
+let $do_long_tests= 1;
# The server must support partitioning.
--source include/have_partition.inc
diff --git a/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test b/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test
new file mode 100644
index 00000000000..2a536fbce94
--- /dev/null
+++ b/mysql-test/suite/partitions/t/partition_supported_sql_func_ndb.test
@@ -0,0 +1,40 @@
+################################################################################
+# t/partition_supported_sql_funcs_myisam.test #
+# #
+# Purpose: #
+# Tests which SQL functions are allowed in partinioning clauses with #
+# NDB. #
+# #
+#------------------------------------------------------------------------------#
+# Original Author: HH #
+# Original Date: 2006-11-22 #
+# Change Author: #
+# Change Date: #
+# Change: #
+################################################################################
+
+#
+# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE !
+# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
+# THE SOURCED FILES ONLY.
+#------------------------------------------------------------------------------#
+# General not engine specific settings and requirements
+
+##### Options, for debugging support #####
+let $debug= 0;
+let $do_long_tests= 1;
+
+# The server must support partitioning.
+--source include/have_partition.inc
+
+#------------------------------------------------------------------------------#
+# Engine specific settings and requirements
+
+--source include/have_ndb.inc
+##### Storage engine to be tested
+let $engine= 'NDB';
+
+#------------------------------------------------------------------------------#
+--source suite/partitions/include/partition_supported_sql_funcs_main.inc
+# --source include/partition_supported_sql_funcs_main.inc
+
diff --git a/mysql-test/suite/row_lock/include/row_lock.inc b/mysql-test/suite/row_lock/include/row_lock.inc
new file mode 100644
index 00000000000..8572bc0246e
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock.inc
@@ -0,0 +1,83 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+COMMIT;
+SELECT @@global.tx_isolation;
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
new file mode 100644
index 00000000000..f0823067eac
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_big_tab.inc
@@ -0,0 +1,94 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext2;
+DELIMITER |;
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT count(*)/2 INTO res FROM t1;
+ RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT count(*)/2 INTO res FROM t2;
+ RETURN res;
+END;
+|
+DELIMITER ;|
+CALL fill_t1 (10);
+CALL fill_t2 (10);
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT k from t1 WHERE k < half_t1();
+SELECT k from t1 WHERE k >= half_t1();
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
new file mode 100644
index 00000000000..8535c016819
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_big_tab_1.inc
@@ -0,0 +1,93 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext2;
+DELIMITER |;
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t1;
+ RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t2;
+ RETURN res;
+END;
+|
+DELIMITER ;|
+eval CALL fill_t1 ($nbrows);
+eval CALL fill_t2 ($nbrows);
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
new file mode 100644
index 00000000000..050f2a54016
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_big_tab_2.inc
@@ -0,0 +1,93 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+eval $indext2;
+DELIMITER |;
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t1;
+ RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+ INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+ SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+ DECLARE res int DEFAULT 0;
+ SELECT MOD(k,2) INTO res FROM t2;
+ RETURN res;
+END;
+|
+DELIMITER ;|
+eval CALL fill_t1 ($nbrows);
+eval CALL fill_t2 ($nbrows);
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+#SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k FOR UPDATE;
+DELETE FROM t1 WHERE t1.k % 2 = 1;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 WHERE k < 40 ORDER BY t1.k;
+SELECT * FROM t2 WHERE k < 40 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_trig.inc b/mysql-test/suite/row_lock/include/row_lock_trig.inc
new file mode 100644
index 00000000000..384f00f243e
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_trig.inc
@@ -0,0 +1,96 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+DELIMITER |;
+
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+ FOR EACH ROW BEGIN
+ UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+ END;
+|
+
+DELIMITER ;|
+
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_view.inc b/mysql-test/suite/row_lock/include/row_lock_view.inc
new file mode 100644
index 00000000000..fbed8f64d3a
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view.inc
@@ -0,0 +1,89 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE v1 SET i=325 where i=125;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE v1 SET i=326 where i=126;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_mix.inc b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
new file mode 100644
index 00000000000..9e8cf3d34fc
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view_mix.inc
@@ -0,0 +1,92 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+# With the two separate selects (without join) the differs from
+# that select with join.
+
+# Both transaction are able to update the tables
+eval EXPLAIN $select;
+eval $select;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+#UPDATE v1 SET i=325 where i=125;
+#SELECT * FROM v1 ORDER BY i,l;
+#SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+SELECT * FROM t1 ORDER BY t1.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
+#DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
new file mode 100644
index 00000000000..479392098be
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view_storedp.inc
@@ -0,0 +1,126 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS stp_t;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+CONNECT (root2, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i from t1;
+DELIMITER |;
+
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+ BEGIN
+ UPDATE t2 SET i = p2 WHERE i = p1;
+ UPDATE v1 SET i = p2 WHERE i = p1;
+ SELECT * FROM v1 ORDER BY i;
+ SELECT * FROM t1 ORDER BY t1.k;
+ SELECT * FROM t2 ORDER BY t2.k;
+ END;
+|
+
+DELIMITER ;|
+
+COMMIT;
+SELECT @@global.tx_isolation;
+eval EXPLAIN $select;
+eval $select;
+--echo connection root1;
+CONNECTION root1;
+CALL stp_t (125, 225);
+
+--echo connection root2;
+CONNECTION root2;
+CALL stp_t (127, 227);
+
+--echo connection default;
+CONNECTION default;
+CALL stp_t (123, 223);
+
+--echo connection root1;
+CONNECTION root1;
+CALL stp_t (126, 226);
+
+--echo connection root2;
+CONNECTION root2;
+CALL stp_t (128, 228);
+
+--echo connection default;
+CONNECTION default;
+CALL stp_t (124, 224);
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root2;
+CONNECTION root2;
+DELETE FROM t1 WHERE t1.i=228;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection root1;
+CONNECTION root1;
+COMMIT;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+
+--echo connection root2;
+CONNECTION root2;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root2;
+
+--echo connection default;
+CONNECTION default;
+--disable_warnings
+DROP VIEW v1;
+DROP PROCEDURE stp_t;
+DROP TABLE t1, t2;
+--enable_warnings
diff --git a/mysql-test/suite/row_lock/include/row_lock_view_trig.inc b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
new file mode 100644
index 00000000000..785eb1b66a9
--- /dev/null
+++ b/mysql-test/suite/row_lock/include/row_lock_view_trig.inc
@@ -0,0 +1,99 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+SET autocommit=0;
+# Create additional connections used through test
+CONNECT (root1, localhost, root,,);
+SET autocommit=0;
+--echo connection default;
+CONNECTION default;
+eval CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+eval $indext1;
+eval CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=$engine;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+eval $indext2;
+CREATE VIEW v1 AS SELECT t1.i from t1;
+DELIMITER |;
+
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+ FOR EACH ROW BEGIN
+ UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+ END;
+|
+
+DELIMITER ;|
+
+COMMIT;
+SELECT @@global.tx_isolation;
+eval EXPLAIN $select;
+eval $select;
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection default;
+CONNECTION default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+COMMIT;
+
+--echo connection root1;
+CONNECTION root1;
+ROLLBACK;
+
+--echo connection default;
+CONNECTION default;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+
+--echo connection root1;
+CONNECTION root1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+DISCONNECT root1;
+--echo connection default;
+CONNECTION default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
new file mode 100644
index 00000000000..54ed4350ba9
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_1.result
@@ -0,0 +1,142 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
new file mode 100644
index 00000000000..56154e64489
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_2.result
@@ -0,0 +1,32 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_3.result b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
new file mode 100644
index 00000000000..a89c55973d2
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_3.result
@@ -0,0 +1,32 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_4.result b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
new file mode 100644
index 00000000000..310d24a456a
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_4.result
@@ -0,0 +1,142 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_5.result b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
new file mode 100644
index 00000000000..ace5fddfad5
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_5.result
@@ -0,0 +1,32 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
new file mode 100644
index 00000000000..8f00c3a0bb7
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab.result
@@ -0,0 +1,97 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (10);
+CALL fill_t2 (10);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 10 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+connection root1;
+SELECT k from t1 WHERE k < half_t1();
+k
+0
+1
+2
+3
+4
+SELECT k from t1 WHERE k >= half_t1();
+k
+5
+6
+7
+8
+9
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 1111 0 100
+1 1111 1 101
+2 1111 2 102
+3 1111 3 103
+4 1111 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 2222 0 100
+1 2222 1 101
+2 2222 2 102
+3 2222 3 103
+4 2222 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
new file mode 100644
index 00000000000..0b12f149193
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_1.result
@@ -0,0 +1,145 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (40);
+CALL fill_t2 (40);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+100 100
+102 102
+104 104
+106 106
+108 108
+110 110
+112 112
+114 114
+116 116
+118 118
+120 120
+122 122
+124 124
+126 126
+128 128
+130 130
+132 132
+134 134
+136 136
+138 138
+connection root1;
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+101 101
+103 103
+105 105
+107 107
+109 109
+111 111
+113 113
+115 115
+117 117
+119 119
+121 121
+123 123
+125 125
+127 127
+129 129
+131 131
+133 133
+135 135
+137 137
+139 139
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 1111 1 101
+2 102 2 102
+3 1111 3 103
+4 104 4 104
+5 1111 5 105
+6 106 6 106
+7 1111 7 107
+8 108 8 108
+9 1111 9 109
+10 110 10 110
+11 1111 11 111
+12 112 12 112
+13 1111 13 113
+14 114 14 114
+15 1111 15 115
+16 116 16 116
+17 1111 17 117
+18 118 18 118
+19 1111 19 119
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 2222 1 101
+2 102 2 102
+3 2222 3 103
+4 104 4 104
+5 2222 5 105
+6 106 6 106
+7 2222 7 107
+8 108 8 108
+9 2222 9 109
+10 110 10 110
+11 2222 11 111
+12 112 12 112
+13 2222 13 113
+14 114 14 114
+15 2222 15 115
+16 116 16 116
+17 2222 17 117
+18 118 18 118
+19 2222 19 119
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
new file mode 100644
index 00000000000..cc9f297f9fb
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_big_tab_2.result
@@ -0,0 +1,113 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (40);
+CALL fill_t2 (40);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY ixi 5 NULL 40 Using where; Using index
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+100 100
+102 102
+104 104
+106 106
+108 108
+110 110
+112 112
+114 114
+116 116
+118 118
+120 120
+122 122
+124 124
+126 126
+128 128
+130 130
+132 132
+134 134
+136 136
+138 138
+connection root1;
+DELETE FROM t1 WHERE t1.k % 2 = 1;
+SELECT * FROM t1 WHERE k < 20 ORDER BY t1.k;
+k i j l
+0 100 0 100
+2 102 2 102
+4 104 4 104
+6 106 6 106
+8 108 8 108
+10 110 10 110
+12 112 12 112
+14 114 14 114
+16 116 16 116
+18 118 18 118
+SELECT * FROM t2 WHERE k < 20 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+10 110 10 110
+11 111 11 111
+12 112 12 112
+13 113 13 113
+14 114 14 114
+15 115 15 115
+16 116 16 116
+17 117 17 117
+18 118 18 118
+19 119 19 119
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k % 2 = 0 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
new file mode 100644
index 00000000000..dd43e5752e5
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_1.result
@@ -0,0 +1,151 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
new file mode 100644
index 00000000000..cb3a5c692e9
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_trig_2.result
@@ -0,0 +1,37 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
new file mode 100644
index 00000000000..834cb669833
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_1.result
@@ -0,0 +1,34 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
new file mode 100644
index 00000000000..440138d4cd1
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_2.result
@@ -0,0 +1,40 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
new file mode 100644
index 00000000000..230873b67a0
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_1.result
@@ -0,0 +1,48 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 2 Using where; Using index
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
new file mode 100644
index 00000000000..d792d573f8e
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_mix_2.result
@@ -0,0 +1,40 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 4 Using index
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
new file mode 100644
index 00000000000..77b9a4dd964
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_1.result
@@ -0,0 +1,312 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 6 Using where; Using index
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
+i
+123
+124
+126
+127
+128
+225
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (127, 227);
+i
+123
+124
+125
+126
+128
+227
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+connection default;
+CALL stp_t (123, 223);
+i
+124
+125
+126
+127
+128
+223
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+CALL stp_t (126, 226);
+i
+123
+124
+127
+128
+225
+226
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (128, 228);
+i
+123
+124
+125
+126
+227
+228
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+CALL stp_t (124, 224);
+i
+125
+126
+127
+128
+223
+224
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+DELETE FROM t1 WHERE t1.i=228;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+COMMIT;
+connection root1;
+ROLLBACK;
+connection root1;
+COMMIT;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+125
+126
+227
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
new file mode 100644
index 00000000000..73d8a3f4bea
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_storedp_2.result
@@ -0,0 +1,47 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
new file mode 100644
index 00000000000..90383a9489f
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_1.result
@@ -0,0 +1,183 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index ixi ixi 5 NULL 4 Using where; Using index
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+126
+225
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM v1 ORDER BY i;
+i
+124
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+225
+226
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+224
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
new file mode 100644
index 00000000000..55793558b21
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/innodb_row_lock_view_trig_2.result
@@ -0,0 +1,38 @@
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
new file mode 100644
index 00000000000..248c7d5ea1f
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_1.result
@@ -0,0 +1,139 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
new file mode 100644
index 00000000000..109d99dd036
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_2.result
@@ -0,0 +1,31 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_3.result b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
new file mode 100644
index 00000000000..c936ea209ff
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_3.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_4.result b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
new file mode 100644
index 00000000000..875c783bd81
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_4.result
@@ -0,0 +1,139 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=223,t2.i=223 WHERE t1.i=123 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t1,t2 SET t1.i=224,t2.i=224 WHERE t1.i=124 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_5.result b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
new file mode 100644
index 00000000000..0d94f8abf72
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_5.result
@@ -0,0 +1,30 @@
+DROP TABLE IF EXISTS t1, t2;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
new file mode 100644
index 00000000000..94b67c63d94
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab.result
@@ -0,0 +1,177 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT count(*)/2 INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (10);
+CALL fill_t2 (10);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+i i
+connection root1;
+SELECT k from t1 WHERE k < half_t1();
+k
+0
+3
+1
+2
+4
+SELECT k from t1 WHERE k >= half_t1();
+k
+6
+7
+9
+5
+8
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k < half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 1111 0 100
+1 1111 1 101
+2 1111 2 102
+3 1111 3 103
+4 1111 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 2222 0 100
+1 2222 1 101
+2 2222 2 102
+3 2222 3 103
+4 2222 4 104
+5 105 5 105
+6 106 6 106
+7 107 7 107
+8 108 8 108
+9 109 9 109
+connection default;
+UPDATE t1,t2 SET t1.i=3333,t2.i=4444 WHERE t1.k >= half_t1() AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 3333 5 105
+6 3333 6 106
+7 3333 7 107
+8 3333 8 108
+9 3333 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 4444 5 105
+6 4444 6 106
+7 4444 7 107
+8 4444 8 108
+9 4444 9 109
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 3333 5 105
+6 3333 6 106
+7 3333 7 107
+8 3333 8 108
+9 3333 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 4444 5 105
+6 4444 6 106
+7 4444 7 107
+8 4444 8 108
+9 4444 9 109
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 3333 5 105
+6 3333 6 106
+7 3333 7 107
+8 3333 8 108
+9 3333 9 109
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+0 100 0 100
+1 101 1 101
+2 102 2 102
+3 103 3 103
+4 104 4 104
+5 4444 5 105
+6 4444 6 106
+7 4444 7 107
+8 4444 8 108
+9 4444 9 109
+connection default;
+DROP VIEW IF EXISTS v1;
+Warnings:
+Note 1051 Unknown table 'test.v1'
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
new file mode 100644
index 00000000000..9803895e1a7
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_1.result
@@ -0,0 +1,357 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (200);
+CALL fill_t2 (200);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+i i
+135 135
+119 119
+211 211
+184 184
+232 232
+105 105
+188 188
+216 216
+255 255
+154 154
+197 197
+279 279
+218 218
+127 127
+203 203
+281 281
+194 194
+161 161
+276 276
+122 122
+139 139
+183 183
+114 114
+247 247
+144 144
+148 148
+174 174
+267 267
+142 142
+168 168
+226 226
+258 258
+231 231
+146 146
+253 253
+189 189
+230 230
+290 290
+178 178
+158 158
+130 130
+214 214
+133 133
+229 229
+294 294
+295 295
+108 108
+112 112
+297 297
+151 151
+251 251
+270 270
+291 291
+159 159
+132 132
+121 121
+244 244
+272 272
+293 293
+186 186
+111 111
+166 166
+201 201
+175 175
+180 180
+209 209
+192 192
+246 246
+195 195
+107 107
+233 233
+239 239
+103 103
+109 109
+128 128
+266 266
+143 143
+160 160
+187 187
+243 243
+273 273
+259 259
+110 110
+176 176
+141 141
+170 170
+215 215
+191 191
+200 200
+271 271
+162 162
+260 260
+106 106
+150 150
+126 126
+147 147
+155 155
+193 193
+207 207
+287 287
+235 235
+252 252
+129 129
+205 205
+268 268
+278 278
+116 116
+137 137
+199 199
+217 217
+234 234
+190 190
+236 236
+257 257
+100 100
+210 210
+212 212
+264 264
+221 221
+241 241
+256 256
+262 262
+265 265
+269 269
+277 277
+173 173
+177 177
+208 208
+219 219
+285 285
+101 101
+164 164
+113 113
+125 125
+202 202
+140 140
+156 156
+282 282
+181 181
+206 206
+299 299
+102 102
+145 145
+227 227
+196 196
+138 138
+198 198
+204 204
+237 237
+171 171
+284 284
+263 263
+292 292
+104 104
+149 149
+250 250
+296 296
+228 228
+280 280
+242 242
+248 248
+185 185
+220 220
+245 245
+275 275
+118 118
+120 120
+152 152
+153 153
+157 157
+182 182
+179 179
+254 254
+288 288
+172 172
+283 283
+286 286
+115 115
+238 238
+289 289
+131 131
+223 223
+134 134
+136 136
+222 222
+225 225
+261 261
+274 274
+123 123
+163 163
+224 224
+117 117
+298 298
+169 169
+124 124
+167 167
+240 240
+249 249
+165 165
+213 213
+connection root1;
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 1 AND t1.k = t2.k LOCK IN SHARE MODE;
+i i
+209 209
+195 195
+107 107
+233 233
+239 239
+103 103
+109 109
+143 143
+187 187
+243 243
+273 273
+259 259
+141 141
+215 215
+191 191
+271 271
+147 147
+155 155
+193 193
+207 207
+287 287
+235 235
+129 129
+205 205
+137 137
+199 199
+217 217
+257 257
+221 221
+241 241
+265 265
+269 269
+277 277
+173 173
+177 177
+135 135
+119 119
+211 211
+105 105
+255 255
+197 197
+279 279
+127 127
+203 203
+281 281
+161 161
+139 139
+183 183
+247 247
+267 267
+231 231
+253 253
+189 189
+133 133
+229 229
+295 295
+297 297
+151 151
+251 251
+291 291
+159 159
+121 121
+293 293
+111 111
+201 201
+175 175
+185 185
+245 245
+275 275
+153 153
+157 157
+179 179
+283 283
+115 115
+289 289
+131 131
+223 223
+225 225
+261 261
+123 123
+163 163
+117 117
+169 169
+167 167
+249 249
+165 165
+213 213
+219 219
+285 285
+101 101
+113 113
+125 125
+181 181
+299 299
+145 145
+227 227
+237 237
+171 171
+263 263
+149 149
+UPDATE t1,t2 SET t1.i=1111,t2.i=2222 WHERE t1.k % 2 = 1 AND t1.k = t2.k;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
new file mode 100644
index 00000000000..adb89b03480
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_big_tab_2.result
@@ -0,0 +1,255 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+CREATE INDEX ixi ON t2 (i);
+CREATE PROCEDURE fill_t1 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t1 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t1() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t1;
+RETURN res;
+END;
+|
+CREATE PROCEDURE fill_t2 (IN upb int)
+BEGIN
+DECLARE cnt int DEFAULT 0;
+WHILE cnt < upb DO
+INSERT INTO t2 VALUES (cnt, cnt+100, cnt, cnt+100);
+SET cnt= cnt+1;
+END WHILE;
+END;
+|
+CREATE FUNCTION half_t2() RETURNS int
+BEGIN
+DECLARE res int DEFAULT 0;
+SELECT MOD(k,2) INTO res FROM t2;
+RETURN res;
+END;
+|
+CALL fill_t1 (200);
+CALL fill_t2 (200);
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 200 Using where
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.k 1
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+i i
+135 135
+119 119
+211 211
+184 184
+232 232
+105 105
+188 188
+216 216
+255 255
+154 154
+197 197
+279 279
+218 218
+127 127
+203 203
+281 281
+194 194
+161 161
+276 276
+122 122
+139 139
+183 183
+114 114
+247 247
+144 144
+148 148
+174 174
+267 267
+142 142
+168 168
+226 226
+258 258
+231 231
+146 146
+253 253
+189 189
+230 230
+290 290
+178 178
+158 158
+130 130
+214 214
+133 133
+229 229
+294 294
+295 295
+108 108
+112 112
+297 297
+151 151
+251 251
+270 270
+291 291
+159 159
+132 132
+121 121
+244 244
+272 272
+293 293
+186 186
+111 111
+166 166
+201 201
+175 175
+180 180
+209 209
+192 192
+246 246
+195 195
+107 107
+233 233
+239 239
+103 103
+109 109
+128 128
+266 266
+143 143
+160 160
+187 187
+243 243
+273 273
+259 259
+110 110
+176 176
+141 141
+170 170
+215 215
+191 191
+200 200
+271 271
+162 162
+260 260
+106 106
+150 150
+126 126
+147 147
+155 155
+193 193
+207 207
+287 287
+235 235
+252 252
+129 129
+205 205
+268 268
+278 278
+116 116
+137 137
+199 199
+217 217
+234 234
+190 190
+236 236
+257 257
+100 100
+210 210
+212 212
+264 264
+221 221
+241 241
+256 256
+262 262
+265 265
+269 269
+277 277
+173 173
+177 177
+208 208
+219 219
+285 285
+101 101
+164 164
+113 113
+125 125
+202 202
+140 140
+156 156
+282 282
+181 181
+206 206
+299 299
+102 102
+145 145
+227 227
+196 196
+138 138
+198 198
+204 204
+237 237
+171 171
+284 284
+263 263
+292 292
+104 104
+149 149
+250 250
+296 296
+228 228
+280 280
+242 242
+248 248
+185 185
+220 220
+245 245
+275 275
+118 118
+120 120
+152 152
+153 153
+157 157
+182 182
+179 179
+254 254
+288 288
+172 172
+283 283
+286 286
+115 115
+238 238
+289 289
+131 131
+223 223
+134 134
+136 136
+222 222
+225 225
+261 261
+274 274
+123 123
+163 163
+224 224
+117 117
+298 298
+169 169
+124 124
+167 167
+240 240
+249 249
+165 165
+213 213
+connection root1;
+DELETE FROM t1 WHERE t1.k % 2 = 1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
new file mode 100644
index 00000000000..eb69fd2e306
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_1.result
@@ -0,0 +1,148 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 225
+4 126 4 226
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 223
+2 124 2 224
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
new file mode 100644
index 00000000000..bedb75da93a
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_trig_2.result
@@ -0,0 +1,35 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE t1 SET l = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
new file mode 100644
index 00000000000..279f2626c73
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_1.result
@@ -0,0 +1,194 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+126 123
+126 124
+126 125
+126 126
+325 123
+325 124
+325 125
+325 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+124 123
+124 124
+124 125
+124 126
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE v1 SET i=326 where i=126;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+325 123
+325 124
+325 125
+325 126
+326 123
+326 124
+326 125
+326 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+connection default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+324 123
+324 124
+324 125
+324 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
new file mode 100644
index 00000000000..9e74e93b0cc
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_2.result
@@ -0,0 +1,200 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE v1 SET i=325 where i=125;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+126 123
+126 124
+126 125
+126 126
+325 123
+325 124
+325 125
+325 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+124 123
+124 124
+124 125
+124 126
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE v1 SET i=326 where i=126;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+123 123
+123 124
+123 125
+123 126
+124 123
+124 124
+124 125
+124 126
+325 123
+325 124
+325 125
+325 126
+326 123
+326 124
+326 125
+326 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+connection default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+324 123
+324 124
+324 125
+324 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 325 3 125
+4 326 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
new file mode 100644
index 00000000000..b5b1c519702
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_1.result
@@ -0,0 +1,169 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ref ixi ixi 5 test.t1.i 1 Using where
+SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+i i
+123 123
+124 124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE v1 SET i=323 where i=123;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+124 123
+124 124
+124 125
+124 126
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t1,t2 SET t1.i=226,t2.i=226 WHERE t1.i=126 AND t2.i=t1.i;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE v1 SET i=324 where i=124;
+SELECT * FROM v1 ORDER BY i,l;
+i l
+125 123
+125 124
+125 125
+125 126
+126 123
+126 124
+126 125
+126 126
+323 123
+323 124
+323 125
+323 126
+324 123
+324 124
+324 125
+324 126
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 323 1 123
+2 324 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP VIEW IF EXISTS v1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
new file mode 100644
index 00000000000..d92f9ad9664
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_mix_2.result
@@ -0,0 +1,38 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i, t2.l from t1,t2;
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4
+SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+i
+123
+124
+123
+124
+123
+124
+123
+124
+connection root1;
+UPDATE t1,t2 SET t1.i=225,t2.i=225 WHERE t1.i=125 AND t2.i=t1.i;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
new file mode 100644
index 00000000000..e2a2a6e7deb
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_1.result
@@ -0,0 +1,309 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS stp_t;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
+i
+123
+124
+126
+127
+128
+225
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (127, 227);
+i
+123
+124
+125
+126
+128
+227
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 128 6 128
+connection default;
+CALL stp_t (123, 223);
+i
+124
+125
+126
+127
+128
+223
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+CALL stp_t (126, 226);
+i
+123
+124
+127
+128
+225
+226
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+CALL stp_t (128, 228);
+i
+123
+124
+125
+126
+227
+228
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+CALL stp_t (124, 224);
+i
+125
+126
+127
+128
+223
+224
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+DELETE FROM t1 WHERE t1.i=228;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+COMMIT;
+connection root1;
+ROLLBACK;
+connection root1;
+COMMIT;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+127
+128
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 127 5 127
+6 128 6 128
+connection root2;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+227
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+5 227 5 127
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+5 227 5 127
+6 228 6 128
+connection default;
+DROP VIEW v1;
+DROP PROCEDURE stp_t;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
new file mode 100644
index 00000000000..6dbd5f834ed
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_storedp_2.result
@@ -0,0 +1,46 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+DROP PROCEDURE IF EXISTS stp_t;
+SET autocommit=0;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+INSERT INTO t1 VALUES (5,127,5,127);
+INSERT INTO t1 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+INSERT INTO t2 VALUES (5,127,5,127);
+INSERT INTO t2 VALUES (6,128,6,128);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE PROCEDURE stp_t (IN p1 int, IN p2 int) MODIFIES SQL DATA
+BEGIN
+UPDATE t2 SET i = p2 WHERE i = p1;
+UPDATE v1 SET i = p2 WHERE i = p1;
+SELECT * FROM v1 ORDER BY i;
+SELECT * FROM t1 ORDER BY t1.k;
+SELECT * FROM t2 ORDER BY t2.k;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+CALL stp_t (125, 225);
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
new file mode 100644
index 00000000000..f5c745ca41c
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_1.result
@@ -0,0 +1,180 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range ixi ixi 5 NULL 10 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+126
+225
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 126 4 126
+connection default;
+UPDATE t2 SET t2.i=223 WHERE t2.i=123;
+SELECT * FROM v1 ORDER BY i;
+i
+124
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 124 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+UPDATE t2 SET t2.i=226 WHERE t2.i=126;
+SELECT * FROM v1 ORDER BY i;
+i
+123
+124
+225
+226
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+UPDATE t2 SET t2.i=224 WHERE t2.i=124;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+224
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+DELETE FROM t1 WHERE t1.i=226;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 123 1 123
+2 124 2 124
+3 225 3 125
+4 226 4 126
+connection default;
+DELETE FROM t1 WHERE t1.i=224;
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+COMMIT;
+connection root1;
+ROLLBACK;
+connection default;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection root1;
+SELECT * FROM v1 ORDER BY i;
+i
+125
+126
+223
+SELECT * FROM t1 ORDER BY t1.k;
+k i j l
+1 223 1 123
+3 125 3 125
+4 126 4 126
+SELECT * FROM t2 ORDER BY t2.k;
+k i j l
+1 223 1 123
+2 224 2 124
+3 125 3 125
+4 126 4 126
+connection default;
+DROP TABLE t1, t2;
+DROP VIEW v1;
diff --git a/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
new file mode 100644
index 00000000000..d6a38753c1d
--- /dev/null
+++ b/mysql-test/suite/row_lock/r/ndb_row_lock_view_trig_2.result
@@ -0,0 +1,36 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP VIEW IF EXISTS v1;
+SET autocommit=0;
+SET autocommit=0;
+connection default;
+CREATE TABLE t1 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t1 VALUES (1,123,1,123);
+INSERT INTO t1 VALUES (2,124,2,124);
+INSERT INTO t1 VALUES (3,125,3,125);
+INSERT INTO t1 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t1 (i);
+CREATE TABLE t2 (k INT NOT NULL PRIMARY KEY, i INT, j INT, l INT) ENGINE=NDB;
+INSERT INTO t2 VALUES (1,123,1,123);
+INSERT INTO t2 VALUES (2,124,2,124);
+INSERT INTO t2 VALUES (3,125,3,125);
+INSERT INTO t2 VALUES (4,126,4,126);
+#CREATE INDEX ixi ON t2 (i);
+CREATE VIEW v1 AS SELECT t1.i from t1;
+CREATE TRIGGER trig_t2 AFTER UPDATE ON t2
+FOR EACH ROW BEGIN
+UPDATE v1 SET i = NEW.i WHERE i = OLD.i;
+END;
+|
+COMMIT;
+SELECT @@global.tx_isolation;
+@@global.tx_isolation
+REPEATABLE-READ
+EXPLAIN SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+i
+123
+124
+connection root1;
+UPDATE t2 SET t2.i=225 WHERE t2.i=125;
diff --git a/mysql-test/suite/row_lock/readme.txt b/mysql-test/suite/row_lock/readme.txt
new file mode 100644
index 00000000000..b43f04ecda4
--- /dev/null
+++ b/mysql-test/suite/row_lock/readme.txt
@@ -0,0 +1,9 @@
+All row lock test with InnoDB have to be executed with the options
+
+--innodb_lock_wait_timeout=1
+--innodb_locks_unsafe_for_binlog
+
+for example
+
+perl mysql-test-run.pl --mysqld=--innodb_lock_wait_timeout=2 --mysqld=--innodb_locks_unsafe_for_binlog --suite=row_lock innodb_row_lock_2
+
diff --git a/mysql-test/suite/row_lock/summary_of_sel_test.txt b/mysql-test/suite/row_lock/summary_of_sel_test.txt
new file mode 100644
index 00000000000..0fa332e957a
--- /dev/null
+++ b/mysql-test/suite/row_lock/summary_of_sel_test.txt
@@ -0,0 +1,36 @@
+Test plan:
+Create 2 tables with a primary key and 3 integer columns. Both get the same rows (1,123,1,123),(2,124,2,124),(3,125,3,125),(4,126,4,126). The second and third column may get an index to have cases with, without and mutilple index. Create views on the tables. Create an update trigger. Create a stored procedure updating the table. Create a stored function updating the table and deliver the key as result.
+
+The test isself consists of 2 sessions (transactions) running in "parallel" (same user "root") accessing and locking the same tables on basis of a row lock. Expected is that both sessions(transactions) can update the table successfully.
+
+First session
+execute an explain to every select and one of the following selects on the first half of table t1:
+- select <non index columns> ... where ... for update;
+- select <non index columns> ... where ... lock in share mode;
+- select <indexed columns> ... where ... for update;
+- select <indexed columns> ... where ... lock in share mode;
+- select <indexed columns> ... ignore index ... where ... for update;
+- select <indexed columns> ... ignore index ... where ... lock in share mode;
+- select ... where (select...) ... for update;
+- select ... where (select...) ... lock in share mode;
+- (select ... where) union (select ... where) for update;
+- (select ... where) union (select ... where) lock in...;
+- select <view> ... where ... for update;
+- select <view> ... where ... lock in ...;
+- select <join> ... where ... for update;
+- select <join> ... where ... lock in ...;
+Then executes
+- update
+- delete
+- trigger accessing table t1
+- stored procedure accessing table t1
+- stored function accessing table t1
+
+Second session
+executes the same on the last half of table t1
+
+call of mysqld with option
+--innodb_locks_unsafe_for_binlog
+
+As the tests above work with small tables (<10 rows) there must be at least one test with a big table (>1000 rows) doing a table scan.
+
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
new file mode 100644
index 00000000000..e0440fe2669
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
new file mode 100644
index 00000000000..5cb3ea9f2d9
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_3.test b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
new file mode 100644
index 00000000000..11f4dc423d6
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_3.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_4.test b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
new file mode 100644
index 00000000000..0a8ca9c13a0
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_4.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_5.test b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
new file mode 100644
index 00000000000..7e411d31649
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_5.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
new file mode 100644
index 00000000000..0c5b8b41bd5
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
new file mode 100644
index 00000000000..a12a07d82a9
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_1.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $nbrows= 40;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_1.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
new file mode 100644
index 00000000000..49e834eb2ce
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_big_tab_2.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $nbrows= 40;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.k % 2= 0 AND t1.k = t2.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_2.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
new file mode 100644
index 00000000000..225513d3f87
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
new file mode 100644
index 00000000000..88dee5f23f8
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_trig_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
new file mode 100644
index 00000000000..d6381e1da5b
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
new file mode 100644
index 00000000000..ee45e683669
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
new file mode 100644
index 00000000000..49cba88dd23
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
new file mode 100644
index 00000000000..b07f3a3378a
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_mix_2.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+#let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
new file mode 100644
index 00000000000..d507ff3296f
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
new file mode 100644
index 00000000000..a1bfb16055e
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_storedp_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
new file mode 100644
index 00000000000..24c76532d17
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_1.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
new file mode 100644
index 00000000000..a8a67d77979
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/innodb_row_lock_view_trig_2.test
@@ -0,0 +1,9 @@
+--source include/have_innodb.inc
+SELECT @@global.innodb_table_locks into @table_locks;
+SET @@global.innodb_table_locks= OFF;
+let $engine= InnoDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
+SET @@global.innodb_table_locks= @table_locks;
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
new file mode 100644
index 00000000000..6ac2e829008
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
new file mode 100644
index 00000000000..994ecba96b0
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_3.test b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
new file mode 100644
index 00000000000..2de43c61c2a
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_3.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_4.test b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
new file mode 100644
index 00000000000..72b20488c74
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_4.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_5.test b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
new file mode 100644
index 00000000000..045f127a4ef
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_5.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1 ignore index (ixi),t2 IGNORE INDEX (ixi) WHERE t1.i<125 AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
new file mode 100644
index 00000000000..bf2df104e03
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < half_t1() AND t2.i=t1.i LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
new file mode 100644
index 00000000000..4d32991d379
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_1.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $nbrows= 200;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_1.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
new file mode 100644
index 00000000000..894a83fc1b0
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_big_tab_2.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $nbrows= 200;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i < t1.k % 2 = 0 AND t2.k=t1.k LOCK IN SHARE MODE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_big_tab_2.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
new file mode 100644
index 00000000000..a5586a6101e
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
new file mode 100644
index 00000000000..7af13697ccc
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_trig_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
new file mode 100644
index 00000000000..a1aaf5ab441
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_1.test
@@ -0,0 +1,7 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
+
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
new file mode 100644
index 00000000000..b8feef693e7
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
new file mode 100644
index 00000000000..a97626048d3
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i,t2.i FROM t1,t2 WHERE t1.i<125 AND t2.i=t1.i FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
new file mode 100644
index 00000000000..e7a9a715785
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_mix_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT v1.i FROM v1 WHERE v1.i<125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_mix.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
new file mode 100644
index 00000000000..f57bcb3dd1b
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
new file mode 100644
index 00000000000..b0aaa38fb93
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_storedp_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_storedp.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
new file mode 100644
index 00000000000..9c4128d78bf
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_1.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= CREATE INDEX ixi ON t1 (i);
+let $indext2= CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
new file mode 100644
index 00000000000..38c9472fb3d
--- /dev/null
+++ b/mysql-test/suite/row_lock/t/ndb_row_lock_view_trig_2.test
@@ -0,0 +1,6 @@
+--source include/have_ndb.inc
+let $engine= NDB;
+let $select= SELECT t1.i FROM t1 WHERE t1.i< 125 FOR UPDATE;
+let $indext1= #CREATE INDEX ixi ON t1 (i);
+let $indext2= #CREATE INDEX ixi ON t2 (i);
+--source suite/row_lock/include/row_lock_view_trig.inc
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index 64bd69c1855..fe39cd95753 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -132,6 +132,8 @@ create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 09e49d933fb..ad2c7a6c08c 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -12,6 +12,7 @@
user_limits : Bug#23921 random failure of user_limits.test
im_options : Bug#20294 2006-07-24 stewart Instance manager test im_options fails randomly
+im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance.
concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 476e4ce7735..7310f98cd16 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -540,3 +540,16 @@ EXPLAIN SELECT a FROM t1 GROUP BY a;
SELECT a FROM t1 GROUP BY a;
DROP TABLE t1;
+
+#
+#Bug #27659: SELECT DISTINCT returns incorrect result set when field is
+#repeated
+#
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
+SELECT DISTINCT a, b FROM t1;
+SELECT DISTINCT a, a, b FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/federated_server.test b/mysql-test/t/federated_server.test
index 20332f65bff..87b67720104 100644
--- a/mysql-test/t/federated_server.test
+++ b/mysql-test/t/federated_server.test
@@ -2,7 +2,8 @@
# if federated can utilise the servers table
# should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc
-source include/federated.inc;
+-- source include/federated.inc;
+-- source include/big_test.inc
connection slave;
create database first_db;
@@ -299,7 +300,7 @@ begin
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1;
SET i = sleep(5);
- WHILE v < 20000 do
+ WHILE v < 10000 do
CREATE SERVER s
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test');
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
index 77d7366afe6..bb65cbaa774 100644
--- a/mysql-test/t/func_sapdb.test
+++ b/mysql-test/t/func_sapdb.test
@@ -41,6 +41,8 @@ select datediff("1997-11-30 23:59:59.000001",null);
select weekofyear("1997-11-30 23:59:59.000001");
+select makedate(03,1);
+select makedate('0003',1);
select makedate(1997,1);
select makedate(1997,0);
select makedate(9999,365);
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 0008c37646c..cf4e2d0151e 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -3,6 +3,8 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
+SET GLOBAL log_bin_trust_function_creators = 1;
+
# Cleanup
--disable_warnings
drop table if exists t1;
@@ -985,6 +987,233 @@ GRANT PROCESS ON * TO user@localhost;
disconnect con1;
connection default;
+
+#
+# BUG#9504: Stored procedures: execute privilege doesn't make 'use database'
+# okay.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+DROP DATABASE IF EXISTS mysqltest3;
+DROP DATABASE IF EXISTS mysqltest4;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+CREATE DATABASE mysqltest3;
+CREATE DATABASE mysqltest4;
+
+CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
+ SELECT 1;
+
+CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
+ SELECT 1;
+
+CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
+ RETURN 1;
+
+CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
+ RETURN 1;
+
+GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
+GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
+
+GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
+
+# Test.
+
+--connect (bug9504_con1,localhost,mysqltest_1,,)
+--echo
+--echo ---> connection: bug9504_con1
+
+# - Check that we can switch to the db;
+
+use mysqltest1;
+
+use mysqltest2;
+
+use mysqltest3;
+
+use mysqltest4;
+
+# - Check that we can call stored routines;
+
+use test;
+
+CALL mysqltest1.p_def();
+
+CALL mysqltest2.p_inv();
+
+SELECT mysqltest3.f_def();
+
+SELECT mysqltest4.f_inv();
+
+# Cleanup.
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect bug9504_con1
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP DATABASE mysqltest3;
+DROP DATABASE mysqltest4;
+
+DROP USER mysqltest_1@localhost;
+
+
+#
+# BUG#27337: Privileges are not restored properly.
+#
+# Actually, the patch for this bugs fixes two problems. So, here are two test
+# cases.
+
+# Test case 1: privileges are not restored properly after calling a stored
+# routine defined with SQL SECURITY INVOKER clause.
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost;
+
+CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER
+ SELECT 1;
+
+# Test.
+
+--connect (bug27337_con1,localhost,mysqltest_1,,mysqltest2)
+--echo
+--echo ---> connection: bug27337_con1
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TABLE t1(c INT);
+
+CALL mysqltest1.p1();
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TABLE t1(c INT);
+
+--disconnect bug27337_con1
+
+--connect (bug27337_con2,localhost,mysqltest_1,,mysqltest2)
+--echo
+--echo ---> connection: bug27337_con2
+
+--error ER_TABLEACCESS_DENIED_ERROR
+CREATE TABLE t1(c INT);
+
+SHOW TABLES;
+
+# Cleanup.
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect bug27337_con2
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+
+DROP USER mysqltest_1@localhost;
+
+# Test case 2: priveleges are not checked properly for prepared statements.
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+CREATE TABLE mysqltest1.t1(c INT);
+CREATE TABLE mysqltest2.t2(c INT);
+
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
+GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost;
+
+# Test.
+
+--connect (bug27337_con1,localhost,mysqltest_1,,mysqltest1)
+--echo
+--echo ---> connection: bug27337_con1
+
+SHOW TABLES FROM mysqltest1;
+
+PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1';
+
+EXECUTE stmt1;
+
+--connect (bug27337_con2,localhost,mysqltest_2,,mysqltest2)
+--echo
+--echo ---> connection: bug27337_con2
+
+SHOW COLUMNS FROM mysqltest2.t2;
+
+PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2';
+
+EXECUTE stmt2;
+
+--connection default
+--echo
+--echo ---> connection: default
+
+REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost;
+
+--connection bug27337_con1
+--echo
+--echo ---> connection: bug27337_con1
+
+--error ER_DBACCESS_DENIED_ERROR
+SHOW TABLES FROM mysqltest1;
+
+--error ER_DBACCESS_DENIED_ERROR
+EXECUTE stmt1;
+
+--connection bug27337_con2
+--echo
+--echo ---> connection: bug27337_con2
+
+--error ER_TABLEACCESS_DENIED_ERROR
+SHOW COLUMNS FROM mysqltest2.t2;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+EXECUTE stmt2;
+
+# Cleanup.
+
+--connection default
+--echo
+--echo ---> connection: default
+
+--disconnect bug27337_con2
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+
+DROP USER mysqltest_1@localhost;
+
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test
index e15e50e8766..666f331c7b9 100644
--- a/mysql-test/t/information_schema_db.test
+++ b/mysql-test/t/information_schema_db.test
@@ -121,6 +121,28 @@ create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
+create view v5 as select f1 from t1;
+grant show view on v5 to testdb_2@localhost;
+
+--error 1227
+create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
+
+connection default;
+use testdb_1;
+create view v6 as select f1 from t1;
+grant show view on v6 to testdb_2@localhost;
+
+create table t2 (f1 char(4));
+create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
+
+show fields from testdb_1.v6;
+show create view testdb_1.v6;
+
+show create view testdb_1.v7;
+show fields from testdb_1.v7;
+
+connection testdb_1;
+
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
@@ -129,13 +151,41 @@ connect (testdb_2,localhost,testdb_2,,test);
create view v2 as select f1 from testdb_1.v1;
create view v4 as select f1,f2 from testdb_1.v3;
+show fields from testdb_1.v5;
+show create view testdb_1.v5;
+
+show fields from testdb_1.v6;
+show create view testdb_1.v6;
+
connection testdb_1;
+show fields from testdb_1.v7;
+show create view testdb_1.v7;
+
revoke insert(f1) on v3 from testdb_2@localhost;
+revoke show view on v5 from testdb_2@localhost;
+connection default;
+use testdb_1;
+revoke show view on v6 from testdb_2@localhost;
connection testdb_2;
+--error 1142
+show fields from testdb_1.v5;
+--error 1142
+show create view testdb_1.v5;
+
+--error 1142
+show fields from testdb_1.v6;
+--error 1142
+show create view testdb_1.v6;
+
+--error 1142
+show fields from testdb_1.v7;
+--error 1142
+show create view testdb_1.v7;
+
--error 1345
show create view v4;
---error 1345
+#--error 1345
show fields from v4;
show fields from v2;
@@ -155,7 +205,8 @@ where a.table_name = 'testdb_1.v1';
select * from v2;
connection default;
-drop view testdb_1.v1,v2, testdb_1.v3, v4;
+use test;
+drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
index 43fbaabf698..c4a7651ac7d 100644
--- a/mysql-test/t/myisam-system.test
+++ b/mysql-test/t/myisam-system.test
@@ -7,14 +7,14 @@ drop table if exists t1,t2;
--enable_warnings
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
drop table if exists t1;
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
--error 1051,6
drop table t1;
create table t1 (a int) engine=myisam;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYD ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
--error 1105,6,29
drop table t1;
--error 1051
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index cd49d3570e9..ac647f772b1 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -58,6 +58,10 @@ select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log
+select "--- start and stop positions ---" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLTEST_VARDIR/log/master-bin.000001
+--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001
@@ -115,6 +119,10 @@ select "--- stop-position --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--disable_query_log
+select "--- start and stop positions ---" as "";
+--enable_query_log
+--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
+--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 7424687cd8a..06d47693c10 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -24,7 +24,7 @@ create table t1(
insert into t1 values(1, "Autodiscover");
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
select * from t1;
show status like 'handler_discover%';
@@ -33,13 +33,13 @@ show status like 'handler_discover%';
#
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
insert into t1 values (2, "Auto 2");
show status like 'handler_discover%';
insert into t1 values (3, "Discover 3");
show status like 'handler_discover%';
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
select * from t1 order by id;
show status like 'handler_discover%';
@@ -48,7 +48,7 @@ show status like 'handler_discover%';
#
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%';
select * from t1 order by id;
@@ -59,7 +59,7 @@ show status like 'handler_discover%';
#
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
delete from t1 where id = 3;
select * from t1 order by id;
show status like 'handler_discover%';
@@ -111,7 +111,7 @@ show status like 'handler_discover%';
flush tables;
# Remove the frm file from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
--error 1050
create table t3(
@@ -168,14 +168,14 @@ show status like 'handler_discover%';
# Remove the frm file from disk
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
show tables from test;
show status like 'handler_discover%';
# Remove the frm file from disk again
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
--replace_column 6 # 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status;
@@ -290,8 +290,8 @@ insert into t9 values (9);
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
# Remove t6, t7 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
SHOW TABLES;
@@ -332,8 +332,8 @@ insert into t9 values (9);
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
# Remove t6, t7 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t6.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t7.frm
SHOW TABLES LIKE 't6';
@@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3");
insert into t4 values (4);
# Remove t1, t2, t3 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ;
-system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t2.frm
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm
flush tables;
# Select from the table which only exists in NDB.
@@ -530,7 +530,7 @@ CREATE TABLE t9 (
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
#Don't drop the table, instead remove the frm file
-system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t9.frm
# Now leave test case, when ndb_autodiscover2 will run, this
# MySQL Server will have been restarted because it has a
diff --git a/mysql-test/t/ndb_dd_basic.test b/mysql-test/t/ndb_dd_basic.test
index 81286d3121f..3acf4669868 100644
--- a/mysql-test/t/ndb_dd_basic.test
+++ b/mysql-test/t/ndb_dd_basic.test
@@ -407,8 +407,16 @@ insert into t1 values(7,'x');
insert into t1 values(8,'x');
delete from t1 where a = 0;
commit;
+
+delete from t1;
+begin;
+insert into t1 values (1, 'x');
+select * from t1;
+rollback;
+
set autocommit = 1;
+
drop table t1;
#############################
# Customer posted order by test case
diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test
index 47054ecfbf5..3eae3891f43 100644
--- a/mysql-test/t/ndb_loaddatalocal.test
+++ b/mysql-test/t/ndb_loaddatalocal.test
@@ -25,7 +25,7 @@ create table t1(a int) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
drop table t1;
create table t1(a int) engine=myisam;
@@ -37,7 +37,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
@@ -50,7 +50,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
@@ -63,7 +63,7 @@ drop table t1;
create table t1(a int primary key) engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 9030dfbe304..662eb43c422 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -8,14 +8,21 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
--enable_warnings
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check mediumint
CREATE TABLE `t1_c` (
- `capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+ `capgoaledatta` mediumint(5) unsigned NOT NULL auto_increment,
`goaledatta` char(2) NOT NULL default '',
`maturegarbagefa` varchar(32) NOT NULL default '',
PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
-INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
-
+INSERT INTO `t1_c` VALUES (2,'3','q3plus.qt'),(400,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3000,'20','threetrees.qt');
+#
+# Bug #27758 Restoring NDB backups makes table usable in SQL nodes
+# - space in key made table unusable after restore
+#
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check smallint
CREATE TABLE `t2_c` (
`capgotod` smallint(5) unsigned NOT NULL auto_increment,
`gotod` smallint(5) unsigned NOT NULL default '0',
@@ -24,9 +31,9 @@ CREATE TABLE `t2_c` (
`descrpooppo` varchar(64) default NULL,
`svcutonsa` varchar(64) NOT NULL default '',
PRIMARY KEY (`capgotod`),
- KEY `i_quadaddsvr` (`gotod`)
+ KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
-INSERT INTO `t2_c` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
@@ -35,6 +42,8 @@ CREATE TABLE `t3_c` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t3_c` VALUES (5,3),(2,4),(5,4),(1,3);
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check bigint
CREATE TABLE `t4_c` (
`capfa` bigint(20) unsigned NOT NULL auto_increment,
`realm` varchar(32) NOT NULL default '',
@@ -46,7 +55,7 @@ CREATE TABLE `t4_c` (
KEY `capfa` (`capfa`),
KEY `i_quadentity` (`fa`,`realm`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
-INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+INSERT INTO `t4_c` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(2200,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32000,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(290000000,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
CREATE TABLE `t5_c` (
`capfa` bigint(20) unsigned NOT NULL default '0',
@@ -64,9 +73,11 @@ CREATE TABLE `t6_c` (
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t6_c` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check tinyint
CREATE TABLE `t7_c` (
`dardpo` char(15) NOT NULL default '',
- `dardtestard` tinyint(3) unsigned NOT NULL default '0',
+ `dardtestard` tinyint(3) unsigned NOT NULL auto_increment,
`FastFA` char(5) NOT NULL default '',
`FastCode` char(6) NOT NULL default '',
`Fastca` char(1) NOT NULL default '',
@@ -138,6 +149,9 @@ INSERT INTO `t9_c` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','
# seen by select below
CREATE TABLE t10_c (a INT AUTO_INCREMENT KEY) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO t10_c VALUES (1),(2),(3);
+# Bug #27775 - mediumint auto inc not restored correctly
+# - check int
+insert into t10_c values (10000),(2000),(3000);
create table t1 engine=myisam as select * from t1_c;
create table t2 engine=myisam as select * from t2_c;
@@ -215,6 +229,18 @@ select count(*)
# Bug #20820 cont'd
select * from t10_c order by a;
+# Bug #27775 cont'd
+# - auto inc info should be correct
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't1_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't2_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't4_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't7_c';
+--replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X
+show table status like 't10_c';
#
# Try Partitioned tables as well
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index 1d5c7a543ea..bf25359b7be 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -85,6 +85,31 @@ drop table t1;
SELECT ROW(2,10) <=> ROW(3,4);
SELECT ROW(NULL,10) <=> ROW(3,NULL);
+#
+# Bug #27484: nested row expressions in IN predicate
+#
+
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
+--error 1241
+SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
+
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
+--error 1241
+SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
+
+--error 1241
+SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
+--error 1241
+SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
+
# End of 4.1 tests
#
diff --git a/mysql-test/t/rpl_flushlog_loop.test b/mysql-test/t/rpl_flushlog_loop.test
index ded111d769f..471c45a1aa3 100644
--- a/mysql-test/t/rpl_flushlog_loop.test
+++ b/mysql-test/t/rpl_flushlog_loop.test
@@ -5,6 +5,9 @@
#
# Start replication master -> slave
#
+# We have to sync with master, to ensure slave had time to start properly
+# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
+sync_slave_with_master;
connection slave;
--disable_warnings
stop slave;
diff --git a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test
index 758ac94af24..b10603e7195 100644
--- a/mysql-test/t/rpl_loaddatalocal.test
+++ b/mysql-test/t/rpl_loaddatalocal.test
@@ -25,7 +25,7 @@ eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.sele
truncate table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
save_master_pos;
connection slave;
sync_with_master;
@@ -52,7 +52,7 @@ drop table t1;
create table t1(a int primary key);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
+--remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
SELECT * FROM t1 ORDER BY a;
save_master_pos;
connection slave;
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index ec1c83a9718..b98d89c1dc3 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -37,7 +37,7 @@ change master to master_log_pos=178;
start slave;
sleep 2;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_column 1 # 8 # 9 # 11 # 23 # 33 #
show slave status;
connection master;
--replace_column 3 <Binlog_Ignore_DB>
diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test
index f00beff583a..db9b557baad 100644
--- a/mysql-test/t/rpl_misc_functions.test
+++ b/mysql-test/t/rpl_misc_functions.test
@@ -99,5 +99,5 @@ DROP TABLE IF EXISTS t1;
--sync_slave_with_master
# If all is good, when can cleanup our dump files.
---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
---system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql
diff --git a/mysql-test/t/rpl_ndb_basic.test b/mysql-test/t/rpl_ndb_basic.test
index a230b9da622..04c855f8730 100644
--- a/mysql-test/t/rpl_ndb_basic.test
+++ b/mysql-test/t/rpl_ndb_basic.test
@@ -36,6 +36,37 @@ select * from t1 order by nid;
select * from t1 order by nid;
--connection master
+delete from t1;
+insert into t1 values(1,"AA", "AA");
+insert into t1 values(2,"BB", "BB");
+insert into t1 values(3,"CC", "CC");
+insert into t1 values(4,"DD", "DD");
+
+begin;
+# delete+insert = update
+delete from t1 where nid = 1;
+insert into t1 values (1,"A2", "A2");
+
+# update+delete = delete
+update t1 set nom="B2" where nid = 2;
+delete from t1 where nid = 2;
+
+# multi-update
+update t1 set nom = "D2" where nid = 4;
+delete from t1 where nid = 4;
+insert into t1 values (4, "D3", "D3");
+update t1 set nom = "D4" where nid = 4;
+
+# insert+delete = nothing
+insert into t1 values (5, "EE", "EE");
+delete from t1 where nid = 5;
+
+commit;
+select * from t1 order by 1;
+--sync_slave_with_master
+--connection slave
+select * from t1 order by 1;
+--connection master
DROP table t1;
#
diff --git a/mysql-test/t/rpl_rbr_to_sbr.test b/mysql-test/t/rpl_rbr_to_sbr.test
index 4def515eb13..4f72996671d 100644
--- a/mysql-test/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/t/rpl_rbr_to_sbr.test
@@ -43,5 +43,5 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql $MYSQLTEST_VARDIR/tmp
# If all is good, we can remove the files
-system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql;
-system rm $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql;
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql
diff --git a/mysql-test/t/rpl_row_NOW.test b/mysql-test/t/rpl_row_NOW.test
index d0272b35c1f..c28b714277e 100644
--- a/mysql-test/t/rpl_row_NOW.test
+++ b/mysql-test/t/rpl_row_NOW.test
@@ -67,8 +67,8 @@ DROP DATABASE mysqltest1;
diff_files $MYSQLTEST_VARDIR/tmp/NOW_master.sql $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
# If all is good, when can cleanup our dump files.
-system rm $MYSQLTEST_VARDIR/tmp/NOW_master.sql;
-system rm $MYSQLTEST_VARDIR/tmp/NOW_slave.sql;
+--remove_file $MYSQLTEST_VARDIR/tmp/NOW_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/NOW_slave.sql
sync_slave_with_master;
# End of 5.1 test case
diff --git a/mysql-test/t/rpl_row_sp001.test b/mysql-test/t/rpl_row_sp001.test
index c6fc29e3750..c12e73b6861 100644
--- a/mysql-test/t/rpl_row_sp001.test
+++ b/mysql-test/t/rpl_row_sp001.test
@@ -140,7 +140,7 @@ sync_slave_with_master;
diff_files $MYSQLTEST_VARDIR/tmp/sp001_master.sql $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
# If all is good, when can cleanup our dump files.
-system rm $MYSQLTEST_VARDIR/tmp/sp001_master.sql;
-system rm $MYSQLTEST_VARDIR/tmp/sp001_slave.sql;
+--remove_file $MYSQLTEST_VARDIR/tmp/sp001_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/sp001_slave.sql
# End of 5.0 test case
diff --git a/mysql-test/t/rpl_row_sp011.test b/mysql-test/t/rpl_row_sp011.test
index fb87249d93c..25c2fc9ad26 100644
--- a/mysql-test/t/rpl_row_sp011.test
+++ b/mysql-test/t/rpl_row_sp011.test
@@ -105,7 +105,7 @@ sync_slave_with_master;
diff_files $MYSQLTEST_VARDIR/tmp/sp011_master.sql $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
# If all is good, when can cleanup our dump files.
-system rm $MYSQLTEST_VARDIR/tmp/sp011_master.sql;
-system rm $MYSQLTEST_VARDIR/tmp/sp011_slave.sql;
+--remove_file $MYSQLTEST_VARDIR/tmp/sp011_master.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/sp011_slave.sql
# End of 5.0 test case
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index f613b836350..1f8a00409e6 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3346,4 +3346,17 @@ SELECT t2.faq_id
DROP TABLE t1,t2;
+
+#
+# Bug #19372: Optimizer does not use index anymore when WHERE index NOT IN
+# () is added
+#
+CREATE TABLE t1 (a INT, b INT, KEY inx (b,a));
+
+INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7);
+EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
+ ON ( f1.b=f2.b AND f1.a<f2.a )
+ WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 91832ee8af4..60e680c63f3 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -392,7 +392,8 @@ SHOW TABLE STATUS like 't1';
--error 1033
show create table t1;
drop table if exists t1;
-system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+--error 1,0
+--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index f994f61a665..91de14116d4 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -28,6 +28,7 @@ drop procedure db1_secret.dummy;
use db1_secret;
create table t1 ( u varchar(64), i int );
+insert into t1 values('test', 0);
# A test procedure and function
create procedure stamp(i int)
@@ -35,7 +36,16 @@ create procedure stamp(i int)
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show procedure status like 'stamp';
-create function db() returns varchar(64) return database();
+delimiter |;
+create function db() returns varchar(64)
+begin
+ declare v varchar(64);
+
+ select u into v from t1 limit 1;
+
+ return v;
+end|
+delimiter ;|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
show function status like 'db';
@@ -63,14 +73,18 @@ call db1_secret.stamp(2);
select db1_secret.db();
# ...but not this
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from db1_secret.t1;
# ...and not this
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
create procedure db1_secret.dummy() begin end;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
drop procedure db1_secret.dummy;
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure db1_secret.stamp;
+--error ER_PROCACCESS_DENIED_ERROR
+drop function db1_secret.db;
#
@@ -83,14 +97,18 @@ call db1_secret.stamp(3);
select db1_secret.db();
# ...but not this
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
select * from db1_secret.t1;
# ...and not this
---error 1044
+--error ER_DBACCESS_DENIED_ERROR
create procedure db1_secret.dummy() begin end;
---error 1305
+--error ER_SP_DOES_NOT_EXIST
drop procedure db1_secret.dummy;
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure db1_secret.stamp;
+--error ER_PROCACCESS_DENIED_ERROR
+drop function db1_secret.db;
#
@@ -121,9 +139,9 @@ select db();
connection con2user1;
# This should not work
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
call db1_secret.stamp(5);
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
select db1_secret.db();
#
@@ -132,9 +150,9 @@ select db1_secret.db();
connection con3anon;
# This should not work
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
call db1_secret.stamp(6);
---error 1044
+--error ER_TABLEACCESS_DENIED_ERROR
select db1_secret.db();
#
@@ -165,7 +183,7 @@ use db2;
create procedure p () insert into t2 values (1);
# Check that this doesn't work.
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
call p();
connect (con4user2,localhost,user2,,);
@@ -174,7 +192,7 @@ connection con4user2;
use db2;
# This should not work, since p is executed with definer's (user1's) rights.
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call p();
select * from t2;
@@ -207,9 +225,9 @@ alter procedure p modifies sql data;
drop procedure p;
# This should NOT work
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
alter procedure q modifies sql data;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure q;
connection con1root;
@@ -260,30 +278,30 @@ connect (con4userc,localhost,userc,,);
connection con2usera;
call sptest.p1(1);
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con3userb;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call sptest.p1(2);
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con4userc;
call sptest.p1(3);
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con3userb;
call sptest.p1(4);
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
grant execute on procedure sptest.p1 to userb@localhost;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
drop procedure sptest.p1;
connection con1root;
@@ -332,7 +350,7 @@ delimiter ;//
connect (user1,localhost,user1,,test);
connection user1;
use mysqltest;
--- error 1370
+-- error ER_PROCACCESS_DENIED_ERROR
select bug_9503();
connection root;
@@ -401,13 +419,13 @@ grant usage on *.* to mysqltest_1@localhost;
connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n1;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call mysqltest_1.p1();
disconnect n1;
# Test also without a current database
connect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n2;
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
call mysqltest_1.p1();
disconnect n2;
@@ -433,9 +451,9 @@ end;
create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (test_user_12812,localhost,user_bug12812,ABC,test)|
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
SELECT test.bug12812()|
---error 1370
+--error ER_PROCACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT test.bug12812()|
# Cleanup
connection default|
@@ -489,7 +507,8 @@ drop database db_bug14834;
#
-# BUG#14533: 'desc tbl' in stored procedure causes error 1142
+# BUG#14533: 'desc tbl' in stored procedure causes error
+# ER_TABLEACCESS_DENIED_ERROR
#
create database db_bug14533;
use db_bug14533;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index f776be40864..591677cd834 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -7021,6 +7021,47 @@ INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
DROP FUNCTION bug25373|
DROP TABLE t3|
+
+
+#
+# BUG#25082: Default database change on trigger execution breaks replication.
+#
+# As it turned out, this bug has actually two bugs. So, here we have two test
+# cases -- one in sp.test, the other in sp-security.test.
+#
+
+#
+# Test case 1: error on dropping the current database.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1|
+DROP DATABASE IF EXISTS mysqltest2|
+--enable_warnings
+
+CREATE DATABASE mysqltest1|
+CREATE DATABASE mysqltest2|
+
+# Test.
+
+CREATE PROCEDURE mysqltest1.p1()
+ DROP DATABASE mysqltest2|
+
+use mysqltest2|
+
+CALL mysqltest1.p1()|
+
+SELECT DATABASE()|
+
+# Cleanup.
+
+DROP DATABASE mysqltest1|
+
+use test|
+
+
#
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
--disable_warnings
@@ -7088,3 +7129,26 @@ delimiter |;
delimiter ;|
drop table t1,t2;
+CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
+CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
+set @a=0;
+
+delimiter |;
+CREATE function bug27354() RETURNS int deterministic
+begin
+insert into t1 values (null);
+set @a=@a+1;
+return @a;
+end|
+
+delimiter ;|
+update t2 set b=1 where a=bug27354();
+select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
+insert into t2 values (1,1),(2,2),(3,3);
+update t2 set b=-b where a=bug27354();
+select * from t2 /* must return 1,-1 ... */;
+select count(*) from t1 /* must be 3 */;
+
+
+drop table t1,t2;
+drop function bug27354;
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
new file mode 100644
index 00000000000..cc3b2531bed
--- /dev/null
+++ b/mysql-test/t/sp_trans_log.test
@@ -0,0 +1,43 @@
+# part of sp_trans test that appeared to be sensitive to binlog format
+--source include/have_innodb.inc
+--source include/have_binlog_format_mixed_or_row.inc
+
+delimiter |;
+
+#
+# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
+# Bug #23333 stored function + non-transac table + transac table =
+# breaks stmt-based binlog
+# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
+#
+--disable_warnings
+drop function if exists bug23333|
+drop table if exists t1,t2|
+--enable_warnings
+ CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
+ CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
+
+insert into t2 values (1,1)|
+
+create function bug23333()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ insert into t1 values (null);
+ select count(*) from t1 into @a;
+ return @a;
+end|
+
+reset master|
+--error ER_DUP_ENTRY_WITH_KEY_NAME
+insert into t2 values (bug23333(),1)|
+--replace_column 2 # 5 # 6 #
+show binlog events from 106 /* with fixes for #23333 will show there is the query */|
+select count(*),@a from t1 /* must be 1,1 */|
+
+delimiter ;|
+
+# clean-up
+
+drop table t1,t2;
+drop function if exists bug23333;
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 3ff84c35f16..fe731f4b0a1 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -1249,4 +1249,13 @@ insert into t1 values ('2000a');
insert into t1 values ('2E3x');
drop table t1;
+#
+# Bug#27069 set with identical elements are created
+#
+set sql_mode='traditional';
+--error 1291
+create table t1 (f1 set('a','a'));
+--error 1291
+create table t1 (f1 enum('a','a'));
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 88c34bdb9b9..3b7cc2abb73 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -2784,6 +2784,43 @@ SELECT COUNT(*) c, a,
DROP table t1,t2;
#
+# Bug#27321: Wrong subquery result in a grouping select
+#
+CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
+(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
+(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
+
+SELECT a, MAX(b),
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+ FROM t1 GROUP BY a;
+SELECT a x, MAX(b),
+ (SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
+ FROM t1 GROUP BY a;
+SELECT a, AVG(b),
+ (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
+ FROM t1 WHERE t1.d=0 GROUP BY a;
+
+SELECT tt.a,
+ (SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+ LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+ FROM t1 as tt;
+
+SELECT tt.a,
+ (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+ LIMIT 1)
+ FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+ FROM t1 as tt GROUP BY tt.a;
+
+SELECT tt.a, MAX(
+ (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+ LIMIT 1)
+ FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+ FROM t1 as tt GROUP BY tt.a;
+
+DROP TABLE t1;
+
+#
# Bug #27348: SET FUNCTION used in a subquery from WHERE condition
#
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index e8eae3e2452..11468cd6759 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -507,9 +507,6 @@ SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b))
SELECT * FROM t1 GROUP by t1.a
HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
HAVING MAX(t2.b+t1.a) < 10));
-#FIXME: Enable this test after fixing bug #27321
-#SELECT a, AVG(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b))
-# AS test FROM t1 GROUP BY a;
SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index f806bd8ec17..c52260124cb 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -52,3 +52,35 @@ SELECT * from t1;
drop table t1;
# End of 4.1 tests
+
+# Test for Bug#5507 "TRUNCATE should work with views"
+
+create table t1 (s1 int);
+
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v1 as select * from t1;
+truncate table v1;
+select count(*) from t1;
+
+insert into t1 (s1) values (1), (2), (3), (4), (5);
+create view v2 as select * from t1 where s1 > 3;
+truncate table v2;
+select * from t1;
+select * from v2;
+delete from t1;
+
+# The following should fail
+create table t2 (s1 int, s2 int);
+create view v3 as select a.s1, b.s2 from t1 a join t2 b on a.s1 = b.s1 where a.s1 > 3;
+--error 1395
+truncate table v3;
+
+# The following should fail
+create view v4 as select * from t1 limit 1,1;
+--error 1288
+truncate table v4;
+
+drop view v1, v2, v3, v4;
+drop table t1, t2;
+
+# End of 5.0 tests
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index c6050753943..02cd07e3c16 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -123,3 +123,16 @@ insert into t1 values ('2000-01-01','2000-01-02');
select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #23093: Implicit conversion of 9912101 to date does not match
+# cast(9912101 as date)
+#
+select @d:=1111, year(@d), month(@d), day(@d), cast(@d as date);
+select @d:=011111, year(@d), month(@d), day(@d), cast(@d as date);
+select @d:=1311, year(@d), month(@d), day(@d), cast(@d as date);
+create table t1 (d date , dt datetime , ts timestamp);
+insert into t1 values (9912101,9912101,9912101);
+insert into t1 values (11111,11111,11111);
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 9246080630e..b4c10408b37 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -141,3 +141,25 @@ SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) AS DECIMAL(20,6));
SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
SELECT CAST(CAST('10:11:12.098700' AS TIME) AS DECIMAL(20,6));
+#
+# Test of storing datetime into date fields
+#
+
+set @org_mode=@@sql_mode;
+create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
+show create table t1;
+insert into t1 values ();
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+set @@sql_mode='ansi,traditional';
+insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
+insert into t1 set dt='2007-03-23 13:49:38',da=dt;
+# Test error handling
+--error 1292
+insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
+select * from t1;
+drop table t1;
+--error 1067
+create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
+--error 1067
+create table t1 (t time default '916:00:00 a');
+set @@sql_mode= @org_mode;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 4961d95d0ac..620f292bc12 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2221,6 +2221,8 @@ REPAIR TABLE v1;
DROP TABLE t1;
OPTIMIZE TABLE v1;
+ANALYZE TABLE v1;
+REPAIR TABLE v1;
DROP VIEW v1;
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
index 64cafe89d10..b3bfd1cf544 100644
--- a/mysql-test/t/view_grant.test
+++ b/mysql-test/t/view_grant.test
@@ -356,25 +356,6 @@ drop view mysqltest.v3;
connection user1;
create view mysqltest.v3 as select b from mysqltest.t2;
-# give UPDATE and INSERT privilege (to get more privileges then underlying
-# table)
-connection root;
-grant create view, update, insert on mysqltest.v3 to mysqltest_1@localhost;
-drop view mysqltest.v3;
-connection user1;
--- error 1143
-create view mysqltest.v3 as select b from mysqltest.t2;
-
-
-# If we would get more privileges on VIEW then we have on
-# underlying tables => creation prohibited
-connection root;
-create table mysqltest.v3 (b int);
-grant select(b) on mysqltest.v3 to mysqltest_1@localhost;
-drop table mysqltest.v3;
-connection user1;
--- error 1143
-create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges
-- error 1143
@@ -1072,6 +1053,97 @@ DROP USER u26813@localhost;
DROP DATABASE db26813;
disconnect u1;
+#
+# BUG#24040: Create View don't succed with "all privileges" on a database.
+#
+
+# Prepare.
+
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+DROP DATABASE IF EXISTS mysqltest2;
+--enable_warnings
+
+CREATE DATABASE mysqltest1;
+CREATE DATABASE mysqltest2;
+
+# Test.
+
+CREATE TABLE mysqltest1.t1(c1 INT);
+CREATE TABLE mysqltest1.t2(c2 INT);
+CREATE TABLE mysqltest1.t3(c3 INT);
+CREATE TABLE mysqltest1.t4(c4 INT);
+
+INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
+INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
+INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
+INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
+
+GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
+GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
+GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
+GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
+
+GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
+
+--connect (bug24040_con,localhost,mysqltest_u1,,mysqltest2)
+--echo
+--echo ---> connection: bug24040_con
+
+SELECT * FROM mysqltest1.t1;
+INSERT INTO mysqltest1.t2 VALUES(25);
+UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
+DELETE FROM mysqltest1.t4 WHERE c4 = 44;
+
+CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
+CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
+CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
+CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
+
+SELECT * FROM v1;
+INSERT INTO v2 VALUES(26);
+UPDATE v3 SET c3 = 332 WHERE c3 = 32;
+DELETE FROM v4 WHERE c4 = 43;
+
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
+CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
+CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
+
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
+
+CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
+CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
+
+CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
+CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
+
+--connection default
+--echo
+--echo ---> connection: default
+
+SELECT * FROM mysqltest1.t1;
+SELECT * FROM mysqltest1.t2;
+SELECT * FROM mysqltest1.t3;
+SELECT * FROM mysqltest1.t4;
+
+# Cleanup.
+
+-- disconnect bug24040_con
+
+DROP DATABASE mysqltest1;
+DROP DATABASE mysqltest2;
+DROP USER mysqltest_u1@localhost;
+
--echo End of 5.0 tests.