1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-6880 Can't define CURRENT_TIMESTAMP as default value for added column

ALTER TABLE: don't fill default values per row, do it once.
And do it in two places - for copy_data_between_tables() and for online ALTER.

Also, run function_defaults test both for MyISAM and for InnoDB.
This commit is contained in:
Sergei Golubchik
2014-11-18 22:25:33 +01:00
parent 5cfc62f9c6
commit 303eec5774
8 changed files with 3186 additions and 29 deletions

View File

@ -1050,7 +1050,7 @@ SET TIME_ZONE = "+03:00";
--echo # 1970-01-01 03:16:40
SET TIMESTAMP = 1000.123456;
eval CREATE TABLE t1 ( a INT, b $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp) ENGINE = INNODB;
eval CREATE TABLE t1 ( a INT, b $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp);
SHOW CREATE TABLE t1;
@ -1107,10 +1107,10 @@ eval CREATE TABLE t1 (
b INT,
ts $timestamp NOT NULL DEFAULT $current_timestamp ON UPDATE $current_timestamp,
PRIMARY KEY ( a, ts )
) ENGINE = INNODB;
);
INSERT INTO t1( a, b, ts ) VALUES ( 1, 0, '2000-09-28 17:44:34' );
eval CREATE TABLE t2 ( a INT ) ENGINE = INNODB;
eval CREATE TABLE t2 ( a INT );
INSERT INTO t2 VALUES ( 1 );
UPDATE t1 STRAIGHT_JOIN t2
@ -1146,8 +1146,7 @@ eval ALTER TABLE t1 ADD COLUMN c4 $datetime ON UPDATE $now AFTER c3;
eval ALTER TABLE t1 ADD COLUMN c5 $datetime DEFAULT $now AFTER c4;
eval ALTER TABLE t1 ADD COLUMN c6 $datetime DEFAULT $now ON UPDATE $now AFTER c5;
SELECT * FROM t1;
query_vertical SELECT * FROM t1;
DROP TABLE t1;