--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
CREATE TABLE t1(c1 DATE NOT NULL);
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
--sorted_result
SELECT * FROM t1 ORDER BY c1;
UPDATE t1 SET c1 = NOW() WHERE c1 >= ADDTIME(NOW(),'2 02:01:01');
--sorted_result
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
CREATE TABLE t1(c1 TIME NOT NULL);
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
--sorted_result
SELECT * FROM t1 ORDER BY c1;
UPDATE t1 SET c1 = NOW() WHERE c1 >= ADDTIME(NOW(),'2 02:01:01');
--sorted_result
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
CREATE TABLE t1(c1 DATETIME NOT NULL);
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
--sorted_result
SELECT * FROM t1 ORDER BY c1;
UPDATE t1 SET c1 = NOW() WHERE c1 >= ADDTIME(NOW(),'2 02:01:01');
--sorted_result
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
CREATE TABLE t1(c1 TIMESTAMP NOT NULL);
SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
INSERT INTO t1 (c1) VALUES(NOW());
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'1 01:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'2 02:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'3 03:01:01'));
INSERT INTO t1 (c1) VALUES(ADDTIME(NOW(),'4 04:01:01'));
--sorted_result
SELECT * FROM t1 ORDER BY c1;
UPDATE t1 SET c1 = NOW() WHERE c1 >= ADDTIME(NOW(),'2 02:01:01');
--sorted_result
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;

