diff options
Diffstat (limited to 'mysql-test/t/innodb_mysql.test')
-rw-r--r-- | mysql-test/t/innodb_mysql.test | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index 63eff93ba7f..f2c770cce42 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -589,6 +589,66 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b); DROP TABLE t1; + +--echo # +--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when +--echo # JOINed during an UPDATE +--echo # + +CREATE TABLE t1 (d INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT, b INT, + c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB; + +--echo set up our data elements +INSERT INTO t1 (d) VALUES (1); +INSERT INTO t2 (a,b) VALUES (1,1); +SELECT SECOND(c) INTO @bug47453 FROM t2; + +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; + +SELECT SLEEP(1); + +UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; + +--echo #should be 0 +SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; + +DROP TABLE t1, t2; + +--echo # +--echo # Bug #53334: wrong result for outer join with impossible ON condition +--echo # (see the same test case for MyISAM in join.test) +--echo # + +CREATE TABLE t1 (id INT PRIMARY KEY); +CREATE TABLE t2 (id INT); + +INSERT INTO t1 VALUES (75); +INSERT INTO t1 VALUES (79); +INSERT INTO t1 VALUES (78); +INSERT INTO t1 VALUES (77); +REPLACE INTO t1 VALUES (76); +REPLACE INTO t1 VALUES (76); +INSERT INTO t1 VALUES (104); +INSERT INTO t1 VALUES (103); +INSERT INTO t1 VALUES (102); +INSERT INTO t1 VALUES (101); +INSERT INTO t1 VALUES (105); +INSERT INTO t1 VALUES (106); +INSERT INTO t1 VALUES (107); + +INSERT INTO t2 VALUES (107),(75),(1000); + +SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0 + WHERE t2.id=75 AND t1.id IS NULL; +EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0 + WHERE t2.id=75 AND t1.id IS NULL; + +DROP TABLE t1,t2; + --echo End of 5.1 tests |