diff options
author | Mattias Jonsson <mattias.jonsson@sun.com> | 2009-08-12 12:03:05 +0200 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@sun.com> | 2009-08-12 12:03:05 +0200 |
commit | 2e76de9e6c4f55f9e88b7eba5a658b2cde6c49b0 (patch) | |
tree | f460aa465ae53a1bd1b76d6f4cf144dd0a6957dc | |
parent | bda10bab2aa4d6af7e289f0562612ea2c1e6cd06 (diff) | |
parent | 060590dcb282d484344a6d6fe01fca08f4544277 (diff) | |
download | mariadb-git-2e76de9e6c4f55f9e88b7eba5a658b2cde6c49b0.tar.gz |
manual merge
-rw-r--r-- | mysql-test/r/partition.result | 37 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 25 | ||||
-rw-r--r-- | mysql-test/t/partition_disabled.test | 2 | ||||
-rw-r--r-- | sql/sql_partition.cc | 3 |
4 files changed, 66 insertions, 1 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 05350db1ee0..40c2728ce26 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,4 +1,41 @@ drop table if exists t1, t2; +CREATE TABLE t1 ( +a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, +b varchar(10), +PRIMARY KEY (a) +) +PARTITION BY RANGE (to_days(a)) ( +PARTITION p1 VALUES LESS THAN (733407), +PARTITION pmax VALUES LESS THAN MAXVALUE +); +INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1'); +INSERT INTO t1 VALUES ('2009-07-14 17:35:55', 'pmax'); +INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax'); +SELECT * FROM t1; +a b +2007-07-30 17:35:48 p1 +2009-07-14 17:35:55 pmax +2009-09-21 17:31:42 pmax +ALTER TABLE t1 REORGANIZE PARTITION pmax INTO ( +PARTITION p3 VALUES LESS THAN (733969), +PARTITION pmax VALUES LESS THAN MAXVALUE); +SELECT * FROM t1; +a b +2007-07-30 17:35:48 p1 +2009-07-14 17:35:55 pmax +2009-09-21 17:31:42 pmax +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `b` varchar(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY RANGE (to_days(a)) +(PARTITION p1 VALUES LESS THAN (733407) ENGINE = MyISAM, + PARTITION p3 VALUES LESS THAN (733969) ENGINE = MyISAM, + PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +DROP TABLE t1; CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a)) ENGINE=MyISAM PARTITION BY HASH (a); diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 0b497d86623..0363327a675 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -15,6 +15,31 @@ drop table if exists t1, t2; --enable_warnings # +# Bug#46478: timestamp field incorrectly defaulted when partition is reorganized +# +CREATE TABLE t1 ( + a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + b varchar(10), + PRIMARY KEY (a) +) +PARTITION BY RANGE (to_days(a)) ( + PARTITION p1 VALUES LESS THAN (733407), + PARTITION pmax VALUES LESS THAN MAXVALUE +); + +INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1'); +INSERT INTO t1 VALUES ('2009-07-14 17:35:55', 'pmax'); +INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax'); + +SELECT * FROM t1; +ALTER TABLE t1 REORGANIZE PARTITION pmax INTO ( + PARTITION p3 VALUES LESS THAN (733969), + PARTITION pmax VALUES LESS THAN MAXVALUE); +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# # Bug#36001: Partitions: spelling and using some error messages # --error ER_FOREIGN_KEY_ON_PARTITIONED diff --git a/mysql-test/t/partition_disabled.test b/mysql-test/t/partition_disabled.test index 2f068b8c3cc..320d6238502 100644 --- a/mysql-test/t/partition_disabled.test +++ b/mysql-test/t/partition_disabled.test @@ -15,7 +15,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; # Bug#39893: Crash if select on a partitioned table, # when partitioning is disabled FLUSH TABLES; ---copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm +--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm SELECT * FROM t1; TRUNCATE TABLE t1; ANALYZE TABLE t1; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index a181a6b3f13..61766e5c509 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6077,6 +6077,9 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, lpt->pack_frm_len= 0; thd->work_part_info= part_info; + /* Never update timestamp columns when alter */ + table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET; + if (fast_alter_partition & HA_PARTITION_ONE_PHASE) { /* |