diff options
author | Chad MILLER <chad@mysql.com> | 2008-08-15 14:26:25 -0400 |
---|---|---|
committer | Chad MILLER <chad@mysql.com> | 2008-08-15 14:26:25 -0400 |
commit | 35c8b4c5e744c5d71280fbd1bf265ee022e5618f (patch) | |
tree | babb7a9775a0dbe57360bdd42f02d15b6c0879db /mysql-test | |
parent | 986a27fb032532efc504a71581a61b0732ac12d8 (diff) | |
download | mariadb-git-35c8b4c5e744c5d71280fbd1bf265ee022e5618f.tar.gz |
Bug#38272: timestamps fields incorrectly defaulted on \
update accross partitions.
It's not Innodb-specific bug.
ha_partition::update_row() didn't set
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET when
orig_timestamp_type == TIMESTAMP_AUTO_SET_ON_INSERT.
So that a partition sets the timestamp field when a record
is moved to a different partition.
Fixed by doing '= TIMESTAMP_NO_AUTO_SET' unconditionally.
Also ha_partition::write_row() is fixed in same way as now
Field_timestamp::set() is called twice in SET_ON_INSERT case.
(Chad queues this patch on demand by Trudy/Davi.)
mysql-test/r/partition.result:
Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
test result
mysql-test/t/partition.test:
Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
test case
sql/ha_partition.cc:
Bug#38272 timestamps fields incorrectly defaulted on update accross partitions.
Do table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET unconditionally
in ha_partition::update_row and ::write_row()
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/partition.result | 25 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 30 |
2 files changed, 55 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index fac4735b337..a441a841a07 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1612,4 +1612,29 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ drop table t1; +CREATE TABLE t1 ( +`ID` bigint(20) NOT NULL AUTO_INCREMENT, +`createdDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, +`number` int, +PRIMARY KEY (`ID`, number) +) +PARTITION BY RANGE (number) ( +PARTITION p0 VALUES LESS THAN (6), +PARTITION p1 VALUES LESS THAN (11) +); +create table t2 ( +`ID` bigint(20), +`createdDate` TIMESTAMP, +`number` int +); +INSERT INTO t1 SET number=1; +insert into t2 select * from t1; +SELECT SLEEP(1); +SLEEP(1) +0 +UPDATE t1 SET number=6; +select count(*) from t1, t2 where t1.createdDate = t2.createdDate; +count(*) +1 +drop table t1, t2; End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 211a9950d67..5270eced05f 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1761,4 +1761,34 @@ while ($n) --enable_query_log show create table t1; drop table t1; + +# +# Bug #38272 timestamps fields incorrectly defaulted on update accross partitions. +# + +CREATE TABLE t1 ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT, + `createdDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `number` int, + PRIMARY KEY (`ID`, number) +) +PARTITION BY RANGE (number) ( + PARTITION p0 VALUES LESS THAN (6), + PARTITION p1 VALUES LESS THAN (11) +); + +create table t2 ( + `ID` bigint(20), + `createdDate` TIMESTAMP, + `number` int +); + +INSERT INTO t1 SET number=1; +insert into t2 select * from t1; +SELECT SLEEP(1); +UPDATE t1 SET number=6; +select count(*) from t1, t2 where t1.createdDate = t2.createdDate; + +drop table t1, t2; + --echo End of 5.1 tests |