diff options
132 files changed, 2094 insertions, 2195 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index f3e41e1b246..dbfe2e8e162 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -2073,8 +2073,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `mini` CHECK (a+b > 100) + CONSTRAINT `min` CHECK (((`a` + `b`) > 100)), + CONSTRAINT `mini` CHECK (((`a` + `b`) > 100)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5), diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result index 9f653a17ce8..ac90a6ec68b 100644 --- a/mysql-test/r/cast.result +++ b/mysql-test/r/cast.result @@ -804,7 +804,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` char(5) AS (cast("a" as char(10) binary) + a) VIRTUAL + `b` char(5) AS ((cast('a' as char(10) charset latin1) + `a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select collation(cast("a" as char(10) binary)); diff --git a/mysql-test/r/check_constraint.result b/mysql-test/r/check_constraint.result index f3c1fda1eee..ddca2ea1393 100644 --- a/mysql-test/r/check_constraint.result +++ b/mysql-test/r/check_constraint.result @@ -3,10 +3,10 @@ create table t1 (a int check(a>10), b int check (b > 20), constraint `min` check show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `max` CHECK (a+b <500) + `a` int(11) DEFAULT NULL CHECK ((`a` > 10)), + `b` int(11) DEFAULT NULL CHECK ((`b` > 20)), + CONSTRAINT `min` CHECK (((`a` + `b`) > 100)), + CONSTRAINT `max` CHECK (((`a` + `b`) < 500)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (100,100); insert into t1 values (1,1); @@ -52,12 +52,12 @@ set check_constraint_checks=@save_check_constraint; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - `c` int(11) DEFAULT 0 CHECK (c < 10), - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `max` CHECK (a+b <500), - CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) + `a` int(11) DEFAULT NULL CHECK ((`a` > 10)), + `b` int(11) DEFAULT NULL CHECK ((`b` > 20)), + `c` int(11) DEFAULT 0 CHECK ((`c` < 10)), + CONSTRAINT `min` CHECK (((`a` + `b`) > 100)), + CONSTRAINT `max` CHECK (((`a` + `b`) < 500)), + CONSTRAINT `CONSTRAINT_1` CHECK ((((`a` + `b`) + `c`) < 500)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values(105,105,105); ERROR 23000: CONSTRAINT `c` failed for `test`.`t1` @@ -75,12 +75,12 @@ create table t2 like t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - `c` int(11) DEFAULT 0 CHECK (c < 10), - CONSTRAINT `min` CHECK (a+b > 100), - CONSTRAINT `max` CHECK (a+b <500), - CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) + `a` int(11) DEFAULT NULL CHECK ((`a` > 10)), + `b` int(11) DEFAULT NULL CHECK ((`b` > 20)), + `c` int(11) DEFAULT 0 CHECK ((`c` < 10)), + CONSTRAINT `min` CHECK (((`a` + `b`) > 100)), + CONSTRAINT `max` CHECK (((`a` + `b`) < 500)), + CONSTRAINT `CONSTRAINT_1` CHECK ((((`a` + `b`) + `c`) < 500)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t2 drop constraint c; ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists @@ -91,11 +91,11 @@ alter table t2 drop constraint min; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL CHECK (a>10), - `b` int(11) DEFAULT NULL CHECK (b > 20), - `c` int(11) DEFAULT 0 CHECK (c < 10), - CONSTRAINT `max` CHECK (a+b <500), - CONSTRAINT `CONSTRAINT_1` CHECK (a+b+c < 500) + `a` int(11) DEFAULT NULL CHECK ((`a` > 10)), + `b` int(11) DEFAULT NULL CHECK ((`b` > 20)), + `c` int(11) DEFAULT 0 CHECK ((`c` < 10)), + CONSTRAINT `max` CHECK (((`a` + `b`) < 500)), + CONSTRAINT `CONSTRAINT_1` CHECK ((((`a` + `b`) + `c`) < 500)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create or replace table t1 (a int, b int, constraint check (a>b)); @@ -104,7 +104,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>b) + CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a int, b int, constraint CONSTRAINT_1 check (a>1), @@ -114,8 +114,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>1), - CONSTRAINT `CONSTRAINT_2` CHECK (b>1) + CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > 1)), + CONSTRAINT `CONSTRAINT_2` CHECK ((`b` > 1)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a int, b int, constraint CONSTRAINT_1 check (a>1), @@ -126,8 +126,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>1), - CONSTRAINT `CONSTRAINT_3` CHECK (b>1), - CONSTRAINT `CONSTRAINT_2` CHECK (a>b) + CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > 1)), + CONSTRAINT `CONSTRAINT_3` CHECK ((`b` > 1)), + CONSTRAINT `CONSTRAINT_2` CHECK ((`a` > `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/constraints.result b/mysql-test/r/constraints.result index 8ab38bf1f35..017d03f7e67 100644 --- a/mysql-test/r/constraints.result +++ b/mysql-test/r/constraints.result @@ -3,7 +3,7 @@ create table t1 (a int check (a>0)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL CHECK (a>0) + `a` int(11) DEFAULT NULL CHECK ((`a` > 0)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1); insert into t1 values (0); @@ -15,7 +15,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `CONSTRAINT_1` CHECK (a>b) + CONSTRAINT `CONSTRAINT_1` CHECK ((`a` > `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,0); insert into t1 values (0,1); @@ -27,7 +27,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - CONSTRAINT `abc` CHECK (a>b) + CONSTRAINT `abc` CHECK ((`a` > `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,0); insert into t1 values (0,1); diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 801a500345e..4baa254a966 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1866,8 +1866,8 @@ Thinkpad Laptop black ttt show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `color` char(32) AS (COLUMN_GET(dynamic_cols, 1 as char)) PERSISTENT, - `cl` char(32) AS (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) PERSISTENT, + `color` char(32) AS (column_get(`dynamic_cols`,1 as char charset latin1)) PERSISTENT, + `cl` char(32) AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 ),2,'ttt'),`i` as char charset latin1)) PERSISTENT, `item_name` varchar(32) NOT NULL, `i` int(11) DEFAULT NULL, `dynamic_cols` blob DEFAULT NULL, @@ -1888,7 +1888,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) DEFAULT NULL, - `c` char(32) AS (convert(cast(n as char), char)) PERSISTENT + `c` char(32) AS (cast(cast(`n` as char charset latin1) as char charset latin1)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set @@session.collation_server=filename; diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index eb1746b933b..77e1224fa83 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2869,11 +2869,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 36dc23f33be..3f8dae4e03d 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -3278,11 +3278,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(convert(v_LastPaymentDate@0 using cp1251),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 5ed8e9e8868..1a155a1c63d 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -3575,11 +3575,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(v_LastPaymentDate@0,now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(v_LastPaymentDate@0,current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion diff --git a/mysql-test/r/ctype_like_range.result b/mysql-test/r/ctype_like_range.result index 176cfe3acf0..f8032d0ae86 100644 --- a/mysql-test/r/ctype_like_range.result +++ b/mysql-test/r/ctype_like_range.result @@ -4419,8 +4419,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `mn` varchar(10) DEFAULT LIKE_RANGE_MIN(a,10), - `mx` varchar(10) DEFAULT LIKE_RANGE_MAX(a,10) + `mn` varchar(10) DEFAULT like_range_min(`a`,10), + `mx` varchar(10) DEFAULT like_range_max(`a`,10) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%'); SELECT a, HEX(mn), HEX(mx) FROM t1; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 9902a91a2bf..61367cbe081 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4478,11 +4478,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(now() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(convert(v_LastPaymentDate@0 using ucs2),convert(current_timestamp() using ucs2)) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 5e76aa2c203..bd148d82ac7 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -5320,11 +5320,11 @@ NULL id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Level Code Message -Note 1003 select (v_LastPaymentDate@0 < now()) AS `v_LastPaymentDate < NOW()` +Note 1003 select (v_LastPaymentDate@0 < current_timestamp()) AS `v_LastPaymentDate < NOW()` id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),now()) AS `CONCAT(v_LastPaymentDate, NOW())` +Note 1003 select concat(convert(v_LastPaymentDate@0 using utf8),current_timestamp()) AS `CONCAT(v_LastPaymentDate, NOW())` DROP PROCEDURE p1; # # Bug#52159 returning time type from function and empty left join causes debug assertion @@ -10515,7 +10515,7 @@ SET NAMES utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT CONCAT('ß') + `a` varchar(30) DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a),a FROM t1; @@ -10528,9 +10528,9 @@ ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT CONCAT('ß'), - `b` varchar(30) DEFAULT CONCAT('ß'), - `c` varchar(30) DEFAULT CONCAT('ß') + `a` varchar(30) DEFAULT concat('ß'), + `b` varchar(30) DEFAULT concat('ß'), + `c` varchar(30) DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELETE FROM t1; INSERT INTO t1 VALUES(); @@ -10551,7 +10551,7 @@ SET NAMES utf8; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß') + `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a), a FROM t1; @@ -10563,7 +10563,7 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß')); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT CONCAT('ß') + `a` varchar(30) DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; @@ -10575,7 +10575,7 @@ CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß')); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) CHARACTER SET utf8 DEFAULT CONCAT('ß') + `a` varchar(30) CHARACTER SET utf8 DEFAULT concat('ß') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT HEX(a) FROM t1; diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index 03a444e6075..7e9fff5fe9d 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -247,19 +247,19 @@ CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIM SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP(6) + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(2) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `event_time` timestamp(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP(6) + `event_time` timestamp(6) NOT NULL DEFAULT sysdate(2) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # @@ -270,8 +270,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, - `b` int(11) DEFAULT (a+1), - `c` int(11) DEFAULT (a+b) + `b` int(11) DEFAULT ((`a` + 1)), + `c` int(11) DEFAULT ((`a` + `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (); insert into t1 (a) values (2); @@ -301,8 +301,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` blob DEFAULT 1, - `c` blob DEFAULT "hello", - `t` text DEFAULT concat(a,b,c) + `c` blob DEFAULT 'hello', + `t` text DEFAULT concat(`a`,`b`,`c`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (2); insert into t1 (a,b) values (10,"test1"); @@ -345,11 +345,11 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT 1, `c` int(11) DEFAULT -1, - `d` int(11) DEFAULT (1+1), - `e` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `f` int(11) DEFAULT (1+1+1), - `g` int(11) NOT NULL DEFAULT (1+1+1+1), - `h` int(11) DEFAULT (2+2+2+2) + `d` int(11) DEFAULT ((1 + 1)), + `e` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `f` int(11) DEFAULT (((1 + 1) + 1)), + `g` int(11) NOT NULL DEFAULT ((((1 + 1) + 1) + 1)), + `h` int(11) DEFAULT ((((2 + 2) + 2) + 2)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create table t2 like t1; show create table t2; @@ -358,11 +358,11 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT 1, `c` int(11) DEFAULT -1, - `d` int(11) DEFAULT (1+1), - `e` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `f` int(11) DEFAULT (1+1+1), - `g` int(11) NOT NULL DEFAULT (1+1+1+1), - `h` int(11) DEFAULT (2+2+2+2) + `d` int(11) DEFAULT ((1 + 1)), + `e` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `f` int(11) DEFAULT (((1 + 1) + 1)), + `g` int(11) NOT NULL DEFAULT ((((1 + 1) + 1) + 1)), + `h` int(11) DEFAULT ((((2 + 2) + 2) + 2)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t2 (a) values (100); select a,b,c,d,e,f,g,h from t2; @@ -373,7 +373,7 @@ create table t1 (a int default (1----1), b int default - 1, c int default +1, e show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (1----1), + `a` int(11) DEFAULT ((1 - -1)), `b` int(11) DEFAULT -1, `c` int(11) DEFAULT 1, `e` int(11) DEFAULT 1 @@ -542,11 +542,16 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; DEALLOCATE PREPARE stmt; -PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?+?))'; +prepare stmt from 'create table t1 (a int default(?+?))'; set @a=1; execute stmt using @a,@a; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?+?)' at line 1 -DEALLOCATE PREPARE stmt; +deallocate prepare stmt; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT ((1 + 1)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; # # Parenthesized Item_basic_constant # @@ -623,20 +628,20 @@ d03 DATETIME DEFAULT COALESCE(TIMESTAMP'2001-01-01 10:20:30') SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `i01` int(11) DEFAULT COALESCE(1), - `i02` int(11) DEFAULT COALESCE(0x3939), - `i03` int(11) DEFAULT COALESCE(1.0), - `i04` int(11) DEFAULT COALESCE(1e0), - `i05` int(11) DEFAULT COALESCE(NULL), - `f01` double DEFAULT COALESCE(PI()), - `s01` varchar(10) DEFAULT COALESCE(_latin1'test'), - `s02` varchar(10) DEFAULT COALESCE('test'), - `s03` varchar(10) DEFAULT COALESCE(0x40), - `s04` varchar(10) DEFAULT COALESCE(X'40'), - `s05` varchar(10) DEFAULT COALESCE(B'1000000'), - `d01` time DEFAULT COALESCE(TIME'10:20:30'), - `d02` date DEFAULT COALESCE(DATE'2001-01-01'), - `d03` datetime DEFAULT COALESCE(TIMESTAMP'2001-01-01 10:20:30') + `i01` int(11) DEFAULT coalesce(1), + `i02` int(11) DEFAULT coalesce(0x3939), + `i03` int(11) DEFAULT coalesce(1.0), + `i04` int(11) DEFAULT coalesce(1e0), + `i05` int(11) DEFAULT coalesce(NULL), + `f01` double DEFAULT coalesce(pi()), + `s01` varchar(10) DEFAULT coalesce(_latin1'test'), + `s02` varchar(10) DEFAULT coalesce('test'), + `s03` varchar(10) DEFAULT coalesce(0x40), + `s04` varchar(10) DEFAULT coalesce(X'40'), + `s05` varchar(10) DEFAULT coalesce(0x40), + `d01` time DEFAULT coalesce(TIME'10:20:30'), + `d02` date DEFAULT coalesce(DATE'2001-01-01'), + `d03` datetime DEFAULT coalesce(TIMESTAMP'2001-01-01 10:20:30') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -682,7 +687,7 @@ CREATE TABLE t1 (a INT DEFAULT COALESCE(1) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT COALESCE(1) + `a` int(11) NOT NULL DEFAULT coalesce(1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -707,7 +712,7 @@ CREATE TABLE t1 (a INT DEFAULT CONCAT('1') NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT CONCAT('1') + `a` int(11) NOT NULL DEFAULT concat('1') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -718,7 +723,7 @@ CREATE TABLE t1 (a INT DEFAULT COALESCE('1') NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT COALESCE('1') + `a` int(11) NOT NULL DEFAULT coalesce('1') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -767,7 +772,7 @@ Note 1265 Data truncated for column 'a' at row 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT CONCAT('1 ') + `a` int(11) DEFAULT concat('1 ') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); Warnings: @@ -782,7 +787,7 @@ Note 1265 Data truncated for column 'a' at row 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT COALESCE('1 ') + `a` int(11) DEFAULT coalesce('1 ') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); Warnings: @@ -830,7 +835,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT CONCAT(0x41) + `a` varchar(2) NOT NULL DEFAULT concat(0x41) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -841,7 +846,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT COALESCE(0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT COALESCE(0x41) + `a` varchar(2) NOT NULL DEFAULT coalesce(0x41) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -852,7 +857,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 0x41) NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT CONCAT(_utf8 0x41) + `a` varchar(2) NOT NULL DEFAULT concat(_utf8'A') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -863,7 +868,7 @@ CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 X'41') NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(2) NOT NULL DEFAULT CONCAT(_utf8 X'41') + `a` varchar(2) NOT NULL DEFAULT concat(_utf8'A') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); SELECT * FROM t1; @@ -901,7 +906,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT a + `b` int(11) DEFAULT `a` ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, 1); INSERT INTO t1 VALUES (DEFAULT, DEFAULT); @@ -921,7 +926,7 @@ CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT 1); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT DEFAULT(b), + `a` int(11) DEFAULT default(`b`), `b` int(11) DEFAULT 1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT, DEFAULT); @@ -934,7 +939,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, - `b` int(11) DEFAULT DEFAULT(a) + `b` int(11) DEFAULT default(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT, DEFAULT); SELECT * FROM t1; @@ -948,21 +953,21 @@ CREATE TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` datetime DEFAULT CURRENT_TIMESTAMP + `a` datetime DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIME DEFAULT CURRENT_TIME); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` time DEFAULT CURRENT_TIME + `a` time DEFAULT curtime() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a DATE DEFAULT CURRENT_DATE); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` date DEFAULT CURRENT_DATE + `a` date DEFAULT curdate() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -972,7 +977,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT CURRENT_TIMESTAMP(6)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT CURRENT_TIMESTAMP(6) + `a` decimal(30,6) DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -983,7 +988,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) + `a` decimal(30,6) DEFAULT coalesce(current_timestamp(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); Warnings: @@ -1003,7 +1008,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIME(6))); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT COALESCE(CURRENT_TIME(6)) + `a` decimal(30,6) DEFAULT coalesce(curtime(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); Warnings: @@ -1016,7 +1021,7 @@ CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_DATE)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,6) DEFAULT COALESCE(CURRENT_DATE) + `a` decimal(30,6) DEFAULT coalesce(curdate()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); Warnings: @@ -1029,21 +1034,21 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT COALESCE(CURRENT_TIMESTAMP) + `a` timestamp NOT NULL DEFAULT coalesce(current_timestamp()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a DATE DEFAULT COALESCE(CURRENT_DATE)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` date DEFAULT COALESCE(CURRENT_DATE) + `a` date DEFAULT coalesce(curdate()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIME DEFAULT COALESCE(CURRENT_TIME)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` time DEFAULT COALESCE(CURRENT_TIME) + `a` time DEFAULT coalesce(curtime()) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( @@ -1053,8 +1058,8 @@ b TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) + `a` timestamp NOT NULL DEFAULT current_timestamp(), + `b` timestamp NOT NULL DEFAULT coalesce(current_timestamp(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT CURRENT_TIMESTAMP(6); @@ -1071,8 +1076,8 @@ b DECIMAL(30,0) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` decimal(30,0) DEFAULT CURRENT_TIMESTAMP(6), - `b` decimal(30,0) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)) + `a` decimal(30,0) DEFAULT current_timestamp(6), + `b` decimal(30,0) DEFAULT coalesce(current_timestamp(6)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); Warnings: @@ -1089,7 +1094,7 @@ CREATE TABLE `t1` (`a` int(11) DEFAULT (3+3),`b` int(11) DEFAULT '1000'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (3+3), + `a` int(11) DEFAULT ((3 + 3)), `b` int(11) DEFAULT 1000 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,1),(2,2); @@ -1118,7 +1123,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,1) DEFAULT NULL, - `b` double DEFAULT (CAST(a AS DOUBLE)) + `b` double DEFAULT (cast(`a` as double)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (10.1, DEFAULT); SELECT * FROM t1; @@ -1130,9 +1135,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT EXP(a), - `c` double DEFAULT LOG(b), - `d` double DEFAULT LOG(4, b) + `b` double DEFAULT exp(`a`), + `c` double DEFAULT log(`b`), + `d` double DEFAULT log(4,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1144,8 +1149,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` double DEFAULT LOG2(a), - `c` double DEFAULT LOG10(a) + `b` double DEFAULT log2(`a`), + `c` double DEFAULT log10(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (100, DEFAULT, DEFAULT); @@ -1159,8 +1164,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT SQRT(a), - `c` double DEFAULT POW(a,3) + `b` double DEFAULT sqrt(`a`), + `c` double DEFAULT pow(`a`,3) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1172,9 +1177,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT ACOS(a), - `c` double DEFAULT ASIN(a), - `d` double DEFAULT ATAN(a) + `b` double DEFAULT acos(`a`), + `c` double DEFAULT asin(`a`), + `d` double DEFAULT atan(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, DEFAULT, DEFAULT, DEFAULT); SELECT a, b/PI(), c/PI(), d/PI() FROM t1; @@ -1186,10 +1191,10 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT COS(a), - `c` double DEFAULT SIN(a), - `d` double DEFAULT TAN(a), - `e` double DEFAULT COT(a) + `b` double DEFAULT cos(`a`), + `c` double DEFAULT sin(`a`), + `d` double DEFAULT tan(`a`), + `e` double DEFAULT cot(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (PI()/3); SELECT ROUND(a,3), ROUND(b,3), ROUND(c,3), ROUND(d,3), ROUND(e,3) FROM t1; @@ -1200,7 +1205,7 @@ CREATE TABLE t1 (a DOUBLE DEFAULT RAND()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` double DEFAULT RAND() + `a` double DEFAULT rand() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT); DROP TABLE t1; @@ -1209,8 +1214,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double DEFAULT DEGREES(a), - `c` double DEFAULT RADIANS(b) + `b` double DEFAULT degrees(`a`), + `c` double DEFAULT radians(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (PI(), DEFAULT, DEFAULT); SELECT * FROM t1; @@ -1225,7 +1230,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT INTERVAL(a, 10, 20, 30, 40) + `b` int(11) DEFAULT interval(`a`,10,20,30,40) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (34); SELECT * FROM t1; @@ -1238,7 +1243,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a DIV b) + `c` int(11) DEFAULT ((`a` DIV `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a, b) VALUES (13, 3); SELECT * FROM t1; @@ -1250,7 +1255,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT SIGN(a) + `b` int(11) DEFAULT sign(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (-10),(0), (10); SELECT * FROM t1; @@ -1264,7 +1269,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT FIELD(a, 'Hej', 'ej', 'Heja', 'hej', 'foo') + `b` int(11) DEFAULT field(`a`,'Hej','ej','Heja','hej','foo') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ej'); SELECT * FROM t1; @@ -1276,7 +1281,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT FIND_IN_SET(a, 'Hej,ej,Heja,hej,foo') + `b` int(11) DEFAULT find_in_set(`a`,'Hej,ej,Heja,hej,foo') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ej'); SELECT * FROM t1; @@ -1288,8 +1293,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` int(11) DEFAULT ASCII(a), - `c` int(11) DEFAULT ORD(a) + `b` int(11) DEFAULT ascii(`a`), + `c` int(11) DEFAULT ord(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; @@ -1300,7 +1305,7 @@ CREATE TABLE t1 (a TEXT DEFAULT UUID_SHORT()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text DEFAULT UUID_SHORT() + `a` text DEFAULT uuid_short() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT a>0 FROM t1; @@ -1339,7 +1344,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` date DEFAULT (DATE_ADD(a, INTERVAL b DAY)) + `c` date DEFAULT ((`a` + interval `b` day)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01', 30, DEFAULT); SELECT * FROM t1; @@ -1352,7 +1357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` time DEFAULT NULL, - `c` datetime DEFAULT ADDTIME(a, b) + `c` datetime DEFAULT addtime(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01', '10:20:30', DEFAULT); SELECT * FROM t1; @@ -1365,7 +1370,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(32) DEFAULT NULL, `b` varchar(32) DEFAULT NULL, - `c` date DEFAULT STR_TO_DATE(a,b) + `c` date DEFAULT str_to_date(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('01,5,2013','%d,%m,%Y', DEFAULT); SELECT * FROM t1; @@ -1379,8 +1384,8 @@ CREATE TABLE t1 (a DATE DEFAULT CURDATE(), b DATE DEFAULT UTC_DATE()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` date DEFAULT CURDATE(), - `b` date DEFAULT UTC_DATE() + `a` date DEFAULT curdate(), + `b` date DEFAULT utc_date() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -1393,7 +1398,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` date DEFAULT FROM_DAYS(a) + `b` date DEFAULT from_days(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (730669, DEFAULT); SELECT * FROM t1; @@ -1405,7 +1410,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` date DEFAULT LAST_DAY(a) + `b` date DEFAULT last_day(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2003-02-05', DEFAULT); SELECT * FROM t1; @@ -1418,7 +1423,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `yy` int(11) DEFAULT NULL, `yd` int(11) DEFAULT NULL, - `d` date DEFAULT MAKEDATE(yy, yd) + `d` date DEFAULT makedate(`yy`,`yd`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2011,32,DEFAULT); SELECT * FROM t1; @@ -1432,8 +1437,8 @@ CREATE TABLE t1 (a TIME DEFAULT CURTIME(), b TIME DEFAULT UTC_TIME()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` time DEFAULT CURTIME(), - `b` time DEFAULT UTC_TIME() + `a` time DEFAULT curtime(), + `b` time DEFAULT utc_time() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -1446,7 +1451,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time DEFAULT SEC_TO_TIME(a) + `b` time DEFAULT sec_to_time(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2378, DEFAULT); SELECT * FROM t1; @@ -1459,7 +1464,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` time DEFAULT TIMEDIFF(a,b) + `c` time DEFAULT timediff(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2000:01:01 00:00:00', '2000:01:02 10:20:30', DEFAULT); SELECT * FROM t1; @@ -1473,7 +1478,7 @@ t1 CREATE TABLE `t1` ( `hh` int(11) DEFAULT NULL, `mm` int(11) DEFAULT NULL, `ss` int(11) DEFAULT NULL, - `t` time DEFAULT MAKETIME(hh,mm,ss) + `t` time DEFAULT maketime(`hh`,`mm`,`ss`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (10,20,30,DEFAULT); SELECT * FROM t1; @@ -1487,8 +1492,8 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT NOW(), b TIMESTAMP DEFAULT UTC_TIMESTAMP()) SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT UTC_TIMESTAMP() + `a` timestamp NOT NULL DEFAULT current_timestamp(), + `b` timestamp NOT NULL DEFAULT utc_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT * FROM t1; @@ -1500,9 +1505,9 @@ CREATE TABLE t1 (a TIMESTAMP(6) DEFAULT SYSDATE(6), s INT, b TIMESTAMP(6) DEFAUL SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT SYSDATE(6), + `a` timestamp(6) NOT NULL DEFAULT sysdate(6), `s` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT SYSDATE(6) + `b` timestamp(6) NOT NULL DEFAULT sysdate(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (DEFAULT, SLEEP(0.1), DEFAULT); SELECT b>a FROM t1; @@ -1515,7 +1520,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT FROM_UNIXTIME(a) + `b` timestamp NOT NULL DEFAULT from_unixtime(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1447430881, DEFAULT); SELECT * FROM t1; @@ -1527,8 +1532,8 @@ CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP DEFAULT CONVERT_TZ(a, '-10:00', '+10:0 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CONVERT_TZ(a, '-10:00', '+10:00') + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT convert_tz(`a`,'-10:00','+10:00') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT); SELECT * FROM t1; @@ -1541,7 +1546,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` date DEFAULT CAST(a AS DATE) + `b` date DEFAULT cast(`a` as date) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (20010203, DEFAULT); SELECT * FROM t1; @@ -1553,7 +1558,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time DEFAULT CAST(a AS TIME) + `b` time DEFAULT cast(`a` as time) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (102030, DEFAULT); SELECT * FROM t1; @@ -1565,7 +1570,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` datetime DEFAULT CAST(a AS DATETIME) + `b` datetime DEFAULT cast(`a` as datetime) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (20010203102030, DEFAULT); SELECT * FROM t1; @@ -1581,7 +1586,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT PERIOD_ADD(a,b) + `c` int(11) DEFAULT period_add(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (200801, 2); SELECT * FROM t1; @@ -1594,7 +1599,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT PERIOD_DIFF(a,b) + `c` int(11) DEFAULT period_diff(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (200802, 200703); SELECT * FROM t1; @@ -1606,7 +1611,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT TO_DAYS(a) + `b` int(11) DEFAULT to_days(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (950501); SELECT * FROM t1; @@ -1618,7 +1623,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT TO_DAYS(a) + `b` int(11) DEFAULT to_days(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-10-07'); SELECT * FROM t1; @@ -1630,7 +1635,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` bigint(20) DEFAULT TO_SECONDS(a) + `b` bigint(20) DEFAULT to_seconds(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (950501); SELECT * FROM t1; @@ -1642,7 +1647,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT TO_SECONDS(a) + `b` bigint(20) DEFAULT to_seconds(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-11-29'); SELECT * FROM t1; @@ -1654,7 +1659,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) DEFAULT TO_SECONDS(a) + `b` bigint(20) DEFAULT to_seconds(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-11-29 13:43:32'); SELECT * FROM t1; @@ -1666,7 +1671,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT DAYOFMONTH(a) + `b` bigint(20) DEFAULT dayofmonth(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; @@ -1678,7 +1683,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT DAYOFWEEK(a) + `b` bigint(20) DEFAULT dayofweek(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; @@ -1690,7 +1695,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` bigint(20) DEFAULT DAYOFYEAR(a) + `b` bigint(20) DEFAULT dayofyear(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2007-02-03'); SELECT * FROM t1; @@ -1702,7 +1707,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT HOUR(a) + `b` int(11) DEFAULT hour(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; @@ -1714,7 +1719,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT MINUTE(a) + `b` int(11) DEFAULT minute(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; @@ -1726,7 +1731,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT SECOND(a) + `b` int(11) DEFAULT second(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('10:05:03'); SELECT * FROM t1; @@ -1738,7 +1743,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(6) DEFAULT NULL, - `b` int(11) DEFAULT MICROSECOND(a) + `b` int(11) DEFAULT microsecond(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-12-31 23:59:59.000010'); SELECT * FROM t1; @@ -1750,7 +1755,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT YEAR(a) + `b` int(11) DEFAULT year(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('1987-01-01'); SELECT * FROM t1; @@ -1762,7 +1767,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT MONTH(a) + `b` int(11) DEFAULT month(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('1987-01-01'); SELECT * FROM t1; @@ -1774,7 +1779,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT WEEK(a) + `b` int(11) DEFAULT week(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('1987-02-01'); SELECT * FROM t1; @@ -1786,7 +1791,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT YEARWEEK(a) + `b` int(11) DEFAULT yearweek(`a`,0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2000-01-01'); SELECT * FROM t1; @@ -1798,7 +1803,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT QUARTER(a) + `b` int(11) DEFAULT quarter(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2008-04-01'); SELECT * FROM t1; @@ -1810,7 +1815,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(YEAR FROM a) + `b` int(11) DEFAULT extract(year from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02'); SELECT * FROM t1; @@ -1822,7 +1827,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(YEAR_MONTH FROM a) + `b` int(11) DEFAULT extract(year_month from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03'); SELECT * FROM t1; @@ -1834,7 +1839,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(DAY_MINUTE FROM a) + `b` int(11) DEFAULT extract(day_minute from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03'); SELECT * FROM t1; @@ -1846,7 +1851,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime(6) DEFAULT NULL, - `b` int(11) DEFAULT EXTRACT(MICROSECOND FROM a) + `b` int(11) DEFAULT extract(microsecond from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03.000123'); SELECT * FROM t1; @@ -1859,7 +1864,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT NULL, - `c` int(11) DEFAULT TIMESTAMPDIFF(MONTH,a,b) + `c` int(11) DEFAULT timestampdiff(MONTH,`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01'); SELECT * FROM t1; @@ -1872,7 +1877,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` date DEFAULT NULL, - `c` int(11) DEFAULT TIMESTAMPDIFF(YEAR,a,b) + `c` int(11) DEFAULT timestampdiff(YEAR,`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('2002-05-01','2001-01-01'); SELECT * FROM t1; @@ -1885,7 +1890,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) DEFAULT TIMESTAMPDIFF(MINUTE,a,b) + `c` int(11) DEFAULT timestampdiff(MINUTE,`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01 12:05:55'); SELECT * FROM t1; @@ -1901,7 +1906,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT COALESCE(a,b) + `c` int(11) DEFAULT coalesce(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (NULL, 1, DEFAULT); SELECT * FROM t1; @@ -1914,7 +1919,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT IFNULL(a,b) + `c` int(11) DEFAULT ifnull(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (NULL, 2, DEFAULT); INSERT INTO t1 VALUES (1, 2, DEFAULT); @@ -1929,7 +1934,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULLIF(a,b) + `c` int(11) DEFAULT nullif(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, 1, DEFAULT); INSERT INTO t1 VALUES (1, 2, DEFAULT); @@ -1944,7 +1949,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT IF(a,b,2) + `c` int(11) DEFAULT if(`a`,`b`,2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 1, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT); @@ -1959,7 +1964,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (CASE WHEN a THEN b ELSE 2 END) + `c` int(11) DEFAULT ((case when `a` then `b` else 2 end)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 1, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT); @@ -1973,13 +1978,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (-a) + `b` int(11) DEFAULT (-(`a`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (-a) + `b` int(11) DEFAULT (-(`a`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (10, DEFAULT); SELECT * FROM t1; @@ -1991,7 +1996,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT ABS(a) + `b` int(11) DEFAULT abs(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (-10, DEFAULT); SELECT * FROM t1; @@ -2003,9 +2008,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) DEFAULT CEILING(a), - `c` int(11) DEFAULT FLOOR(a), - `d` int(11) DEFAULT ROUND(a) + `b` int(11) DEFAULT ceiling(`a`), + `c` int(11) DEFAULT floor(`a`), + `d` int(11) DEFAULT round(`a`,0) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1.5, DEFAULT, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (-1.5, DEFAULT, DEFAULT, DEFAULT); @@ -2020,8 +2025,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a+b), - `d` int(11) DEFAULT (a-b) + `c` int(11) DEFAULT ((`a` + `b`)), + `d` int(11) DEFAULT ((`a` - `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (2, 1, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -2034,18 +2039,18 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a*b), - `d` int(11) DEFAULT (a/b), - `e` int(11) DEFAULT (a MOD b) + `c` int(11) DEFAULT ((`a` * `b`)), + `d` int(11) DEFAULT ((`a` / `b`)), + `e` int(11) DEFAULT ((`a` % `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a*b), - `d` int(11) DEFAULT (a/b), - `e` int(11) DEFAULT (a MOD b) + `c` int(11) DEFAULT ((`a` * `b`)), + `d` int(11) DEFAULT ((`a` / `b`)), + `e` int(11) DEFAULT ((`a` % `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (7, 3, DEFAULT, DEFAULT, DEFAULT); SELECT * FROM t1; @@ -2058,7 +2063,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) DEFAULT UNIX_TIMESTAMP(a) + `b` int(11) DEFAULT unix_timestamp(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT); SELECT * FROM t1; @@ -2071,7 +2076,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` int(11) DEFAULT TIME_TO_SEC(a) + `b` int(11) DEFAULT time_to_sec(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES ('22:23:00', DEFAULT); SELECT * FROM t1; @@ -2084,8 +2089,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT LEAST(a,b), - `d` int(11) DEFAULT GREATEST(a,b) + `c` int(11) DEFAULT least(`a`,`b`), + `d` int(11) DEFAULT greatest(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0, 1, DEFAULT, DEFAULT); INSERT INTO t1 VALUES (1, 1, DEFAULT, DEFAULT); @@ -2100,7 +2105,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT LAST_VALUE(a,b) + `c` int(11) DEFAULT last_value(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (1, 2, DEFAULT); SELECT * FROM t1; @@ -2115,7 +2120,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` decimal(10,6) DEFAULT (CAST(a AS DECIMAL(10,1))) + `b` decimal(10,6) DEFAULT (cast(`a` as decimal(10,1))) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('123.456'); SELECT * FROM t1; @@ -2129,8 +2134,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,3) DEFAULT NULL, - `b` varchar(10) DEFAULT (CAST(a AS CHAR(10))), - `c` varchar(10) DEFAULT (CAST(a AS CHAR(4))) + `b` varchar(10) DEFAULT (cast(`a` as char(10) charset latin1)), + `c` varchar(10) DEFAULT (cast(`a` as char(4) charset latin1)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (123.456); Warnings: @@ -2144,7 +2149,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(10) unsigned DEFAULT (CAST(a AS UNSIGNED)) + `b` int(10) unsigned DEFAULT (cast(`a` as unsigned)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (-1); Warnings: @@ -2159,7 +2164,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned DEFAULT NULL, - `b` bigint(20) DEFAULT (CAST(a AS SIGNED)) + `b` bigint(20) DEFAULT (cast(`a` as signed)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (0xFFFFFFFFFFFFFFFF); SELECT * FROM t1; @@ -2176,9 +2181,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT a, - `c` varchar(10) CHARACTER SET utf8 DEFAULT CONVERT(a USING utf8), - `d` varbinary(10) DEFAULT (BINARY(a)) + `b` varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT `a`, + `c` varchar(10) CHARACTER SET utf8 DEFAULT convert(`a` using utf8), + `d` varbinary(10) DEFAULT (cast(`a` as char charset binary)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; @@ -2193,7 +2198,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT BIT_COUNT(a) + `b` int(11) DEFAULT bit_count(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (7); SELECT * FROM t1; @@ -2206,7 +2211,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a|b) + `c` int(11) DEFAULT ((`a` | `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (1,2); SELECT * FROM t1; @@ -2219,7 +2224,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a&b) + `c` int(11) DEFAULT ((`a` & `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (5,4); SELECT * FROM t1; @@ -2232,7 +2237,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a^b) + `c` int(11) DEFAULT ((`a` ^ `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (11,3); SELECT * FROM t1; @@ -2245,7 +2250,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a&~b) + `c` int(11) DEFAULT ((`a` & ~(`b`))) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (5,1); SELECT * FROM t1; @@ -2258,8 +2263,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT (a<<b), - `d` int(11) DEFAULT (a>>b) + `c` int(11) DEFAULT ((`a` << `b`)), + `d` int(11) DEFAULT ((`a` >> `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (5,1); SELECT * FROM t1; @@ -2274,7 +2279,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) DEFAULT REVERSE(a) + `b` varchar(20) DEFAULT reverse(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abcd'); SELECT * FROM t1; @@ -2286,8 +2291,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT UPPER(a), - `c` varchar(10) DEFAULT LOWER(a) + `b` varchar(10) DEFAULT ucase(`a`), + `c` varchar(10) DEFAULT lcase(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ABcd'); SELECT * FROM t1; @@ -2299,9 +2304,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT LEFT(a,1), - `c` varchar(10) DEFAULT RIGHT(a,1), - `d` varchar(10) DEFAULT SUBSTR(a,2,2) + `b` varchar(10) DEFAULT left(`a`,1), + `c` varchar(10) DEFAULT right(`a`,1), + `d` varchar(10) DEFAULT substr(`a`,2,2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abcd'); SELECT * FROM t1; @@ -2313,7 +2318,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, - `b` varchar(20) DEFAULT SUBSTRING_INDEX(a,'.',2) + `b` varchar(20) DEFAULT substring_index(`a`,'.',2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('www.mariadb.org'); SELECT * FROM t1; @@ -2326,7 +2331,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) DEFAULT CONCAT(a,b) + `c` varchar(20) DEFAULT concat(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('a','b'); SELECT * FROM t1; @@ -2339,7 +2344,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) DEFAULT CONCAT_WS(',',a,b) + `c` varchar(20) DEFAULT concat_ws(',',`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES ('a','b'); SELECT * FROM t1; @@ -2351,7 +2356,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT REPLACE(a,'a','A') + `b` varchar(10) DEFAULT replace(`a`,'a','A') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abc'); SELECT * FROM t1; @@ -2363,7 +2368,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT REGEXP_REPLACE(a,'[0-9]','.') + `b` varchar(10) DEFAULT regexp_replace(`a`,'[0-9]','.') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a1b2c'); SELECT * FROM t1; @@ -2375,7 +2380,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT REGEXP_SUBSTR(a,'[0-9]+') + `b` varchar(10) DEFAULT regexp_substr(`a`,'[0-9]+') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ab12cd'); SELECT * FROM t1; @@ -2387,7 +2392,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, - `b` varchar(20) DEFAULT SOUNDEX(a) + `b` varchar(20) DEFAULT soundex(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('tester'); SELECT * FROM t1; @@ -2399,7 +2404,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(20) DEFAULT NULL, - `b` varchar(20) DEFAULT QUOTE(a) + `b` varchar(20) DEFAULT quote(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a\'b'); SELECT * FROM t1; @@ -2411,8 +2416,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT LPAD(a,10,'.'), - `c` varchar(10) DEFAULT RPAD(a,10,'.') + `b` varchar(10) DEFAULT lpad(`a`,10,'.'), + `c` varchar(10) DEFAULT rpad(`a`,10,'.') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('ab'); SELECT * FROM t1; @@ -2424,8 +2429,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT LTRIM(a), - `c` varchar(10) DEFAULT RTRIM(a) + `b` varchar(10) DEFAULT ltrim(`a`), + `c` varchar(10) DEFAULT rtrim(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (' ab '); SELECT a, HEX(b), HEX(c) FROM t1; @@ -2437,7 +2442,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT TRIM(BOTH 'a' FROM a) + `b` varchar(10) DEFAULT trim(both 'a' from `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abba'); SELECT a, b FROM t1; @@ -2449,7 +2454,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) DEFAULT SPACE(a) + `b` varchar(10) DEFAULT space(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (3); SELECT a, HEX(b) FROM t1; @@ -2462,7 +2467,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(10) DEFAULT REPEAT(b,a) + `c` varchar(10) DEFAULT repeat(`b`,`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (3,'x'); SELECT a, b, c FROM t1; @@ -2477,7 +2482,7 @@ t1 CREATE TABLE `t1` ( `pos` int(11) DEFAULT NULL, `len` int(11) DEFAULT NULL, `newstr` varchar(10) DEFAULT NULL, - `result` varchar(10) DEFAULT INSERT(str,pos,len,newstr) + `result` varchar(10) DEFAULT insert(`str`,`pos`,`len`,`newstr`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (str,pos,len,newstr) VALUES ('Quadratic', 3, 4, 'What'); SELECT * FROM t1; @@ -2489,7 +2494,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `n` int(11) DEFAULT NULL, - `res` varchar(10) DEFAULT ELT(n,'ej', 'Heja', 'hej', 'foo') + `res` varchar(10) DEFAULT elt(`n`,'ej','Heja','hej','foo') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (n) VALUES (1); SELECT * FROM t1; @@ -2501,7 +2506,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `bits` int(11) DEFAULT NULL, - `res` varchar(10) DEFAULT MAKE_SET(bits,'a','b','c','d') + `res` varchar(10) DEFAULT make_set(`bits`,'a','b','c','d') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (bits) VALUES (1|4); SELECT * FROM t1; @@ -2513,7 +2518,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) DEFAULT CHAR(a) + `b` varchar(10) DEFAULT char(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (77); SELECT * FROM t1; @@ -2525,7 +2530,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) DEFAULT CONV(a,10,16) + `b` varchar(10) DEFAULT conv(`a`,10,16) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (64); SELECT * FROM t1; @@ -2538,7 +2543,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` varchar(30) DEFAULT FORMAT(a,b) + `c` varchar(30) DEFAULT format(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (10000,3); SELECT * FROM t1; @@ -2552,7 +2557,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, `l` varchar(10) DEFAULT NULL, - `c` varchar(30) DEFAULT FORMAT(a,b,l) + `c` varchar(30) DEFAULT format(`a`,`b`,`l`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b,l) VALUES (10000,2,'no_NO'),(10000,2,'ru_RU'),(10000,2,'ar_BH'); SELECT * FROM t1; @@ -2566,7 +2571,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) DEFAULT GET_FORMAT(DATE,a) + `b` varchar(20) DEFAULT get_format(DATE, `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('EUR'),('USA'),('JIS'),('ISO'),('INTERNAL'); SELECT * FROM t1; @@ -2593,7 +2598,7 @@ t1 CREATE TABLE `t1` ( `v_off` varchar(10) DEFAULT NULL, `v_separator` varchar(10) DEFAULT NULL, `number_of_bits` int(11) DEFAULT NULL, - `x` varchar(30) DEFAULT EXPORT_SET(bits, v_on, v_off, v_separator, number_of_bits) + `x` varchar(30) DEFAULT export_set(`bits`,`v_on`,`v_off`,`v_separator`,`number_of_bits`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (0x50006,'Y','N','',64,DEFAULT); Warnings: @@ -2612,7 +2617,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (NOT a) + `b` int(11) DEFAULT ((`a` = 0)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2627,7 +2632,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `x` int(11) DEFAULT (a XOR b) + `x` int(11) DEFAULT ((`a` xor `b`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (0,0),(0,1),(1,0),(1,1); SELECT * FROM t1; @@ -2642,8 +2647,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS TRUE), - `c` int(11) DEFAULT (a IS NOT TRUE) + `b` int(11) DEFAULT ((`a` is true)), + `c` int(11) DEFAULT ((`a` is not true)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2657,8 +2662,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS FALSE), - `c` int(11) DEFAULT (a IS NOT FALSE) + `b` int(11) DEFAULT ((`a` is false)), + `c` int(11) DEFAULT ((`a` is not false)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2672,8 +2677,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS NULL), - `c` int(11) DEFAULT (a IS NOT NULL) + `b` int(11) DEFAULT (isnull(`a`)), + `c` int(11) DEFAULT ((`a` is not null)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2687,8 +2692,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT (a IS UNKNOWN), - `c` int(11) DEFAULT (a IS NOT UNKNOWN) + `b` int(11) DEFAULT (isnull(`a`)), + `c` int(11) DEFAULT ((`a` is not null)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(0),(1); SELECT * FROM t1; @@ -2706,13 +2711,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `eq` int(11) DEFAULT (a=0), - `equal` int(11) DEFAULT (a<=>0), - `ne` int(11) DEFAULT (a<>0), - `lt` int(11) DEFAULT (a<0), - `le` int(11) DEFAULT (a<=0), - `gt` int(11) DEFAULT (a>0), - `ge` int(11) DEFAULT (a>=0) + `eq` int(11) DEFAULT ((`a` = 0)), + `equal` int(11) DEFAULT ((`a` <=> 0)), + `ne` int(11) DEFAULT ((`a` <> 0)), + `lt` int(11) DEFAULT ((`a` < 0)), + `le` int(11) DEFAULT ((`a` <= 0)), + `gt` int(11) DEFAULT ((`a` > 0)), + `ge` int(11) DEFAULT ((`a` >= 0)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (NULL),(-1),(0),(1); SELECT * FROM t1; @@ -2727,7 +2732,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a LIKE 'a%') + `b` int(11) DEFAULT ((`a` like 'a%')) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'); SELECT * FROM t1; @@ -2741,7 +2746,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a RLIKE 'a$') + `b` int(11) DEFAULT ((`a` regexp 'a$')) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'); SELECT * FROM t1; @@ -2755,7 +2760,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a IN ('aaa','bbb')) + `b` int(11) DEFAULT ((`a` in ('aaa','bbb'))) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2770,7 +2775,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a NOT IN ('aaa','bbb')) + `b` int(11) DEFAULT ((`a` not in ('aaa','bbb'))) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2785,7 +2790,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a BETWEEN 'aaa' AND 'bbb') + `b` int(11) DEFAULT ((`a` between 'aaa' and 'bbb')) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2800,7 +2805,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT (a NOT BETWEEN 'aaa' AND 'bbb') + `b` int(11) DEFAULT ((`a` not between 'aaa' and 'bbb')) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc'); SELECT * FROM t1; @@ -2814,7 +2819,7 @@ CREATE TABLE t1 (a TEXT DEFAULT UUID()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` text DEFAULT UUID() + `a` text DEFAULT uuid() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); SELECT LENGTH(a)>0 FROM t1; @@ -2829,7 +2834,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT STRCMP(a,'b') + `b` int(11) DEFAULT strcmp(`a`,'b') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c'); SELECT * FROM t1; @@ -2846,9 +2851,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT LENGTH(a), - `c` int(11) DEFAULT CHAR_LENGTH(a), - `d` int(11) DEFAULT BIT_LENGTH(a) + `b` int(11) DEFAULT length(`a`), + `c` int(11) DEFAULT char_length(`a`), + `d` int(11) DEFAULT bit_length(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa'); SELECT * FROM t1; @@ -2862,7 +2867,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT LOCATE('a',a) + `b` int(11) DEFAULT locate('a',`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa'); SELECT * FROM t1; @@ -2876,7 +2881,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT REGEXP_INSTR(a, 'a') + `b` int(11) DEFAULT regexp_instr(`a`,'a') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa'); SELECT * FROM t1; @@ -2898,7 +2903,7 @@ CREATE TABLE t1 (a INT DEFAULT CONNECTION_ID()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT CONNECTION_ID() + `a` int(11) DEFAULT connection_id() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(); SELECT a>0 FROM t1; @@ -2910,8 +2915,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) DEFAULT COERCIBILITY(a), - `c` int(11) DEFAULT COERCIBILITY(b) + `b` int(11) DEFAULT coercibility(`a`), + `c` int(11) DEFAULT coercibility(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; @@ -2930,8 +2935,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) DEFAULT CHARSET(a), - `c` varchar(20) DEFAULT COLLATION(a) + `b` varchar(20) DEFAULT charset(`a`), + `c` varchar(20) DEFAULT collation(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT * FROM t1; @@ -2946,8 +2951,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) DEFAULT CRC32(a), - `c` text DEFAULT MD5(a) + `b` bigint(20) DEFAULT crc32(`a`), + `c` text DEFAULT md5(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('a'); SELECT * FROM t1; @@ -2959,8 +2964,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` text DEFAULT TO_BASE64(a), - `c` text DEFAULT FROM_BASE64(b) + `b` text DEFAULT to_base64(`a`), + `c` text DEFAULT from_base64(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT * FROM t1; @@ -2972,8 +2977,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` text DEFAULT HEX(a), - `c` text DEFAULT UNHEX(b) + `b` text DEFAULT hex(`a`), + `c` text DEFAULT unhex(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT * FROM t1; @@ -2985,8 +2990,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` text DEFAULT ENCODE(a,'test'), - `c` text DEFAULT DECODE(b,'test') + `b` text DEFAULT encode(`a`,'test'), + `c` text DEFAULT decode(`b`,'test') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('aaaabbbb'); SELECT a, HEX(b), c FROM t1; @@ -2998,7 +3003,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` text DEFAULT PASSWORD(a) + `b` text DEFAULT password(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('notagoodpwd'); SELECT * FROM t1; @@ -3014,8 +3019,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` blob DEFAULT AES_ENCRYPT(a, 'passwd'), - `c` text DEFAULT AES_DECRYPT(b, 'passwd') + `b` blob DEFAULT aes_encrypt(`a`,'passwd'), + `c` text DEFAULT aes_decrypt(`b`,'passwd') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT c FROM t1; @@ -3047,7 +3052,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT 1, - `b` int(11) DEFAULT (1+1), + `b` int(11) DEFAULT ((1 + 1)), `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 alter a set default (2+3), alter b set default 4, @@ -3057,9 +3062,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (2+3), + `a` int(11) DEFAULT ((2 + 3)), `b` int(11) DEFAULT 4, - `c` int(11) DEFAULT (-a) + `c` int(11) DEFAULT (-(`a`)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int default 5 check (a>10), b int default (5+5), c int as (a+b)); @@ -3068,8 +3073,8 @@ create table t3 as select max(a), max(b), max(c) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT 5 CHECK (a>10), - `b` int(11) DEFAULT (5+5), + `a` int(11) DEFAULT 5 CHECK ((`a` > 10)), + `b` int(11) DEFAULT ((5 + 5)), `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create table t3; @@ -3230,3 +3235,35 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFA ERROR HY000: Default/ignore value is not supported for such parameter usage DROP TABLE t1; # end of 10.2 test +set sql_mode=ansi_quotes; +create table t1 (a int, b int default (a+1)); +show create table t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" int(11) DEFAULT NULL, + "b" int(11) DEFAULT (("a" + 1)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values (10); +set sql_mode=''; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT ((`a` + 1)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values (20); +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT ((`a` + 1)) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +insert t1 (a) values (30); +select * from t1; +a b +10 11 +20 21 +30 31 +drop table t1; +set sql_mode=default; diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result index 27547ef9a72..2841f27d45d 100644 --- a/mysql-test/r/dyncol.result +++ b/mysql-test/r/dyncol.result @@ -1908,16 +1908,16 @@ Table Create Table t1 CREATE TABLE `t1` ( `name` varchar(10) DEFAULT NULL, `value` varchar(10) DEFAULT NULL, - `dyncol0` blob DEFAULT COLUMN_CREATE(name, value), - `value_dyncol0_name0` varchar(10) DEFAULT (COLUMN_GET(dyncol0, 'name0' AS CHAR)), - `dyncol1` blob DEFAULT COLUMN_ADD(dyncol0, 'name1', 'value1'), - `value_dyncol1_name1` varchar(10) DEFAULT (COLUMN_GET(dyncol1, 'name1' AS CHAR)), - `dyncol2` blob DEFAULT COLUMN_DELETE(dyncol1, 'name1'), - `dyncol2_exists_name0` int(11) DEFAULT COLUMN_EXISTS(dyncol2, 'name0'), - `dyncol2_exists_name1` int(11) DEFAULT COLUMN_EXISTS(dyncol2, 'name1'), - `dyncol2_check` int(11) DEFAULT COLUMN_CHECK(dyncol2), - `dyncol1_list` text DEFAULT COLUMN_LIST(dyncol1), - `dyncol1_json` text DEFAULT COLUMN_JSON(dyncol1) + `dyncol0` blob DEFAULT column_create(`name`,`value`), + `value_dyncol0_name0` varchar(10) DEFAULT (column_get(`dyncol0`,'name0' as char charset utf8)), + `dyncol1` blob DEFAULT column_add(`dyncol0`,'name1','value1'), + `value_dyncol1_name1` varchar(10) DEFAULT (column_get(`dyncol1`,'name1' as char charset utf8)), + `dyncol2` blob DEFAULT column_add(`dyncol1`,'name1',NULL AS int), + `dyncol2_exists_name0` int(11) DEFAULT column_exists(`dyncol2`,'name0'), + `dyncol2_exists_name1` int(11) DEFAULT column_exists(`dyncol2`,'name1'), + `dyncol2_check` int(11) DEFAULT column_check(`dyncol2`), + `dyncol1_list` text DEFAULT column_list(`dyncol1`), + `dyncol1_json` text DEFAULT column_json(`dyncol1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (name,value) VALUES ('name0', 'value0'); SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1; diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index 9ef7f13487f..b436a3c72b1 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -178,9 +178,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, - `b` blob DEFAULT COMPRESS(a), - `bl` int(11) DEFAULT UNCOMPRESSED_LENGTH(b), - `a1` text DEFAULT UNCOMPRESS(b) + `b` blob DEFAULT compress(`a`), + `bl` int(11) DEFAULT uncompressed_length(`b`), + `a1` text DEFAULT uncompress(`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (REPEAT('a',100)); SELECT bl, a1 FROM t1; diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index 85c1cb2ce94..389e92641b3 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -112,7 +112,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) DEFAULT ENCRYPT(a,123) + `b` varchar(30) DEFAULT encrypt(`a`,123) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('hello'); SELECT * FROM t1; diff --git a/mysql-test/r/func_digest.result b/mysql-test/r/func_digest.result index 31a32da72ed..43ddcb2ee77 100644 --- a/mysql-test/r/func_digest.result +++ b/mysql-test/r/func_digest.result @@ -1441,8 +1441,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` text DEFAULT SHA(a), - `c` text DEFAULT SHA2(a,224) + `b` text DEFAULT sha(`a`), + `c` text DEFAULT sha2(`a`,224) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('abc'); SELECT * FROM t1; diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result index 34dff598452..e72e1ff05bb 100644 --- a/mysql-test/r/func_encrypt.result +++ b/mysql-test/r/func_encrypt.result @@ -223,8 +223,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` blob DEFAULT DES_ENCRYPT(a, 'passwd'), - `c` text DEFAULT DES_DECRYPT(b, 'passwd') + `b` blob DEFAULT des_encrypt(`a`,'passwd'), + `c` text DEFAULT des_decrypt(`b`,'passwd') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('test'); SELECT c FROM t1; diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result index ea9c203e3f6..746bc55ef85 100644 --- a/mysql-test/r/func_hybrid_type.result +++ b/mysql-test/r/func_hybrid_type.result @@ -2397,7 +2397,7 @@ FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `___________a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `___________a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `case_______a` timestamp NULL DEFAULT NULL, `case_____a_a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `coalesce___a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index f6a04c6fb79..663fc2583e7 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -1457,10 +1457,10 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(30) DEFAULT NULL, - `b` bigint(20) DEFAULT INET_ATON(a), - `a1` varchar(30) DEFAULT INET_NTOA(b), - `c` int(11) DEFAULT IS_IPV4(a), - `d` int(11) DEFAULT IS_IPV6(a) + `b` bigint(20) DEFAULT inet_aton(`a`), + `a1` varchar(30) DEFAULT inet_ntoa(`b`), + `c` int(11) DEFAULT is_ipv4(`a`), + `d` int(11) DEFAULT is_ipv6(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('192.168.001.001'),('::1'),('xxx'); SELECT * FROM t1; @@ -1480,10 +1480,10 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `str` varchar(128) DEFAULT NULL, - `addr` varbinary(16) DEFAULT INET6_ATON(str), - `str1` varchar(128) DEFAULT INET6_NTOA(addr), - `b` int(11) DEFAULT IS_IPV4_COMPAT(addr), - `c` int(11) DEFAULT IS_IPV4_MAPPED(addr) + `addr` varbinary(16) DEFAULT inet6_aton(`str`), + `str1` varchar(128) DEFAULT inet6_ntoa(`addr`), + `b` int(11) DEFAULT is_ipv4_compat(`addr`), + `c` int(11) DEFAULT is_ipv4_mapped(`addr`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9'); SELECT str, str1, b,c FROM t1; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index f75ec17c702..6ca89082a45 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -874,7 +874,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select period_add('9602',-12) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03') AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` +Note 1003 select period_add('9602',-12) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03') AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(current_timestamp())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` SET @TMP='2007-08-01 12:22:49'; CREATE TABLE t1 (d DATETIME); INSERT INTO t1 VALUES ('2007-08-01 12:22:59'); @@ -1976,7 +1976,7 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010') microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010') 123456 10 select now(258); -ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6 +ERROR 42000: Too big precision 258 specified for 'current_timestamp'. Maximum is 6 SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12')); 1 SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12')); diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result index 7101dc8f121..93119dcb309 100644 --- a/mysql-test/r/func_time_hires.result +++ b/mysql-test/r/func_time_hires.result @@ -24,7 +24,7 @@ select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222)); time_to_sec(sec_to_time(11111)) 11111 time_to_sec(sec_to_time(11111.22222)) 11111.22222 select current_timestamp(7); -ERROR 42000: Too big precision 7 specified for 'now'. Maximum is 6 +ERROR 42000: Too big precision 7 specified for 'current_timestamp'. Maximum is 6 select curtime(7); ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6 drop table if exists t1; diff --git a/mysql-test/r/function_defaults.result b/mysql-test/r/function_defaults.result index 987c505f1fb..4b8694ec838 100644 --- a/mysql-test/r/function_defaults.result +++ b/mysql-test/r/function_defaults.result @@ -483,7 +483,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); @@ -491,7 +491,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -501,7 +501,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -527,7 +527,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE N SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -536,7 +536,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -546,7 +546,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -554,7 +554,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -563,7 +563,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -573,7 +573,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -586,7 +586,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -650,7 +650,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -659,7 +659,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -668,7 +668,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -695,7 +695,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -704,7 +704,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime DEFAULT CURRENT_TIMESTAMP + `g` datetime DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -713,7 +713,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `h` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -753,25 +753,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `k` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `l` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `m` timestamp NOT NULL DEFAULT current_timestamp(), + `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `p` timestamp NULL DEFAULT NULL, - `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `r` datetime DEFAULT CURRENT_TIMESTAMP, - `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `q` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `r` datetime DEFAULT current_timestamp(), + `s` datetime DEFAULT NULL ON UPDATE current_timestamp(), `t` datetime DEFAULT NULL, `u` datetime DEFAULT '1986-09-27 03:00:00', - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp(), + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `e` timestamp NULL DEFAULT NULL, - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `g` datetime DEFAULT CURRENT_TIMESTAMP, - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `g` datetime DEFAULT current_timestamp(), + `h` datetime DEFAULT NULL ON UPDATE current_timestamp(), `i` datetime DEFAULT NULL, `j` datetime DEFAULT '1986-09-27 03:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -792,7 +792,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -801,7 +801,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime DEFAULT CURRENT_TIMESTAMP + `b` datetime DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -810,7 +810,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `c` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -847,7 +847,7 @@ CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -1224,12 +1224,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1276,12 +1276,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1343,12 +1343,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1381,12 +1381,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1429,7 +1429,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; @@ -2029,7 +2029,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); @@ -2037,7 +2037,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2047,7 +2047,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2073,7 +2073,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDAT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2082,7 +2082,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2092,7 +2092,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2100,7 +2100,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMES SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2109,7 +2109,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2119,7 +2119,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2132,7 +2132,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -2196,7 +2196,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2205,7 +2205,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2214,7 +2214,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6) + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2241,7 +2241,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -2250,7 +2250,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `g` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -2259,7 +2259,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -2299,25 +2299,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `k` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `l` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `m` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `p` timestamp(6) NULL DEFAULT NULL, - `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `q` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `r` datetime(6) DEFAULT current_timestamp(6), + `s` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `t` datetime(6) DEFAULT NULL, `u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765', - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `e` timestamp(6) NULL DEFAULT NULL, - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `g` datetime(6) DEFAULT current_timestamp(6), + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `i` datetime(6) DEFAULT NULL, `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2338,7 +2338,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2347,7 +2347,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `b` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2356,7 +2356,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2393,7 +2393,7 @@ CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -2770,12 +2770,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2822,12 +2822,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2889,12 +2889,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2927,12 +2927,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2975,7 +2975,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; diff --git a/mysql-test/r/function_defaults_innodb.result b/mysql-test/r/function_defaults_innodb.result index b539f70a3cb..fe97870ab88 100644 --- a/mysql-test/r/function_defaults_innodb.result +++ b/mysql-test/r/function_defaults_innodb.result @@ -484,7 +484,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c TIMESTAMP NULL ); @@ -492,7 +492,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -502,7 +502,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE C SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -528,7 +528,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE N SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -537,7 +537,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -547,7 +547,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -555,7 +555,7 @@ CREATE TABLE t1 ( a TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL, `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -564,7 +564,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `c` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -574,7 +574,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp NULL DEFAULT NULL, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -587,7 +587,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -651,7 +651,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -660,7 +660,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -669,7 +669,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -696,7 +696,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -705,7 +705,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime DEFAULT CURRENT_TIMESTAMP + `g` datetime DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -714,7 +714,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `h` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -754,25 +754,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `l` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `m` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `k` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `l` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `m` timestamp NOT NULL DEFAULT current_timestamp(), + `n` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `o` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `p` timestamp NULL DEFAULT NULL, - `q` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `r` datetime DEFAULT CURRENT_TIMESTAMP, - `s` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `q` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `r` datetime DEFAULT current_timestamp(), + `s` datetime DEFAULT NULL ON UPDATE current_timestamp(), `t` datetime DEFAULT NULL, `u` datetime DEFAULT '1986-09-27 03:00:00', - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp(), + `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(), `d` timestamp NOT NULL DEFAULT '1986-09-27 03:00:00', `e` timestamp NULL DEFAULT NULL, - `f` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `g` datetime DEFAULT CURRENT_TIMESTAMP, - `h` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `f` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `g` datetime DEFAULT current_timestamp(), + `h` datetime DEFAULT NULL ON UPDATE current_timestamp(), `i` datetime DEFAULT NULL, `j` datetime DEFAULT '1986-09-27 03:00:00' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -793,7 +793,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -802,7 +802,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime DEFAULT CURRENT_TIMESTAMP + `b` datetime DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -811,7 +811,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `c` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -848,7 +848,7 @@ CREATE TABLE t2 ( b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -1225,12 +1225,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1277,12 +1277,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1344,12 +1344,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NOT NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1382,12 +1382,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime DEFAULT NULL, `b` datetime DEFAULT '2011-11-18 00:00:00', - `like_b` datetime DEFAULT CURRENT_TIMESTAMP, + `like_b` datetime DEFAULT current_timestamp(), `c` datetime NOT NULL DEFAULT '2011-11-18 00:00:00', - `like_c` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `like_c` datetime NOT NULL DEFAULT current_timestamp(), + `d` timestamp NULL DEFAULT '2011-05-03 00:00:00' ON UPDATE current_timestamp(), `e` timestamp NOT NULL DEFAULT '2011-05-03 00:00:00', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -1430,7 +1430,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; @@ -2030,7 +2030,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), c TIMESTAMP(6) NULL ); @@ -2038,7 +2038,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2048,7 +2048,7 @@ ALTER TABLE t1 MODIFY b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UP SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2074,7 +2074,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDAT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2083,7 +2083,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2093,7 +2093,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2101,7 +2101,7 @@ CREATE TABLE t1 ( a TIMESTAMP(6) NOT NULL DEFAULT NOW(6) ON UPDATE CURRENT_TIMES SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL, `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2110,7 +2110,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `b` int(11) DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `c` timestamp(6) NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2120,7 +2120,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `c` timestamp(6) NULL DEFAULT NULL, - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `b` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -2133,7 +2133,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; # @@ -2197,7 +2197,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2206,7 +2206,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2215,7 +2215,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6) + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2242,7 +2242,7 @@ CREATE TABLE t7 SELECT f FROM t1; SHOW CREATE TABLE t7; Table Create Table t7 CREATE TABLE `t7` ( - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t7; f @@ -2251,7 +2251,7 @@ CREATE TABLE t8 SELECT g FROM t1; SHOW CREATE TABLE t8; Table Create Table t8 CREATE TABLE `t8` ( - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `g` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t8; g @@ -2260,7 +2260,7 @@ CREATE TABLE t9 SELECT h FROM t1; SHOW CREATE TABLE t9; Table Create Table t9 CREATE TABLE `t9` ( - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t9; h @@ -2300,25 +2300,25 @@ SELECT * FROM t1; SHOW CREATE TABLE t12; Table Create Table t12 CREATE TABLE `t12` ( - `k` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `l` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `m` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `k` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `l` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `m` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `n` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `o` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `p` timestamp(6) NULL DEFAULT NULL, - `q` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `r` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `s` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `q` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `r` datetime(6) DEFAULT current_timestamp(6), + `s` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `t` datetime(6) DEFAULT NULL, `u` datetime(6) DEFAULT '1986-09-27 03:00:00.098765', - `a` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `a` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6), + `c` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000' ON UPDATE current_timestamp(6), `d` timestamp(6) NOT NULL DEFAULT '1986-09-27 03:00:00.098765', `e` timestamp(6) NULL DEFAULT NULL, - `f` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), - `g` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), - `h` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6), + `f` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), + `g` datetime(6) DEFAULT current_timestamp(6), + `h` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6), `i` datetime(6) DEFAULT NULL, `j` datetime(6) DEFAULT '1986-09-27 03:00:00.098765' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -2339,7 +2339,7 @@ CREATE TABLE t2 SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `a` datetime(6) DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t2; a @@ -2348,7 +2348,7 @@ CREATE TABLE t3 SELECT b FROM t1; SHOW CREATE TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6) + `b` datetime(6) DEFAULT current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t3; b @@ -2357,7 +2357,7 @@ CREATE TABLE t4 SELECT c FROM t1; SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( - `c` datetime(6) DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(6) + `c` datetime(6) DEFAULT NULL ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t4; c @@ -2394,7 +2394,7 @@ CREATE TABLE t2 ( b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SET TIMESTAMP = 2000.876543; @@ -2771,12 +2771,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2823,12 +2823,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2890,12 +2890,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), + `f` timestamp(6) NOT NULL DEFAULT current_timestamp(6), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2928,12 +2928,12 @@ t1 CREATE TABLE `t1` ( `dummy` int(11) DEFAULT NULL, `a` datetime(6) DEFAULT NULL, `b` datetime(6) DEFAULT '2011-11-18 00:00:00.000000', - `like_b` datetime(6) DEFAULT CURRENT_TIMESTAMP(6), + `like_b` datetime(6) DEFAULT current_timestamp(6), `c` datetime(6) NOT NULL DEFAULT '2011-11-18 00:00:00.000000', - `like_c` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), - `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE CURRENT_TIMESTAMP(6), + `like_c` datetime(6) NOT NULL DEFAULT current_timestamp(6), + `d` timestamp(6) NULL DEFAULT '2011-05-03 00:00:00.000000' ON UPDATE current_timestamp(6), `e` timestamp(6) NOT NULL DEFAULT '2011-05-03 00:00:00.000000', - `f` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f` timestamp NULL DEFAULT current_timestamp(), `g` timestamp(6) NULL DEFAULT NULL, `h` int(11) DEFAULT NULL, `i` int(11) NOT NULL DEFAULT 42 @@ -2976,7 +2976,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) + `b` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 INSERT INTO t1 ( a ) VALUES ( 1 ); SELECT * FROM t1; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 04d169c84b6..ed0d8f540a0 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1848,8 +1848,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` point DEFAULT NULL, - `x` double DEFAULT x(a), - `y` double DEFAULT y(a) + `x` double DEFAULT st_x(`a`), + `y` double DEFAULT st_y(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(1,2)); SELECT x,y FROM t1; @@ -1861,7 +1861,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL, - `area` double DEFAULT ST_AREA(g) + `area` double DEFAULT st_area(`g`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))')); SELECT area FROM t1; @@ -1873,7 +1873,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` geometry DEFAULT NULL, - `length` double DEFAULT ST_LENGTH(g) + `length` double DEFAULT st_length(`g`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)')); SELECT length FROM t1; @@ -1885,7 +1885,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `g` point DEFAULT NULL, - `distance` double DEFAULT ST_DISTANCE(g, POINT(0,0)) + `distance` double DEFAULT st_distance(`g`,point(0,0)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (g) VALUES (Point(1,0)); SELECT distance FROM t1; @@ -1897,7 +1897,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` text DEFAULT NULL, - `g` geometry DEFAULT GeomFromText(a) + `g` geometry DEFAULT st_geometryfromtext(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('point(1 1)'); SELECT AsText(g) FROM t1; @@ -1910,7 +1910,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL, `y` int(11) DEFAULT NULL, - `g` geometry DEFAULT POINT(x,y) + `g` geometry DEFAULT point(`x`,`y`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (x,y) VALUES (10,20); SELECT AsText(g) FROM t1; @@ -1922,7 +1922,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT PointN(a,2) + `b` geometry DEFAULT st_pointn(`a`,2) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); SELECT AsText(b) FROM t1; @@ -1934,7 +1934,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT StartPoint(a) + `b` geometry DEFAULT st_startpoint(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)')); SELECT AsText(b) FROM t1; @@ -1947,7 +1947,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` geometry DEFAULT GeometryCollection(a,b) + `c` geometry DEFAULT geometrycollection(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2)); SELECT AsText(c) FROM t1; @@ -1959,7 +1959,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT GeomFromWKB(AsBinary(a),20) + `b` geometry DEFAULT st_geometryfromwkb(st_aswkb(`a`),20) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10)); SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1; @@ -1971,7 +1971,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT BOUNDARY(a) + `b` geometry DEFAULT st_boundary(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT AsText(b) FROM t1; @@ -1983,7 +1983,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT BUFFER(a,10) + `b` geometry DEFAULT st_buffer(`a`,10) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT GeometryType(b) FROM t1; @@ -1995,7 +1995,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT CENTROID(a) + `b` geometry DEFAULT st_centroid(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT AsText(b) FROM t1; @@ -2007,7 +2007,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT ENVELOPE(a) + `b` geometry DEFAULT st_envelope(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)')); SELECT AsText(b) FROM t1; @@ -2019,7 +2019,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT PointOnSurface(a) + `b` geometry DEFAULT st_pointonsurface(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))')); SELECT GeometryType(b) FROM t1; @@ -2031,8 +2031,8 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` geometry DEFAULT Point(1,1), - `c` geometry DEFAULT ST_UNION(a,b) + `b` geometry DEFAULT point(1,1), + `c` geometry DEFAULT st_union(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0,0)); SELECT AsText(c) FROM t1; @@ -2044,7 +2044,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` varchar(20) DEFAULT GeometryType(a) + `b` varchar(20) DEFAULT st_geometrytype(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; @@ -2056,7 +2056,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsSimple(a) + `b` int(11) DEFAULT st_issimple(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; @@ -2068,7 +2068,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsEmpty(a) + `b` int(11) DEFAULT st_isempty(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Point(0, 0)); SELECT b FROM t1; @@ -2080,7 +2080,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsRing(a) + `b` int(11) DEFAULT st_isring(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); SELECT b FROM t1; @@ -2092,7 +2092,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT IsClosed(a) + `b` int(11) DEFAULT st_isclosed(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)')); SELECT b FROM t1; @@ -2104,7 +2104,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT Dimension(a) + `b` int(11) DEFAULT st_dimension(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1)); SELECT b FROM t1; @@ -2116,7 +2116,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT NumGeometries(a) + `b` int(11) DEFAULT st_numgeometries(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0))); SELECT b FROM t1; @@ -2128,7 +2128,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT NumInteriorRings(a) + `b` int(11) DEFAULT st_numinteriorrings(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')); SELECT b FROM t1; @@ -2140,7 +2140,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT NumPoints(a) + `b` int(11) DEFAULT st_numpoints(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0))); SELECT b FROM t1; @@ -2152,7 +2152,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, - `b` int(11) DEFAULT SRID(a) + `b` int(11) DEFAULT srid(`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100)); SELECT b FROM t1; @@ -2165,7 +2165,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` int(11) DEFAULT MBRDisjoint(a,b) + `c` int(11) DEFAULT mbrdisjoint(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; @@ -2178,7 +2178,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` int(11) DEFAULT ST_Disjoint(a,b) + `c` int(11) DEFAULT st_disjoint(`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; @@ -2191,7 +2191,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` geometry DEFAULT NULL, `b` geometry DEFAULT NULL, - `c` int(11) DEFAULT ST_Relate(a,b,'T*F**FFF*') + `c` int(11) DEFAULT st_relate(`a`,`b`,'T*F**FFF*') ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 8442f7fc401..8d2ab0d8a55 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -685,7 +685,7 @@ Db char(64) NO PRI User char(80) NO PRI Table_name char(64) NO PRI Grantor char(141) NO MUL -Timestamp timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +Timestamp timestamp NO current_timestamp() on update current_timestamp() Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') NO Column_priv set('Select','Insert','Update','References') NO use test; @@ -2675,7 +2675,7 @@ CREATE TABLE t1 (a VARCHAR(30) DEFAULT USER()); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` varchar(30) DEFAULT USER() + `a` varchar(30) DEFAULT user() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES (); GRANT ALL PRIVILEGES ON test.* TO dummy@localhost IDENTIFIED BY 'pwd'; diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index cda028536cf..29bdb144551 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -435,7 +435,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` char(12) NOT NULL, `c3` varchar(123) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`c2`,`c3`), UNIQUE KEY `i4` (`c4`), KEY `c1` (`c1`), @@ -474,7 +474,7 @@ t1 CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` char(12) NOT NULL, `c3` varchar(123) NOT NULL, - `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `c4` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), KEY `i1` (`c1`), KEY `i5` (`c1`,`c2`,`c3`,`c4`), KEY `c1` (`c1`), diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index 6a3f48506e3..383ad10ba66 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -46,7 +46,7 @@ select @@log_slow_verbosity; innodb show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP +start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) user_host mediumtext NO NULL query_time time(6) NO NULL lock_time time(6) NO NULL diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index db2727c8234..2ec12bfe1c4 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -54,7 +54,7 @@ ERROR HY000: You can't use locks with log tables show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -63,7 +63,7 @@ general_log CREATE TABLE `general_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log' show fields from mysql.general_log; Field Type Null Key Default Extra -event_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP +event_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) user_host mediumtext NO NULL thread_id bigint(21) unsigned NO NULL server_id int(10) unsigned NO NULL @@ -72,7 +72,7 @@ argument mediumtext NO NULL show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, @@ -88,7 +88,7 @@ slow_log CREATE TABLE `slow_log` ( ) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log' show fields from mysql.slow_log; Field Type Null Key Default Extra -start_time timestamp(6) NO CURRENT_TIMESTAMP(6) on update CURRENT_TIMESTAMP +start_time timestamp(6) NO current_timestamp(6) on update current_timestamp(6) user_host mediumtext NO NULL query_time time(6) NO NULL lock_time time(6) NO NULL @@ -169,7 +169,7 @@ set global slow_query_log='OFF'; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -179,7 +179,7 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, @@ -198,7 +198,7 @@ alter table mysql.slow_log engine=myisam; show create table mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -208,7 +208,7 @@ general_log CREATE TABLE `general_log` ( show create table mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/mysql5613mysql.result b/mysql-test/r/mysql5613mysql.result index 1d2c3b97baf..183af7211d3 100644 --- a/mysql-test/r/mysql5613mysql.result +++ b/mysql-test/r/mysql5613mysql.result @@ -10,7 +10,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -58,7 +58,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -115,7 +115,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL DEFAULT '', `body` longblob NOT NULL, `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -138,7 +138,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -154,7 +154,7 @@ proxies_priv CREATE TABLE `proxies_priv` ( `Proxied_user` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `With_grant` tinyint(1) NOT NULL DEFAULT 0, `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges' @@ -186,7 +186,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), diff --git a/mysql-test/r/mysql57_virtual.result b/mysql-test/r/mysql57_virtual.result index ace8fe38d36..6f337c8e7d7 100644 --- a/mysql-test/r/mysql57_virtual.result +++ b/mysql-test/r/mysql57_virtual.result @@ -32,7 +32,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) PERSISTENT, - `c` int(11) AS (a+2) VIRTUAL + `b` int(11) AS ((`a` + 1)) PERSISTENT, + `c` int(11) AS ((`a` + 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 04612e02b7f..fcfab3e068a 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2923,7 +2923,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `d` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -2960,7 +2960,7 @@ DROP TABLE IF EXISTS `t1`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), UNIQUE KEY `d` (`d`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; @@ -5260,7 +5260,7 @@ Error 1146 Table 'mysql.event' doesn't exist SHOW CREATE TABLE mysql.general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -5270,7 +5270,7 @@ general_log CREATE TABLE `general_log` ( SHOW CREATE TABLE mysql.slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 3b365d6fdde..bc3598131e2 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -260,7 +260,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp(), `b` varchar(10) DEFAULT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/r/partition_bug18198.result b/mysql-test/r/partition_bug18198.result index 80f11edaaf6..ee7bf514807 100644 --- a/mysql-test/r/partition_bug18198.result +++ b/mysql-test/r/partition_bug18198.result @@ -130,8 +130,7 @@ ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitio create table t1 (col1 datetime) partition by range(week(col1)) (partition p0 values less than (10), partition p1 values less than (30)); -ERROR 42000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed near ') -(partition p0 values less than (10), partition p1 values less than (30))' at line 2 +ERROR HY000: This partition function is not allowed create table t1 (col1 varchar(25)) partition by range(cast(col1 as signed)) (partition p0 values less than (10), partition p1 values less than (30)); diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result index 436db33af36..8bb360e96ae 100644 --- a/mysql-test/r/plugin_auth.result +++ b/mysql-test/r/plugin_auth.result @@ -27,7 +27,7 @@ proxies_priv CREATE TABLE `proxies_priv` ( `Proxied_user` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `With_grant` tinyint(1) NOT NULL DEFAULT 0, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`User`,`Proxied_host`,`Proxied_user`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User proxy privileges' diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index ed768343581..7ef480a6019 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -342,7 +342,7 @@ t1 CREATE TABLE `t1` ( `empty_char` char(0) DEFAULT NULL, `type_char` char(2) DEFAULT NULL, `type_varchar` varchar(10) DEFAULT NULL, - `type_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `type_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `type_date` date NOT NULL DEFAULT '0000-00-00', `type_time` time NOT NULL DEFAULT '00:00:00', `type_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', @@ -742,17 +742,17 @@ DROP VIEW v1; CREATE VIEW v1 AS SELECT NOW(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select now() AS `NOW()` binary binary +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select current_timestamp() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE NOW(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache now() AS `NOW()` binary binary +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache current_timestamp() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache current_timestamp() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW(); ERROR HY000: Incorrect usage of SQL_CACHE and SQL_NO_CACHE @@ -979,7 +979,7 @@ def information_schema COLUMNS COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 def information_schema COLUMNS COLUMNS COLLATION_NAME COLLATION_NAME 253 96 0 Y 0 0 33 def information_schema COLUMNS COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33 def information_schema COLUMNS COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 -def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 81 0 N 1 0 33 +def information_schema COLUMNS COLUMNS EXTRA EXTRA 253 90 0 N 1 0 33 def information_schema COLUMNS COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 3072 0 N 1 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT @@ -998,7 +998,7 @@ def information_schema COLUMNS COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 def information_schema COLUMNS COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 def information_schema COLUMNS COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33 -def information_schema COLUMNS COLUMNS EXTRA Extra 253 81 0 N 1 0 33 +def information_schema COLUMNS COLUMNS EXTRA Extra 253 90 0 N 1 0 33 Field Type Null Key Default Extra c int(11) NO PRI NULL ---------------------------------------------------------------- diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index e1afb964f0a..782ae00bb33 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -149,7 +149,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "f1" int(11) NOT NULL AUTO_INCREMENT, - "f2" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + "f2" timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY ("f1") ) set session sql_mode=no_field_options; @@ -157,7 +157,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) NOT NULL, - `f2` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `f2` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`f1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index 52986fa9a6b..58d9dded51e 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -1688,7 +1688,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` blob DEFAULT NULL, - `b` text DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a) + `b` text DEFAULT decode_histogram('SINGLE_PREC_HB',`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF); SELECT b FROM t1; diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 4da77f21792..9436627aa1f 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1273,7 +1273,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 414815f02b7..b88497dbd9b 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/system_mysql_db_fix40123.result b/mysql-test/r/system_mysql_db_fix40123.result index 414815f02b7..b88497dbd9b 100644 --- a/mysql-test/r/system_mysql_db_fix40123.result +++ b/mysql-test/r/system_mysql_db_fix40123.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/system_mysql_db_fix50030.result b/mysql-test/r/system_mysql_db_fix50030.result index ed86a35c910..14905ab81a0 100644 --- a/mysql-test/r/system_mysql_db_fix50030.result +++ b/mysql-test/r/system_mysql_db_fix50030.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/system_mysql_db_fix50117.result b/mysql-test/r/system_mysql_db_fix50117.result index 414815f02b7..b88497dbd9b 100644 --- a/mysql-test/r/system_mysql_db_fix50117.result +++ b/mysql-test/r/system_mysql_db_fix50117.result @@ -151,7 +151,7 @@ tables_priv CREATE TABLE `tables_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '', `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`), @@ -165,7 +165,7 @@ columns_priv CREATE TABLE `columns_priv` ( `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '', PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges' @@ -179,7 +179,7 @@ procs_priv CREATE TABLE `procs_priv` ( `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL, `Grantor` char(141) COLLATE utf8_bin NOT NULL DEFAULT '', `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '', - `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`), KEY `Grantor` (`Grantor`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges' @@ -212,7 +212,7 @@ proc CREATE TABLE `proc` ( `returns` longblob NOT NULL, `body` longblob NOT NULL, `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -232,7 +232,7 @@ event CREATE TABLE `event` ( `execute_at` datetime DEFAULT NULL, `interval_value` int(11) DEFAULT NULL, `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, @@ -252,7 +252,7 @@ event CREATE TABLE `event` ( show create table general_log; Table Create Table general_log CREATE TABLE `general_log` ( - `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `event_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `thread_id` bigint(21) unsigned NOT NULL, `server_id` int(10) unsigned NOT NULL, @@ -262,7 +262,7 @@ general_log CREATE TABLE `general_log` ( show create table slow_log; Table Create Table slow_log CREATE TABLE `slow_log` ( - `start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `start_time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `user_host` mediumtext NOT NULL, `query_time` time(6) NOT NULL, `lock_time` time(6) NOT NULL, diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 819fe5306ab..dae9094f463 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -42,13 +42,13 @@ Note 1246 Converting column 'a' from VARCHAR to TEXT SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` mediumtext DEFAULT "hello" + `a` mediumtext DEFAULT 'hello' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 (a blob default "hello"); SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` blob DEFAULT "hello" + `a` blob DEFAULT 'hello' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1,t2; create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 43409cf60e7..6af497577fc 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -54,7 +54,7 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field date NULL YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -226,7 +226,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -252,7 +252,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO 0 # ulong int(11) unsigned NULL NO 0 # ulonglong bigint(13) unsigned NULL NO 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # diff --git a/mysql-test/r/type_temporal_mysql56.result b/mysql-test/r/type_temporal_mysql56.result index b0c81844781..cdc951dac14 100644 --- a/mysql-test/r/type_temporal_mysql56.result +++ b/mysql-test/r/type_temporal_mysql56.result @@ -63,7 +63,7 @@ SET TIME_ZONE='+00:00'; SHOW CREATE TABLE mysql56timestamp; Table Create Table mysql56timestamp CREATE TABLE `mysql56timestamp` ( - `ts0` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ts0` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `ts1` timestamp(1) NOT NULL DEFAULT '0000-00-00 00:00:00.0', `ts2` timestamp(2) NOT NULL DEFAULT '0000-00-00 00:00:00.00', `ts3` timestamp(3) NOT NULL DEFAULT '0000-00-00 00:00:00.000', diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index 69c9f68811d..90246fed831 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -195,13 +195,13 @@ t1 t2 t3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp(), `t2` datetime DEFAULT NULL, `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; @@ -222,12 +222,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP +t1 timestamp NO 2003-01-01 00:00:00 on update current_timestamp() t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp not null default now() on update now(), t2 datetime); @@ -247,12 +247,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -272,13 +272,13 @@ t1 t2 t3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL, `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; @@ -299,12 +299,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL truncate table t1; insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00'); @@ -369,7 +369,7 @@ create table t1 (a timestamp null default current_timestamp on update current_ti show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL, NULL); @@ -710,12 +710,12 @@ CREATE TABLE t2 AS SELECT * from t1 LIMIT 0; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `ts` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `ts` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; SET sql_mode=DEFAULT; @@ -731,13 +731,13 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `vc` varchar(10) NOT NULL DEFAULT 'test', - `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `ts` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `vc` varchar(10) NOT NULL DEFAULT 'test', - `ts` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP + `ts` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; End of 10.0 tests diff --git a/mysql-test/r/type_timestamp_hires.result b/mysql-test/r/type_timestamp_hires.result index ccad5c8f8a1..fc1bd83e04f 100644 --- a/mysql-test/r/type_timestamp_hires.result +++ b/mysql-test/r/type_timestamp_hires.result @@ -64,15 +64,15 @@ a show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -a timestamp(4) NO CURRENT_TIMESTAMP(4) on update CURRENT_TIMESTAMP +a timestamp(4) NO current_timestamp(4) on update current_timestamp(4) select table_name, column_name, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, datetime_precision, character_set_name, collation_name, column_type, column_key, extra from information_schema.columns where table_name='t1'; table_name t1 column_name a -column_default CURRENT_TIMESTAMP(4) +column_default current_timestamp(4) is_nullable NO data_type timestamp character_maximum_length NULL @@ -84,7 +84,7 @@ character_set_name NULL collation_name NULL column_type timestamp(4) column_key -extra on update CURRENT_TIMESTAMP +extra on update current_timestamp(4) select a, a+interval 9876543 microsecond from t1; a a+interval 9876543 microsecond 2010-12-11 01:02:03.4567 2010-12-11 01:02:13.333243 @@ -109,12 +109,12 @@ create table t3 like t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create table t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4) + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t2, t3; insert t1 values ('2010-12-13 14:15:16.222222'); @@ -130,7 +130,7 @@ create table t3 select max(a), min(a), sum(a), avg(a) from t1; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp(4) NOT NULL DEFAULT CURRENT_TIMESTAMP(4) ON UPDATE CURRENT_TIMESTAMP(4), + `a` timestamp(4) NOT NULL DEFAULT current_timestamp(4) ON UPDATE current_timestamp(4), `a+0` decimal(25,4) NOT NULL, `a-1` decimal(25,4) NOT NULL, `a*1` decimal(25,4) NOT NULL, @@ -276,13 +276,13 @@ create or replace table t1 (a timestamp(5) default current_timestamp); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) default current_timestamp()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) default current_timestamp(2)); show create table t1; @@ -298,25 +298,25 @@ create or replace table t1 (a timestamp(5) default current_timestamp(5)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) default current_timestamp(6)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp()); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp(3)); ERROR HY000: Invalid ON UPDATE clause for 'a' column @@ -324,12 +324,12 @@ create or replace table t1 (a timestamp(5) on update current_timestamp(5)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 create or replace table t1 (a timestamp(5) on update current_timestamp(6)); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE CURRENT_TIMESTAMP(5) + `a` timestamp(5) NOT NULL DEFAULT '0000-00-00 00:00:00.00000' ON UPDATE current_timestamp(5) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index dc9806bb7d1..737ed32f1ee 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -457,7 +457,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) DEFAULT METAPHON(a) + `b` varchar(10) DEFAULT metaphon(`a` AS `a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a) VALUES ('Hello'); SELECT * FROM t1; diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 34b899b3f00..faf645d9468 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1920,7 +1920,7 @@ create table t2 (b timestamp default now()); create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now(); SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now()) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < current_timestamp()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < current_timestamp()) latin1 latin1_swedish_ci drop view v1; drop table t1, t2; CREATE TABLE t1 ( a varchar(50) ); @@ -2948,7 +2948,7 @@ create table t1 (f1 datetime); create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute; show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute)) latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between current_timestamp() and (current_timestamp() + interval 1 minute)) latin1 latin1_swedish_ci drop view v1; drop table t1; DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result index 4b028e1da3d..89f29ff4b38 100644 --- a/mysql-test/suite/funcs_1/r/is_columns.result +++ b/mysql-test/suite/funcs_1/r/is_columns.result @@ -45,7 +45,7 @@ CHARACTER_SET_NAME varchar(32) YES NULL COLLATION_NAME varchar(32) YES NULL COLUMN_TYPE longtext NO COLUMN_KEY varchar(3) NO -EXTRA varchar(27) NO +EXTRA varchar(30) NO PRIVILEGES varchar(80) NO COLUMN_COMMENT varchar(1024) NO SHOW CREATE TABLE information_schema.COLUMNS; @@ -68,7 +68,7 @@ COLUMNS CREATE TEMPORARY TABLE `COLUMNS` ( `COLLATION_NAME` varchar(32) DEFAULT NULL, `COLUMN_TYPE` longtext NOT NULL DEFAULT '', `COLUMN_KEY` varchar(3) NOT NULL DEFAULT '', - `EXTRA` varchar(27) NOT NULL DEFAULT '', + `EXTRA` varchar(30) NOT NULL DEFAULT '', `PRIVILEGES` varchar(80) NOT NULL DEFAULT '', `COLUMN_COMMENT` varchar(1024) NOT NULL DEFAULT '' ) DEFAULT CHARSET=utf8 @@ -91,7 +91,7 @@ CHARACTER_SET_NAME varchar(32) YES NULL COLLATION_NAME varchar(32) YES NULL COLUMN_TYPE longtext NO COLUMN_KEY varchar(3) NO -EXTRA varchar(27) NO +EXTRA varchar(30) NO PRIVILEGES varchar(80) NO COLUMN_COMMENT varchar(1024) NO SELECT table_catalog, table_schema, table_name, column_name diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result index fd8989c7667..a005e39b0b4 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result @@ -645,7 +645,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time select,insert,update,references def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result index 69c5d79b541..bc7a693d617 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result @@ -68,7 +68,7 @@ def information_schema COLUMNS COLUMN_NAME 4 NO varchar 64 192 NULL NULL NULL u def information_schema COLUMNS COLUMN_TYPE 16 NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext def information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) def information_schema COLUMNS DATETIME_PRECISION 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned -def information_schema COLUMNS EXTRA 18 NO varchar 27 81 NULL NULL NULL utf8 utf8_general_ci varchar(27) +def information_schema COLUMNS EXTRA 18 NO varchar 30 90 NULL NULL NULL utf8 utf8_general_ci varchar(30) def information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL NULL utf8 utf8_general_ci varchar(3) def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned @@ -602,7 +602,7 @@ NULL information_schema COLUMNS DATETIME_PRECISION bigint NULL NULL NULL NULL bi 3.0000 information_schema COLUMNS COLLATION_NAME varchar 32 96 utf8 utf8_general_ci varchar(32) 1.0000 information_schema COLUMNS COLUMN_TYPE longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema COLUMNS COLUMN_KEY varchar 3 9 utf8 utf8_general_ci varchar(3) -3.0000 information_schema COLUMNS EXTRA varchar 27 81 utf8 utf8_general_ci varchar(27) +3.0000 information_schema COLUMNS EXTRA varchar 30 90 utf8 utf8_general_ci varchar(30) 3.0000 information_schema COLUMNS PRIVILEGES varchar 80 240 utf8 utf8_general_ci varchar(80) 3.0000 information_schema COLUMNS COLUMN_COMMENT varchar 1024 3072 utf8 utf8_general_ci varchar(1024) 3.0000 information_schema COLUMN_PRIVILEGES GRANTEE varchar 190 570 utf8 utf8_general_ci varchar(190) diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result index 674abfaefab..fdb410fee7a 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_memory.result +++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result @@ -620,7 +620,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time select,insert,update,references def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result index 6ce5f1bd8a0..823a3ffe214 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result @@ -682,7 +682,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date select,insert,update,references def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time select,insert,update,references def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result index d89459a88ac..3b9f33f2917 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_myisam_embedded.result @@ -682,7 +682,7 @@ def test tb4 f217 42 NULL YES double NULL NULL 22 NULL NULL NULL NULL double uns def test tb4 f218 43 NULL YES date NULL NULL NULL NULL NULL NULL NULL date def test tb4 f219 44 NULL YES time NULL NULL NULL NULL 0 NULL NULL time def test tb4 f220 45 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime -def test tb4 f221 46 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def test tb4 f221 46 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def test tb4 f222 47 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) def test tb4 f223 48 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) def test tb4 f224 49 NULL YES year NULL NULL NULL NULL NULL NULL NULL year(4) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 2821e1112e5..832460e085b 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -7,7 +7,7 @@ def mysql columns_priv Column_priv 7 NO set 31 93 NULL NULL NULL utf8 utf8_gene def mysql columns_priv Db 2 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql columns_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql columns_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references -def mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql columns_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql columns_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) select,insert,update,references @@ -47,7 +47,7 @@ def mysql event body_utf8 22 NULL YES longblob 4294967295 4294967295 NULL NULL N def mysql event character_set_client 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql event collation_connection 20 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql event comment 16 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) select,insert,update,references -def mysql event created 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql event created 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql event db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql event db_collation 21 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql event definer 4 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) select,insert,update,references @@ -70,7 +70,7 @@ def mysql func ret 2 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) sele def mysql func type 4 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('function','aggregate') select,insert,update,references def mysql general_log argument 6 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references def mysql general_log command_type 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select,insert,update,references -def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP select,insert,update,references +def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) select,insert,update,references def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references @@ -124,7 +124,7 @@ def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NU def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql proc collation_connection 18 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql proc comment 16 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text select,insert,update,references -def mysql proc created 13 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql proc created 13 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql proc db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql proc db_collation 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references def mysql proc definer 12 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) select,insert,update,references @@ -145,13 +145,13 @@ def mysql procs_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60 def mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') select,insert,update,references def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references -def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql procs_priv Timestamp 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql procs_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql proxies_priv Grantor 6 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL select,insert,update,references def mysql proxies_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql proxies_priv Proxied_user 4 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references -def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql proxies_priv Timestamp 7 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql proxies_priv User 2 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references def mysql roles_mapping Admin_option 4 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references @@ -177,7 +177,7 @@ def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references def mysql slow_log sql_text 11 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references -def mysql slow_log start_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP select,insert,update,references +def mysql slow_log start_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) select,insert,update,references def mysql slow_log thread_id 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references def mysql slow_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references def mysql tables_priv Column_priv 8 NO set 31 93 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References') select,insert,update,references @@ -186,7 +186,7 @@ def mysql tables_priv Grantor 5 NO char 141 423 NULL NULL NULL utf8 utf8_bin ch def mysql tables_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references def mysql tables_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references def mysql tables_priv Table_priv 7 NO set 98 294 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') select,insert,update,references -def mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references +def mysql tables_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references def mysql tables_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references def mysql table_stats cardinality 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references def mysql table_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI select,insert,update,references diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 006ed9d82f2..0a92e6edf24 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -7,7 +7,7 @@ def mysql columns_priv Column_priv 7 NO set 31 93 NULL NULL NULL utf8 utf8_gene def mysql columns_priv Db 2 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql columns_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql columns_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI -def mysql columns_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql columns_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql columns_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql column_stats avg_frequency 8 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) def mysql column_stats avg_length 7 NULL YES decimal NULL NULL 12 4 NULL NULL NULL decimal(12,4) @@ -47,7 +47,7 @@ def mysql event body_utf8 22 NULL YES longblob 4294967295 4294967295 NULL NULL N def mysql event character_set_client 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql event collation_connection 20 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql event comment 16 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) -def mysql event created 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql event created 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql event db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql event db_collation 21 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql event definer 4 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) @@ -70,7 +70,7 @@ def mysql func ret 2 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) def mysql func type 4 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('function','aggregate') def mysql general_log argument 6 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext def mysql general_log command_type 5 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) -def mysql general_log event_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP +def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext @@ -124,7 +124,7 @@ def mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NU def mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql proc collation_connection 18 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql proc comment 16 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text -def mysql proc created 13 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql proc created 13 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql proc db 1 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql proc db_collation 19 NULL YES char 32 96 NULL NULL NULL utf8 utf8_bin char(32) def mysql proc definer 12 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) @@ -145,13 +145,13 @@ def mysql procs_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60 def mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') def mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI def mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI -def mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql procs_priv Timestamp 8 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql procs_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql proxies_priv Grantor 6 NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL def mysql proxies_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql proxies_priv Proxied_host 3 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql proxies_priv Proxied_user 4 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI -def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql proxies_priv Timestamp 7 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql proxies_priv User 2 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) def mysql roles_mapping Admin_option 4 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') @@ -177,7 +177,7 @@ def mysql slow_log rows_examined 6 NULL NO int NULL NULL 10 0 NULL NULL NULL int def mysql slow_log rows_sent 5 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) def mysql slow_log server_id 10 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned def mysql slow_log sql_text 11 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext -def mysql slow_log start_time 1 CURRENT_TIMESTAMP(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update CURRENT_TIMESTAMP +def mysql slow_log start_time 1 current_timestamp(6) NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) on update current_timestamp(6) def mysql slow_log thread_id 12 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def mysql slow_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext def mysql tables_priv Column_priv 8 NO set 31 93 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','References') @@ -186,7 +186,7 @@ def mysql tables_priv Grantor 5 NO char 141 423 NULL NULL NULL utf8 utf8_bin ch def mysql tables_priv Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI def mysql tables_priv Table_name 4 NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI def mysql tables_priv Table_priv 7 NO set 98 294 NULL NULL NULL utf8 utf8_general_ci set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') -def mysql tables_priv Timestamp 6 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP +def mysql tables_priv Timestamp 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() def mysql tables_priv User 3 NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI def mysql table_stats cardinality 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned def mysql table_stats db_name 1 NULL NO varchar 64 192 NULL NULL NULL utf8 utf8_bin varchar(64) PRI diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result index fa0badff96d..5deeeb23baa 100644 --- a/mysql-test/suite/gcol/r/gcol_bugfixes.result +++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result @@ -486,7 +486,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` char(1) DEFAULT NULL, - `c` char(2) GENERATED ALWAYS AS ((`a` or `b`)) VIRTUAL + `c` char(2) AS (((`a` <> 0) or (`b` <> 0))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES('1','1'); SELECT * FROM t1; @@ -507,7 +507,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, `b` char(1) DEFAULT NULL, - `c` char(2) GENERATED ALWAYS AS (concat(`a`,`b`)) VIRTUAL + `c` char(2) AS (concat(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 (a,b) VALUES('1','1'); SELECT * FROM t1; @@ -534,7 +534,6 @@ ALTER TABLE t ADD b INTEGER AS (SUBSTR('','a',1)); Warnings: Warning 1292 Truncated incorrect INTEGER value: 'a' Warning 1292 Truncated incorrect INTEGER value: 'a' -Warning 1292 Truncated incorrect INTEGER value: 'a' DROP TABLE t; set sql_mode= @save_old_sql_mode; # Bug#21875520 Problems with virtual column indexes diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result index 6a738685a5d..d271edd37cf 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result @@ -81,7 +81,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -94,7 +94,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -114,7 +114,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t2; Field Type Null Key Default Extra @@ -136,7 +136,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -158,7 +158,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int generated always as (a % 2) virtual); @@ -168,7 +168,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; drop table t2; @@ -191,7 +191,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -203,7 +203,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -216,7 +216,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -229,7 +229,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (5 * 2) VIRTUAL + `b` int(11) AS ((5 * 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -294,9 +294,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a + 1) VIRTUAL, - `c` varchar(12) AS ("aaaabb") PERSISTENT, - `d` blob AS (c) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL, + `c` varchar(12) AS ('aaaabb') PERSISTENT, + `d` blob AS (`c`) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 SELECT * FROM t1 order by a; a b c d @@ -307,9 +307,9 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a + 1) VIRTUAL, - `c` varchar(12) AS ("aaaabb") PERSISTENT, - `d` blob AS (c) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL, + `c` varchar(12) AS ('aaaabb') PERSISTENT, + `d` blob AS (`c`) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 CREATE TABLE t3 AS SELECT * FROM t1; SHOW CREATE TABLE t3; @@ -604,7 +604,7 @@ Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) NOT NULL, "b" varchar(10) DEFAULT NULL, - "c" char(3) AS (substr(b,1,3)) VIRTUAL, + "c" char(3) AS (substr("b",1,3)) VIRTUAL, PRIMARY KEY ("a"), KEY "c" ("c") ) @@ -619,7 +619,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, - `c` char(3) AS (substr(b,1,3)) VIRTUAL, + `c` char(3) AS (substr(`b`,1,3)) VIRTUAL, PRIMARY KEY (`a`), KEY `c` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result index f5f8afcc353..37cdc82710d 100644 --- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result @@ -81,7 +81,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -94,7 +94,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -114,7 +114,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t2; Field Type Null Key Default Extra @@ -136,7 +136,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -158,7 +158,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int generated always as (a % 2) virtual); @@ -168,7 +168,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; drop table t2; @@ -191,7 +191,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -203,7 +203,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -216,7 +216,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -229,7 +229,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (5 * 2) VIRTUAL + `b` int(11) AS ((5 * 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -294,9 +294,9 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a + 1) VIRTUAL, - `c` varchar(12) AS ("aaaabb") PERSISTENT, - `d` blob AS (c) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL, + `c` varchar(12) AS ('aaaabb') PERSISTENT, + `d` blob AS (`c`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SELECT * FROM t1 order by a; a b c d @@ -307,9 +307,9 @@ SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a + 1) VIRTUAL, - `c` varchar(12) AS ("aaaabb") PERSISTENT, - `d` blob AS (c) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL, + `c` varchar(12) AS ('aaaabb') PERSISTENT, + `d` blob AS (`c`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t3 AS SELECT * FROM t1; SHOW CREATE TABLE t3; @@ -604,7 +604,7 @@ Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) NOT NULL, "b" varchar(10) DEFAULT NULL, - "c" char(3) AS (substr(b,1,3)) VIRTUAL, + "c" char(3) AS (substr("b",1,3)) VIRTUAL, PRIMARY KEY ("a"), KEY "c" ("c") ) @@ -619,7 +619,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(10) DEFAULT NULL, - `c` char(3) AS (substr(b,1,3)) VIRTUAL, + `c` char(3) AS (substr(`b`,1,3)) VIRTUAL, PRIMARY KEY (`a`), KEY `c` (`c`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result index ff3e7970f29..3f73b44607c 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result @@ -11,7 +11,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; @@ -24,7 +24,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; @@ -46,7 +46,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; @@ -59,7 +59,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `a` (`a`,`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result index 162035c999e..7a45008b9a2 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result @@ -11,7 +11,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) VIRTUAL, + `b` int(11) AS ((`a` * 2)) VIRTUAL, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -24,7 +24,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -37,7 +37,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) VIRTUAL, + `b` int(11) AS ((`a` * 2)) VIRTUAL, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -50,7 +50,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -75,7 +75,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) VIRTUAL, + `b` int(11) AS ((`a` * 2)) VIRTUAL, KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -90,7 +90,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -103,7 +103,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `a` (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; diff --git a/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result b/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result index aed3fbc8e0b..30d3abb3df0 100644 --- a/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_non_stored_columns_innodb.result @@ -90,7 +90,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored @@ -101,7 +101,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 9. CREATE LIKE @@ -182,7 +182,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) VIRTUAL, + `c` int(11) AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -203,7 +203,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) PERSISTENT, + `c` int(11) AS (dayofyear(`b`)) PERSISTENT, `b` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -225,7 +225,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) VIRTUAL + `c` int(11) AS (week(`b`,1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; DROP VIEW IF EXISTS v1,v2; diff --git a/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result b/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result index 2ebe751009c..2d3d57ab39d 100644 --- a/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_non_stored_columns_myisam.result @@ -90,7 +90,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored @@ -101,7 +101,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 9. CREATE LIKE @@ -182,7 +182,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) VIRTUAL, + `c` int(11) AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -203,7 +203,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) PERSISTENT, + `c` int(11) AS (dayofyear(`b`)) PERSISTENT, `b` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -225,7 +225,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) VIRTUAL + `c` int(11) AS (week(`b`,1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; DROP VIEW IF EXISTS v1,v2; diff --git a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result index 72021909e0f..e8d91e13e4d 100644 --- a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_innodb.result @@ -10,7 +10,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (abs(a)) VIRTUAL + `b` int(11) AS (abs(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-1, default); select * from t1; @@ -25,7 +25,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(acos(a),6)) VIRTUAL + `b` double AS (format(acos(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1, default); insert into t1 values (1.0001,default); @@ -44,7 +44,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(asin(a),6)) VIRTUAL + `b` double AS (format(asin(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (0.2, default); insert into t1 values (1.0001,default); @@ -62,7 +62,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan(a,b),6)) VIRTUAL + `c` double AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -78,7 +78,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `c` double AS (format(atan(a),6)) VIRTUAL + `c` double AS (format(atan(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-2,default); insert into t1 values (format(PI(),6),default); @@ -96,7 +96,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan2(a,b),6)) VIRTUAL + `c` double AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -113,7 +113,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (ceil(a)) VIRTUAL + `b` int(11) AS (ceiling(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -132,7 +132,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (conv(a,b,c)) VIRTUAL + `d` varchar(10) AS (conv(`a`,`b`,`c`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('a',16,2,default); insert into t1 values ('6e',18,8,default); @@ -153,7 +153,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cos(a),6)) VIRTUAL + `b` double AS (format(cos(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); select * from t1; @@ -168,7 +168,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cot(a),6)) VIRTUAL + `b` double AS (format(cot(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (12,default); @@ -184,7 +184,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (crc32(a)) VIRTUAL + `b` bigint(20) AS (crc32(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('mysql',default); @@ -201,7 +201,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(degrees(a),6)) VIRTUAL + `b` double AS (format(degrees(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()/2,6),default); @@ -218,7 +218,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a/2) VIRTUAL + `b` double AS ((`a` / 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -233,7 +233,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(exp(a),6)) VIRTUAL + `b` double AS (format(exp(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -252,7 +252,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` bigint(20) AS (floor(a)) VIRTUAL + `b` bigint(20) AS (floor(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -269,7 +269,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(ln(a),6)) VIRTUAL + `b` double AS (format(ln(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -287,7 +287,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(log(a,b),6)) VIRTUAL + `c` double AS (format(log(`a`,`b`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,65536,default); insert into t1 values (10,100,default); @@ -305,7 +305,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log(a),6)) VIRTUAL + `b` double AS (format(log(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -322,7 +322,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log2(a),6)) VIRTUAL + `b` double AS (format(log2(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (65536,default); insert into t1 values (-100,default); @@ -339,7 +339,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log10(a),6)) VIRTUAL + `b` double AS (format(log10(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (100,default); @@ -358,7 +358,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a-1) VIRTUAL + `b` double AS ((`a` - 1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -373,7 +373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (mod(a,10)) VIRTUAL + `b` int(11) AS ((`a` % 10)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -390,7 +390,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 10) VIRTUAL + `b` int(11) AS ((`a` % 10)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -407,7 +407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(10) AS (oct(a)) VIRTUAL + `b` varchar(10) AS (conv(`a`,10,8)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -422,7 +422,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(PI()*a*a,6)) VIRTUAL + `b` double AS (format(((pi() * `a`) * `a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -437,7 +437,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -452,8 +452,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (pow(a,2)) VIRTUAL, - `c` int(11) AS (power(a,2)) VIRTUAL + `b` int(11) AS (pow(`a`,2)) VIRTUAL, + `c` int(11) AS (pow(`a`,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default,default); insert into t1 values (2,default,default); @@ -470,7 +470,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(radians(a),6)) VIRTUAL + `b` double AS (format(radians(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (90,default); select * from t1; @@ -485,7 +485,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (round(a)) VIRTUAL + `b` int(11) AS (round(`a`,0)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-1.23,default); insert into t1 values (-1.58,default); @@ -504,7 +504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` int(11) AS (round(a,b)) VIRTUAL + `c` int(11) AS (round(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1.298,1,default); insert into t1 values (1.298,0,default); @@ -523,7 +523,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (sign(a)) VIRTUAL + `b` int(11) AS (sign(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-32,default); insert into t1 values (0,default); @@ -542,7 +542,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sin(a),6)) VIRTUAL + `b` double AS (format(sin(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (format(PI()/2,6),default); select * from t1; @@ -557,7 +557,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sqrt(a),6)) VIRTUAL + `b` double AS (format(sqrt(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (4,default); insert into t1 values (20,default); @@ -576,7 +576,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(tan(a),6)) VIRTUAL + `b` double AS (format(tan(`a`),6)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()+1,6),default); @@ -593,7 +593,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a*3) VIRTUAL + `b` double AS ((`a` * 3)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -612,7 +612,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (truncate(a,4)) VIRTUAL + `b` double AS (truncate(`a`,4)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1.223,default); insert into t1 values (1.999,default); @@ -633,7 +633,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (-a) VIRTUAL + `b` double AS (-(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -653,7 +653,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, - `b` int(11) AS (ascii(a)) VIRTUAL + `b` int(11) AS (ascii(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2',default); insert into t1 values (2,default); @@ -672,7 +672,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (bin(a)) VIRTUAL + `b` varchar(10) AS (conv(`a`,10,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -687,7 +687,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (bit_length(a)) VIRTUAL + `b` bigint(20) AS (bit_length(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -702,7 +702,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (char_length(a)) VIRTUAL + `b` bigint(20) AS (char_length(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -718,7 +718,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` varbinary(10) AS (char(a,b)) VIRTUAL + `c` varbinary(10) AS (char(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (77,121,default); select * from t1; @@ -733,7 +733,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (character_length(a)) VIRTUAL + `b` bigint(20) AS (char_length(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -749,7 +749,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat_ws(',',a,b)) VIRTUAL + `c` varchar(20) AS (concat_ws(',',`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -765,7 +765,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat(a,',',b)) VIRTUAL + `c` varchar(20) AS (concat(`a`,',',`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -782,7 +782,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (elt(c,a,b)) VIRTUAL + `d` varchar(10) AS (elt(`c`,`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',1,default); insert into t1 values ('value1','value2',2,default); @@ -799,7 +799,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (export_set(a,'1','0','',10)) VIRTUAL + `b` varchar(10) AS (export_set(`a`,'1','0','',10)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (6,default); select * from t1; @@ -815,7 +815,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (field('aa',a,b)) VIRTUAL + `c` int(11) AS (field('aa',`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('aa','bb',default); insert into t1 values ('bb','aa',default); @@ -833,7 +833,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (find_in_set(a,b)) VIRTUAL + `c` int(11) AS (find_in_set(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('aa','aa,bb,cc',default); insert into t1 values ('aa','bb,aa,cc',default); @@ -850,7 +850,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(20) AS (format(a,2)) VIRTUAL + `b` varchar(20) AS (format(`a`,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (12332.123456,default); select * from t1; @@ -865,7 +865,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) AS (hex(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (17,default); select * from t1; @@ -879,7 +879,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) AS (hex(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -895,7 +895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (insert(a,length(a),length(b),b)) VIRTUAL + `c` varchar(20) AS (insert(`a`,length(`a`),length(`b`),`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('start,','end',default); select * from t1; @@ -911,7 +911,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (instr(a,b)) VIRTUAL + `c` int(11) AS (locate(`b`,`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar,','bar',default); insert into t1 values ('xbar,','foobar',default); @@ -928,7 +928,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lcase(a)) VIRTUAL + `b` varchar(10) AS (lcase(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -943,7 +943,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(5) AS (left(a,5)) VIRTUAL + `b` varchar(5) AS (left(`a`,5)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -958,7 +958,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (length(a)) VIRTUAL + `b` int(11) AS (length(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -973,7 +973,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%o') VIRTUAL + `b` tinyint(1) AS ((`a` like 'H%o')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -990,7 +990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (locate('bar',a)) VIRTUAL + `b` varchar(10) AS (locate('bar',`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1005,7 +1005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lower(a)) VIRTUAL + `b` varchar(10) AS (lcase(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1020,7 +1020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lpad(a,4,' ')) VIRTUAL + `b` varchar(10) AS (lpad(`a`,4,' ')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('M',default); @@ -1037,7 +1037,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (ltrim(a)) VIRTUAL + `b` varchar(10) AS (ltrim(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (' MySQL',default); insert into t1 values ('MySQL',default); @@ -1056,7 +1056,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(30) AS (make_set(c,a,b)) VIRTUAL + `d` varchar(30) AS (make_set(`c`,`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('a','b',1,default); insert into t1 values ('a','b',3,default); @@ -1073,7 +1073,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (mid(a,1,2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,1,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1088,7 +1088,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not like 'H%o') VIRTUAL + `b` tinyint(1) AS ((not((`a` like 'H%o')))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1105,7 +1105,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not regexp 'H.+o') VIRTUAL + `b` tinyint(1) AS ((not((`a` regexp 'H.+o')))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1122,7 +1122,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (octet_length(a)) VIRTUAL + `b` int(11) AS (length(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -1137,7 +1137,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (ord(a)) VIRTUAL + `b` bigint(20) AS (ord(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2',default); select * from t1; @@ -1152,7 +1152,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (position('bar' in a)) VIRTUAL + `b` varchar(10) AS (locate('bar',`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1167,7 +1167,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (quote(a)) VIRTUAL + `b` varchar(10) AS (quote(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Don\'t',default); select * from t1; @@ -1182,7 +1182,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a regexp 'H.+o') VIRTUAL + `b` tinyint(1) AS ((`a` regexp 'H.+o')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1199,7 +1199,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (repeat(a,3)) VIRTUAL + `b` varchar(30) AS (repeat(`a`,3)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1214,7 +1214,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (replace(a,'aa','bb')) VIRTUAL + `b` varchar(30) AS (replace(`a`,'aa','bb')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1229,7 +1229,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (reverse(a)) VIRTUAL + `b` varchar(30) AS (reverse(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1244,7 +1244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (right(a,4)) VIRTUAL + `b` varchar(10) AS (right(`a`,4)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1259,7 +1259,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a rlike 'H.+o') VIRTUAL + `b` tinyint(1) AS ((`a` regexp 'H.+o')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1276,7 +1276,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rpad(a,4,'??')) VIRTUAL + `b` varchar(10) AS (rpad(`a`,4,'??')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('He',default); select * from t1; @@ -1291,7 +1291,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rtrim(a)) VIRTUAL + `b` varchar(10) AS (rtrim(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello ',default); select * from t1; @@ -1306,7 +1306,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) AS (soundex(a)) VIRTUAL + `b` varchar(20) AS (soundex(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1322,7 +1322,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a sounds like b) VIRTUAL + `c` tinyint(1) AS ((soundex(`a`) = soundex(`b`))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello',default); insert into t1 values ('Hello','MySQL',default); @@ -1341,7 +1341,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (concat(a,space(5))) VIRTUAL + `b` varchar(10) AS (concat(`a`,space(5))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello', default); select * from t1; @@ -1357,7 +1357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, - `c` tinyint(1) AS (strcmp(a,b)) VIRTUAL + `c` tinyint(1) AS (strcmp(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello', default); insert into t1 values ('Hello','Hello1', default); @@ -1374,7 +1374,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substr(a,2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1389,7 +1389,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (substring_index(a,'.',2)) VIRTUAL + `b` varchar(10) AS (substring_index(`a`,'.',2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('www.mysql.com',default); select * from t1; @@ -1404,7 +1404,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substring(a from 2 for 2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,2,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1419,7 +1419,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (trim(a)) VIRTUAL + `b` varchar(10) AS (trim(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (' aa ',default); select * from t1; @@ -1434,7 +1434,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (ucase(a)) VIRTUAL + `b` varchar(10) AS (ucase(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1449,7 +1449,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (unhex(a)) VIRTUAL + `b` varchar(10) AS (unhex(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('4D7953514C',default); select * from t1; @@ -1464,7 +1464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (upper(a)) VIRTUAL + `b` varchar(10) AS (ucase(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1479,7 +1479,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (weight_string(a as char(4))) VIRTUAL + `b` varchar(10) AS (weight_string(`a`,0,4,65)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1497,7 +1497,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(16) AS (case a when NULL then 'asd' when 'b' then 'B' else a end) VIRTUAL + `b` varchar(16) AS ((case `a` when NULL then 'asd' when 'b' then 'B' else `a` end)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (NULL,default); insert into t1 values ('b',default); @@ -1517,7 +1517,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (if(a=1,a,b)) VIRTUAL + `c` int(11) AS (if((`a` = 1),`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,2,default); insert into t1 values (3,4,default); @@ -1535,7 +1535,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(10) AS (ifnull(a,'DEFAULT')) VIRTUAL + `c` varchar(10) AS (ifnull(`a`,'DEFAULT')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (NULL,'adf',default); insert into t1 values ('a','adf',default); @@ -1552,7 +1552,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (nullif(a,'DEFAULT')) VIRTUAL + `b` varchar(10) AS (nullif(`a`,'DEFAULT')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('DEFAULT',default); insert into t1 values ('a',default); @@ -1572,7 +1572,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a>0 && a<2) VIRTUAL + `b` tinyint(1) AS (((`a` > 0) and (`a` < 2))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1589,7 +1589,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a between 0 and 2) VIRTUAL + `b` tinyint(1) AS ((`a` between 0 and 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1606,7 +1606,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varbinary(10) AS (binary a) VIRTUAL + `b` varbinary(10) AS (cast(`a` as char charset binary)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('11',default); insert into t1 values (1,default); @@ -1623,7 +1623,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a & 5) VIRTUAL + `b` int(11) AS ((`a` & 5)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1640,7 +1640,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (~a) VIRTUAL + `b` int(11) AS (~(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); Warnings: @@ -1657,7 +1657,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a | 5) VIRTUAL + `b` int(11) AS ((`a` | 5)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1676,7 +1676,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a ^ 5) VIRTUAL + `b` int(11) AS ((`a` ^ 5)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1695,7 +1695,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a div 5) VIRTUAL + `b` int(11) AS ((`a` DIV 5)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (7,default); @@ -1713,7 +1713,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` tinyint(1) AS (a <=> b) VIRTUAL + `c` tinyint(1) AS ((`a` <=> `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,1,default); insert into t1 values (NULL,NULL,default); @@ -1733,7 +1733,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a=b) VIRTUAL + `c` tinyint(1) AS ((`a` = `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1751,7 +1751,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a >= b) VIRTUAL + `c` tinyint(1) AS ((`a` >= `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1769,7 +1769,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a > b) VIRTUAL + `c` tinyint(1) AS ((`a` > `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1786,7 +1786,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is not null) VIRTUAL + `b` tinyint(1) AS ((`a` is not null)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1803,7 +1803,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is null) VIRTUAL + `b` tinyint(1) AS (isnull(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1820,7 +1820,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a << 2) VIRTUAL + `b` int(11) AS ((`a` << 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (3,default); @@ -1838,7 +1838,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <= b) VIRTUAL + `c` tinyint(1) AS ((`a` <= `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1858,7 +1858,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a < b) VIRTUAL + `c` tinyint(1) AS ((`a` < `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1877,7 +1877,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a not between 0 and 2) VIRTUAL + `b` tinyint(1) AS ((`a` not between 0 and 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1895,7 +1895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <> b) VIRTUAL + `c` tinyint(1) AS ((`a` <> `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1915,7 +1915,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a != b) VIRTUAL + `c` tinyint(1) AS ((`a` <> `b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1934,7 +1934,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a>5 || a<3) VIRTUAL + `b` int(11) AS (((`a` > 5) or (`a` < 3))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (4,default); @@ -1951,7 +1951,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a >> 2) VIRTUAL + `b` int(11) AS ((`a` >> 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (8,default); insert into t1 values (3,default); @@ -1968,7 +1968,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a xor 5) VIRTUAL + `b` int(11) AS ((`a` xor 5)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -1990,7 +1990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (adddate(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` + interval 1 month)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2005,7 +2005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (addtime(a,'02:00:00')) VIRTUAL + `b` datetime AS (addtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2020,7 +2020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (convert_tz(a,'MET','UTC')) VIRTUAL + `b` datetime AS (convert_tz(`a`,'MET','UTC')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2035,7 +2035,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_add(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` + interval 1 month)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2050,7 +2050,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(64) AS (date_format(a,'%W %M %D')) VIRTUAL + `b` varchar(64) AS (date_format(`a`,'%W %M %D')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2065,7 +2065,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_sub(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` - interval 1 month)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2080,7 +2080,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date(a)) VIRTUAL + `b` datetime AS (cast(`a` as date)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; @@ -2095,7 +2095,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) AS (datediff(a,'2000-01-01')) VIRTUAL + `b` bigint(20) AS ((to_days(`a`) - to_days('2000-01-01'))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2110,7 +2110,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (day(a)) VIRTUAL + `b` int(11) AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2125,7 +2125,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(10) AS (dayname(a)) VIRTUAL + `b` varchar(10) AS (dayname(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2140,7 +2140,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofmonth(a)) VIRTUAL + `b` int(11) AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2155,7 +2155,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofweek(a)) VIRTUAL + `b` int(11) AS (dayofweek(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2170,7 +2170,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofyear(a)) VIRTUAL + `b` int(11) AS (dayofyear(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2185,7 +2185,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (extract(year from a)) VIRTUAL + `b` int(11) AS (extract(year from `a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2200,7 +2200,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` datetime AS (from_days(a)) VIRTUAL + `b` datetime AS (from_days(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (730669,default); select * from t1; @@ -2215,7 +2215,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` datetime AS (from_unixtime(a)) VIRTUAL + `b` datetime AS (from_unixtime(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1196440219,default); select * from t1; @@ -2230,7 +2230,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(32) AS (date_format(a,get_format(DATE,'EUR'))) VIRTUAL + `b` varchar(32) AS (date_format(`a`,get_format(DATE, 'EUR'))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2245,7 +2245,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` bigint(20) AS (hour(a)) VIRTUAL + `b` bigint(20) AS (hour(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2260,7 +2260,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (last_day(a)) VIRTUAL + `b` datetime AS (last_day(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-05',default); insert into t1 values ('2003-02-32',default); @@ -2279,7 +2279,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` datetime AS (makedate(a,1)) VIRTUAL + `b` datetime AS (makedate(`a`,1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2001,default); select * from t1; @@ -2294,7 +2294,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time AS (maketime(a,1,3)) VIRTUAL + `b` time AS (maketime(`a`,1,3)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -2309,7 +2309,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) AS (microsecond(a)) VIRTUAL + `b` bigint(20) AS (microsecond(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 12:00:00.123456',default); insert into t1 values ('2009-12-31 23:59:59.000010',default); @@ -2326,7 +2326,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (minute(a)) VIRTUAL + `b` int(11) AS (minute(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2341,7 +2341,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (month(a)) VIRTUAL + `b` int(11) AS (month(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2356,7 +2356,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(16) AS (monthname(a)) VIRTUAL + `b` varchar(16) AS (monthname(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2371,7 +2371,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (period_add(a,2)) VIRTUAL + `b` int(11) AS (period_add(`a`,2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (200801,default); select * from t1; @@ -2387,7 +2387,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (period_diff(a,b)) VIRTUAL + `c` int(11) AS (period_diff(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (200802,200703,default); select * from t1; @@ -2402,7 +2402,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (quarter(a)) VIRTUAL + `b` int(11) AS (quarter(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2417,7 +2417,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` time AS (sec_to_time(a)) VIRTUAL + `b` time AS (sec_to_time(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (2378,default); select * from t1; @@ -2432,7 +2432,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (second(a)) VIRTUAL + `b` int(11) AS (second(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2447,7 +2447,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, - `b` datetime AS (str_to_date(a,'%m/%d/%Y')) VIRTUAL + `b` datetime AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('04/30/2004',default); select * from t1; @@ -2462,7 +2462,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subdate(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` - interval 1 month)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2477,7 +2477,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subtime(a,'02:00:00')) VIRTUAL + `b` datetime AS (subtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2492,7 +2492,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(32) AS (time_format(a,'%r')) VIRTUAL + `b` varchar(32) AS (time_format(`a`,'%r')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; @@ -2507,7 +2507,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` bigint(20) AS (time_to_sec(a)) VIRTUAL + `b` bigint(20) AS (time_to_sec(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('22:23:00',default); select * from t1; @@ -2522,7 +2522,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` time AS (time(a)) VIRTUAL + `b` time AS (cast(`a` as time)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; @@ -2538,7 +2538,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` time AS (timediff(a,b)) VIRTUAL + `c` time AS (timediff(`a`,`b`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; @@ -2553,7 +2553,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestamp(a)) VIRTUAL + `b` timestamp AS (cast(`a` as datetime)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31',default); select * from t1; @@ -2568,7 +2568,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL + `b` timestamp AS ((`a` + interval 1 minute)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2003-01-02',default); select * from t1; @@ -2582,8 +2582,8 @@ create table t1 (a timestamp, c bigint generated always as (timestampdiff(MONTH, show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `c` bigint(20) AS (timestampdiff(MONTH, a, a)) VIRTUAL + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `c` bigint(20) AS (timestampdiff(MONTH,`a`,`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-01',default); select * from t1; @@ -2598,7 +2598,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) AS (to_days(a)) VIRTUAL + `b` bigint(20) AS (to_days(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2007-10-07',default); select * from t1; @@ -2613,7 +2613,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (week(a)) VIRTUAL + `b` int(11) AS (week(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2628,7 +2628,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekday(a)) VIRTUAL + `b` int(11) AS (weekday(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2643,7 +2643,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekofyear(a)) VIRTUAL + `b` int(11) AS (week(`a`,3)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2658,7 +2658,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (year(a)) VIRTUAL + `b` int(11) AS (year(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2673,7 +2673,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (yearweek(a)) VIRTUAL + `b` int(11) AS (yearweek(`a`,0)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2695,7 +2695,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` bigint(20) unsigned AS (cast(a as unsigned)) VIRTUAL + `b` bigint(20) unsigned AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2716,7 +2716,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` bigint(20) unsigned AS (convert(a,unsigned)) VIRTUAL + `b` bigint(20) unsigned AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2740,7 +2740,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (ExtractValue(a,'/b')) VIRTUAL + `b` varchar(1024) AS (extractvalue(`a`,'/b')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('<b>text</b>',default); select * from t1; @@ -2759,7 +2759,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (aes_encrypt(aes_decrypt(a,'adf'),'adf')) VIRTUAL + `b` varchar(1024) AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2774,7 +2774,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (bit_count(a)) VIRTUAL + `b` int(11) AS (bit_count(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values (5,default); select * from t1; @@ -2789,7 +2789,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (charset(a)) VIRTUAL + `b` varchar(1024) AS (charset(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2804,7 +2804,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` int(11) AS (coercibility(a)) VIRTUAL + `b` int(11) AS (coercibility(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2819,7 +2819,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (collation(a)) VIRTUAL + `b` varchar(1024) AS (collation(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2834,7 +2834,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (uncompress(compress(a))) VIRTUAL + `b` varchar(1024) AS (uncompress(compress(`a`))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2849,7 +2849,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (decode(encode(a,'abc'),'abc')) VIRTUAL + `b` varchar(1024) AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2864,7 +2864,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', - `b` varchar(1024) AS (ifnull(a,default(a))) VIRTUAL + `b` varchar(1024) AS (ifnull(`a`,default(`a`))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('any value',default); select * from t1; @@ -2878,7 +2878,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (des_encrypt(des_decrypt(a,'adf'),'adf')) VIRTUAL + `b` varchar(1024) AS (des_encrypt(des_decrypt(`a`,'adf'),'adf')) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2893,7 +2893,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (inet_ntoa(inet_aton(a))) VIRTUAL + `b` varchar(1024) AS (inet_ntoa(inet_aton(`a`))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('127.0.0.1',default); select * from t1; @@ -2908,7 +2908,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varbinary(32) AS (md5(a)) VIRTUAL + `b` varbinary(32) AS (md5(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('testing',default); select * from t1; @@ -2923,7 +2923,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (password(a)) VIRTUAL + `b` varchar(1024) AS (password(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('badpwd',default); select * from t1; @@ -2938,7 +2938,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha1(a)) VIRTUAL + `b` varchar(1024) AS (sha(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2953,7 +2953,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha(a)) VIRTUAL + `b` varchar(1024) AS (sha(`a`)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2968,7 +2968,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha2(a,224)) VIRTUAL + `b` varchar(1024) AS (sha2(`a`,224)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2983,7 +2983,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, - `b` varchar(1024) AS (uncompressed_length(compress(repeat(a,30)))) VIRTUAL + `b` varchar(1024) AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 insert into t1 values ('a',default); select * from t1; diff --git a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result index add3a6a3fe0..905645f2972 100644 --- a/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_supported_sql_funcs_myisam.result @@ -10,7 +10,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (abs(a)) VIRTUAL + `b` int(11) AS (abs(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1, default); select * from t1; @@ -25,7 +25,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(acos(a),6)) VIRTUAL + `b` double AS (format(acos(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1, default); insert into t1 values (1.0001,default); @@ -44,7 +44,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(asin(a),6)) VIRTUAL + `b` double AS (format(asin(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0.2, default); insert into t1 values (1.0001,default); @@ -62,7 +62,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan(a,b),6)) VIRTUAL + `c` double AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -78,7 +78,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `c` double AS (format(atan(a),6)) VIRTUAL + `c` double AS (format(atan(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,default); insert into t1 values (format(PI(),6),default); @@ -96,7 +96,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan2(a,b),6)) VIRTUAL + `c` double AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -113,7 +113,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (ceil(a)) VIRTUAL + `b` int(11) AS (ceiling(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -132,7 +132,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (conv(a,b,c)) VIRTUAL + `d` varchar(10) AS (conv(`a`,`b`,`c`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a',16,2,default); insert into t1 values ('6e',18,8,default); @@ -153,7 +153,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cos(a),6)) VIRTUAL + `b` double AS (format(cos(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); select * from t1; @@ -168,7 +168,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cot(a),6)) VIRTUAL + `b` double AS (format(cot(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (12,default); @@ -184,7 +184,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (crc32(a)) VIRTUAL + `b` bigint(20) AS (crc32(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('mysql',default); @@ -201,7 +201,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(degrees(a),6)) VIRTUAL + `b` double AS (format(degrees(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()/2,6),default); @@ -218,7 +218,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a/2) VIRTUAL + `b` double AS ((`a` / 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -233,7 +233,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(exp(a),6)) VIRTUAL + `b` double AS (format(exp(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -252,7 +252,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` bigint(20) AS (floor(a)) VIRTUAL + `b` bigint(20) AS (floor(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -269,7 +269,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(ln(a),6)) VIRTUAL + `b` double AS (format(ln(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -287,7 +287,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(log(a,b),6)) VIRTUAL + `c` double AS (format(log(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,65536,default); insert into t1 values (10,100,default); @@ -305,7 +305,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log(a),6)) VIRTUAL + `b` double AS (format(log(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -322,7 +322,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log2(a),6)) VIRTUAL + `b` double AS (format(log2(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (65536,default); insert into t1 values (-100,default); @@ -339,7 +339,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log10(a),6)) VIRTUAL + `b` double AS (format(log10(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (100,default); @@ -358,7 +358,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a-1) VIRTUAL + `b` double AS ((`a` - 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -373,7 +373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (mod(a,10)) VIRTUAL + `b` int(11) AS ((`a` % 10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -390,7 +390,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 10) VIRTUAL + `b` int(11) AS ((`a` % 10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -407,7 +407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(10) AS (oct(a)) VIRTUAL + `b` varchar(10) AS (conv(`a`,10,8)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -422,7 +422,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(PI()*a*a,6)) VIRTUAL + `b` double AS (format(((pi() * `a`) * `a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -437,7 +437,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -452,8 +452,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (pow(a,2)) VIRTUAL, - `c` int(11) AS (power(a,2)) VIRTUAL + `b` int(11) AS (pow(`a`,2)) VIRTUAL, + `c` int(11) AS (pow(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default,default); insert into t1 values (2,default,default); @@ -470,7 +470,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(radians(a),6)) VIRTUAL + `b` double AS (format(radians(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (90,default); select * from t1; @@ -485,7 +485,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (round(a)) VIRTUAL + `b` int(11) AS (round(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1.23,default); insert into t1 values (-1.58,default); @@ -504,7 +504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` int(11) AS (round(a,b)) VIRTUAL + `c` int(11) AS (round(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.298,1,default); insert into t1 values (1.298,0,default); @@ -523,7 +523,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (sign(a)) VIRTUAL + `b` int(11) AS (sign(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-32,default); insert into t1 values (0,default); @@ -542,7 +542,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sin(a),6)) VIRTUAL + `b` double AS (format(sin(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI()/2,6),default); select * from t1; @@ -557,7 +557,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sqrt(a),6)) VIRTUAL + `b` double AS (format(sqrt(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (4,default); insert into t1 values (20,default); @@ -576,7 +576,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(tan(a),6)) VIRTUAL + `b` double AS (format(tan(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()+1,6),default); @@ -593,7 +593,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a*3) VIRTUAL + `b` double AS ((`a` * 3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -612,7 +612,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (truncate(a,4)) VIRTUAL + `b` double AS (truncate(`a`,4)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.223,default); insert into t1 values (1.999,default); @@ -633,7 +633,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (-a) VIRTUAL + `b` double AS (-(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -653,7 +653,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, - `b` int(11) AS (ascii(a)) VIRTUAL + `b` int(11) AS (ascii(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2',default); insert into t1 values (2,default); @@ -672,7 +672,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (bin(a)) VIRTUAL + `b` varchar(10) AS (conv(`a`,10,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -687,7 +687,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (bit_length(a)) VIRTUAL + `b` bigint(20) AS (bit_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -702,7 +702,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (char_length(a)) VIRTUAL + `b` bigint(20) AS (char_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -718,7 +718,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` varbinary(10) AS (char(a,b)) VIRTUAL + `c` varbinary(10) AS (char(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (77,121,default); select * from t1; @@ -733,7 +733,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (character_length(a)) VIRTUAL + `b` bigint(20) AS (char_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -749,7 +749,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat_ws(',',a,b)) VIRTUAL + `c` varchar(20) AS (concat_ws(',',`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -765,7 +765,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat(a,',',b)) VIRTUAL + `c` varchar(20) AS (concat(`a`,',',`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -782,7 +782,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (elt(c,a,b)) VIRTUAL + `d` varchar(10) AS (elt(`c`,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',1,default); insert into t1 values ('value1','value2',2,default); @@ -799,7 +799,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (export_set(a,'1','0','',10)) VIRTUAL + `b` varchar(10) AS (export_set(`a`,'1','0','',10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (6,default); select * from t1; @@ -815,7 +815,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (field('aa',a,b)) VIRTUAL + `c` int(11) AS (field('aa',`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('aa','bb',default); insert into t1 values ('bb','aa',default); @@ -833,7 +833,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (find_in_set(a,b)) VIRTUAL + `c` int(11) AS (find_in_set(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('aa','aa,bb,cc',default); insert into t1 values ('aa','bb,aa,cc',default); @@ -850,7 +850,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(20) AS (format(a,2)) VIRTUAL + `b` varchar(20) AS (format(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12332.123456,default); select * from t1; @@ -865,7 +865,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) AS (hex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (17,default); select * from t1; @@ -879,7 +879,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) AS (hex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -895,7 +895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (insert(a,length(a),length(b),b)) VIRTUAL + `c` varchar(20) AS (insert(`a`,length(`a`),length(`b`),`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('start,','end',default); select * from t1; @@ -911,7 +911,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (instr(a,b)) VIRTUAL + `c` int(11) AS (locate(`b`,`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar,','bar',default); insert into t1 values ('xbar,','foobar',default); @@ -928,7 +928,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lcase(a)) VIRTUAL + `b` varchar(10) AS (lcase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -943,7 +943,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(5) AS (left(a,5)) VIRTUAL + `b` varchar(5) AS (left(`a`,5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -958,7 +958,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (length(a)) VIRTUAL + `b` int(11) AS (length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -973,7 +973,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%o') VIRTUAL + `b` tinyint(1) AS ((`a` like 'H%o')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -990,7 +990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (locate('bar',a)) VIRTUAL + `b` varchar(10) AS (locate('bar',`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1005,7 +1005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lower(a)) VIRTUAL + `b` varchar(10) AS (lcase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1020,7 +1020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lpad(a,4,' ')) VIRTUAL + `b` varchar(10) AS (lpad(`a`,4,' ')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('M',default); @@ -1037,7 +1037,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (ltrim(a)) VIRTUAL + `b` varchar(10) AS (ltrim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (' MySQL',default); insert into t1 values ('MySQL',default); @@ -1056,7 +1056,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(30) AS (make_set(c,a,b)) VIRTUAL + `d` varchar(30) AS (make_set(`c`,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',1,default); insert into t1 values ('a','b',3,default); @@ -1073,7 +1073,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (mid(a,1,2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,1,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1088,7 +1088,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not like 'H%o') VIRTUAL + `b` tinyint(1) AS ((not((`a` like 'H%o')))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1105,7 +1105,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not regexp 'H.+o') VIRTUAL + `b` tinyint(1) AS ((not((`a` regexp 'H.+o')))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1122,7 +1122,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (octet_length(a)) VIRTUAL + `b` int(11) AS (length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -1137,7 +1137,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` bigint(20) AS (ord(a)) VIRTUAL + `b` bigint(20) AS (ord(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2',default); select * from t1; @@ -1152,7 +1152,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (position('bar' in a)) VIRTUAL + `b` varchar(10) AS (locate('bar',`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1167,7 +1167,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (quote(a)) VIRTUAL + `b` varchar(10) AS (quote(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Don\'t',default); select * from t1; @@ -1182,7 +1182,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a regexp 'H.+o') VIRTUAL + `b` tinyint(1) AS ((`a` regexp 'H.+o')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1199,7 +1199,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (repeat(a,3)) VIRTUAL + `b` varchar(30) AS (repeat(`a`,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1214,7 +1214,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (replace(a,'aa','bb')) VIRTUAL + `b` varchar(30) AS (replace(`a`,'aa','bb')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1229,7 +1229,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (reverse(a)) VIRTUAL + `b` varchar(30) AS (reverse(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1244,7 +1244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (right(a,4)) VIRTUAL + `b` varchar(10) AS (right(`a`,4)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1259,7 +1259,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a rlike 'H.+o') VIRTUAL + `b` tinyint(1) AS ((`a` regexp 'H.+o')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1276,7 +1276,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rpad(a,4,'??')) VIRTUAL + `b` varchar(10) AS (rpad(`a`,4,'??')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('He',default); select * from t1; @@ -1291,7 +1291,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rtrim(a)) VIRTUAL + `b` varchar(10) AS (rtrim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello ',default); select * from t1; @@ -1306,7 +1306,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) AS (soundex(a)) VIRTUAL + `b` varchar(20) AS (soundex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1322,7 +1322,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a sounds like b) VIRTUAL + `c` tinyint(1) AS ((soundex(`a`) = soundex(`b`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello',default); insert into t1 values ('Hello','MySQL',default); @@ -1341,7 +1341,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (concat(a,space(5))) VIRTUAL + `b` varchar(10) AS (concat(`a`,space(5))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello', default); select * from t1; @@ -1357,7 +1357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, - `c` tinyint(1) AS (strcmp(a,b)) VIRTUAL + `c` tinyint(1) AS (strcmp(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello', default); insert into t1 values ('Hello','Hello1', default); @@ -1374,7 +1374,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substr(a,2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1389,7 +1389,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (substring_index(a,'.',2)) VIRTUAL + `b` varchar(10) AS (substring_index(`a`,'.',2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('www.mysql.com',default); select * from t1; @@ -1404,7 +1404,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substring(a from 2 for 2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,2,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1419,7 +1419,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (trim(a)) VIRTUAL + `b` varchar(10) AS (trim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (' aa ',default); select * from t1; @@ -1434,7 +1434,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (ucase(a)) VIRTUAL + `b` varchar(10) AS (ucase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1449,7 +1449,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (unhex(a)) VIRTUAL + `b` varchar(10) AS (unhex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('4D7953514C',default); select * from t1; @@ -1464,7 +1464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (upper(a)) VIRTUAL + `b` varchar(10) AS (ucase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1479,7 +1479,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (weight_string(a as char(4))) VIRTUAL + `b` varchar(10) AS (weight_string(`a`,0,4,65)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1497,7 +1497,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(16) AS (case a when NULL then 'asd' when 'b' then 'B' else a end) VIRTUAL + `b` varchar(16) AS ((case `a` when NULL then 'asd' when 'b' then 'B' else `a` end)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL,default); insert into t1 values ('b',default); @@ -1517,7 +1517,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (if(a=1,a,b)) VIRTUAL + `c` int(11) AS (if((`a` = 1),`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,2,default); insert into t1 values (3,4,default); @@ -1535,7 +1535,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(10) AS (ifnull(a,'DEFAULT')) VIRTUAL + `c` varchar(10) AS (ifnull(`a`,'DEFAULT')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL,'adf',default); insert into t1 values ('a','adf',default); @@ -1552,7 +1552,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (nullif(a,'DEFAULT')) VIRTUAL + `b` varchar(10) AS (nullif(`a`,'DEFAULT')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('DEFAULT',default); insert into t1 values ('a',default); @@ -1572,7 +1572,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a>0 && a<2) VIRTUAL + `b` tinyint(1) AS (((`a` > 0) and (`a` < 2))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1589,7 +1589,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a between 0 and 2) VIRTUAL + `b` tinyint(1) AS ((`a` between 0 and 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1606,7 +1606,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varbinary(10) AS (binary a) VIRTUAL + `b` varbinary(10) AS (cast(`a` as char charset binary)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('11',default); insert into t1 values (1,default); @@ -1623,7 +1623,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a & 5) VIRTUAL + `b` int(11) AS ((`a` & 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1640,7 +1640,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (~a) VIRTUAL + `b` int(11) AS (~(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); Warnings: @@ -1657,7 +1657,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a | 5) VIRTUAL + `b` int(11) AS ((`a` | 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1676,7 +1676,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a ^ 5) VIRTUAL + `b` int(11) AS ((`a` ^ 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1695,7 +1695,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a div 5) VIRTUAL + `b` int(11) AS ((`a` DIV 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (7,default); @@ -1713,7 +1713,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` tinyint(1) AS (a <=> b) VIRTUAL + `c` tinyint(1) AS ((`a` <=> `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,1,default); insert into t1 values (NULL,NULL,default); @@ -1733,7 +1733,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a=b) VIRTUAL + `c` tinyint(1) AS ((`a` = `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1751,7 +1751,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a >= b) VIRTUAL + `c` tinyint(1) AS ((`a` >= `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1769,7 +1769,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a > b) VIRTUAL + `c` tinyint(1) AS ((`a` > `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1786,7 +1786,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is not null) VIRTUAL + `b` tinyint(1) AS ((`a` is not null)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1803,7 +1803,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is null) VIRTUAL + `b` tinyint(1) AS (isnull(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1820,7 +1820,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a << 2) VIRTUAL + `b` int(11) AS ((`a` << 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (3,default); @@ -1838,7 +1838,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <= b) VIRTUAL + `c` tinyint(1) AS ((`a` <= `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1858,7 +1858,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a < b) VIRTUAL + `c` tinyint(1) AS ((`a` < `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1877,7 +1877,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a not between 0 and 2) VIRTUAL + `b` tinyint(1) AS ((`a` not between 0 and 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1895,7 +1895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <> b) VIRTUAL + `c` tinyint(1) AS ((`a` <> `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1915,7 +1915,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a != b) VIRTUAL + `c` tinyint(1) AS ((`a` <> `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1934,7 +1934,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a>5 || a<3) VIRTUAL + `b` int(11) AS (((`a` > 5) or (`a` < 3))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (4,default); @@ -1951,7 +1951,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a >> 2) VIRTUAL + `b` int(11) AS ((`a` >> 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (8,default); insert into t1 values (3,default); @@ -1968,7 +1968,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a xor 5) VIRTUAL + `b` int(11) AS ((`a` xor 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -1990,7 +1990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (adddate(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` + interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2005,7 +2005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (addtime(a,'02:00:00')) VIRTUAL + `b` datetime AS (addtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2020,7 +2020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (convert_tz(a,'MET','UTC')) VIRTUAL + `b` datetime AS (convert_tz(`a`,'MET','UTC')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2035,7 +2035,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_add(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` + interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2050,7 +2050,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(64) AS (date_format(a,'%W %M %D')) VIRTUAL + `b` varchar(64) AS (date_format(`a`,'%W %M %D')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2065,7 +2065,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_sub(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` - interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2080,7 +2080,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date(a)) VIRTUAL + `b` datetime AS (cast(`a` as date)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; @@ -2095,7 +2095,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) AS (datediff(a,'2000-01-01')) VIRTUAL + `b` bigint(20) AS ((to_days(`a`) - to_days('2000-01-01'))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2110,7 +2110,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (day(a)) VIRTUAL + `b` int(11) AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2125,7 +2125,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(10) AS (dayname(a)) VIRTUAL + `b` varchar(10) AS (dayname(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2140,7 +2140,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofmonth(a)) VIRTUAL + `b` int(11) AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2155,7 +2155,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofweek(a)) VIRTUAL + `b` int(11) AS (dayofweek(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2170,7 +2170,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofyear(a)) VIRTUAL + `b` int(11) AS (dayofyear(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2185,7 +2185,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (extract(year from a)) VIRTUAL + `b` int(11) AS (extract(year from `a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2200,7 +2200,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` datetime AS (from_days(a)) VIRTUAL + `b` datetime AS (from_days(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (730669,default); select * from t1; @@ -2215,7 +2215,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` datetime AS (from_unixtime(a)) VIRTUAL + `b` datetime AS (from_unixtime(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1196440219,default); select * from t1; @@ -2230,7 +2230,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(32) AS (date_format(a,get_format(DATE,'EUR'))) VIRTUAL + `b` varchar(32) AS (date_format(`a`,get_format(DATE, 'EUR'))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2245,7 +2245,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` bigint(20) AS (hour(a)) VIRTUAL + `b` bigint(20) AS (hour(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2260,7 +2260,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (last_day(a)) VIRTUAL + `b` datetime AS (last_day(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-05',default); insert into t1 values ('2003-02-32',default); @@ -2279,7 +2279,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` datetime AS (makedate(a,1)) VIRTUAL + `b` datetime AS (makedate(`a`,1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2001,default); select * from t1; @@ -2294,7 +2294,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time AS (maketime(a,1,3)) VIRTUAL + `b` time AS (maketime(`a`,1,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -2309,7 +2309,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) AS (microsecond(a)) VIRTUAL + `b` bigint(20) AS (microsecond(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 12:00:00.123456',default); insert into t1 values ('2009-12-31 23:59:59.000010',default); @@ -2326,7 +2326,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (minute(a)) VIRTUAL + `b` int(11) AS (minute(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2341,7 +2341,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (month(a)) VIRTUAL + `b` int(11) AS (month(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2356,7 +2356,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(16) AS (monthname(a)) VIRTUAL + `b` varchar(16) AS (monthname(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2371,7 +2371,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (period_add(a,2)) VIRTUAL + `b` int(11) AS (period_add(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (200801,default); select * from t1; @@ -2387,7 +2387,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (period_diff(a,b)) VIRTUAL + `c` int(11) AS (period_diff(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (200802,200703,default); select * from t1; @@ -2402,7 +2402,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (quarter(a)) VIRTUAL + `b` int(11) AS (quarter(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2417,7 +2417,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` time AS (sec_to_time(a)) VIRTUAL + `b` time AS (sec_to_time(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2378,default); select * from t1; @@ -2432,7 +2432,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (second(a)) VIRTUAL + `b` int(11) AS (second(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2447,7 +2447,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, - `b` datetime AS (str_to_date(a,'%m/%d/%Y')) VIRTUAL + `b` datetime AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('04/30/2004',default); select * from t1; @@ -2462,7 +2462,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subdate(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` - interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2477,7 +2477,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subtime(a,'02:00:00')) VIRTUAL + `b` datetime AS (subtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2492,7 +2492,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(32) AS (time_format(a,'%r')) VIRTUAL + `b` varchar(32) AS (time_format(`a`,'%r')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; @@ -2507,7 +2507,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` bigint(20) AS (time_to_sec(a)) VIRTUAL + `b` bigint(20) AS (time_to_sec(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('22:23:00',default); select * from t1; @@ -2522,7 +2522,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` time AS (time(a)) VIRTUAL + `b` time AS (cast(`a` as time)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; @@ -2538,7 +2538,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` time AS (timediff(a,b)) VIRTUAL + `c` time AS (timediff(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; @@ -2553,7 +2553,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestamp(a)) VIRTUAL + `b` timestamp AS (cast(`a` as datetime)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31',default); select * from t1; @@ -2568,7 +2568,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL + `b` timestamp AS ((`a` + interval 1 minute)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-01-02',default); select * from t1; @@ -2582,8 +2582,8 @@ create table t1 (a timestamp, c bigint generated always as (timestampdiff(MONTH, show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `c` bigint(20) AS (timestampdiff(MONTH, a, a)) VIRTUAL + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `c` bigint(20) AS (timestampdiff(MONTH,`a`,`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-01',default); select * from t1; @@ -2598,7 +2598,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` bigint(20) AS (to_days(a)) VIRTUAL + `b` bigint(20) AS (to_days(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2007-10-07',default); select * from t1; @@ -2613,7 +2613,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (week(a)) VIRTUAL + `b` int(11) AS (week(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2628,7 +2628,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekday(a)) VIRTUAL + `b` int(11) AS (weekday(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2643,7 +2643,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekofyear(a)) VIRTUAL + `b` int(11) AS (week(`a`,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2658,7 +2658,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (year(a)) VIRTUAL + `b` int(11) AS (year(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2673,7 +2673,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (yearweek(a)) VIRTUAL + `b` int(11) AS (yearweek(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2695,7 +2695,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` bigint(20) unsigned AS (cast(a as unsigned)) VIRTUAL + `b` bigint(20) unsigned AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2716,7 +2716,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` bigint(20) unsigned AS (convert(a,unsigned)) VIRTUAL + `b` bigint(20) unsigned AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2740,7 +2740,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (ExtractValue(a,'/b')) VIRTUAL + `b` varchar(1024) AS (extractvalue(`a`,'/b')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('<b>text</b>',default); select * from t1; @@ -2759,7 +2759,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (aes_encrypt(aes_decrypt(a,'adf'),'adf')) VIRTUAL + `b` varchar(1024) AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2774,7 +2774,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (bit_count(a)) VIRTUAL + `b` int(11) AS (bit_count(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (5,default); select * from t1; @@ -2789,7 +2789,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (charset(a)) VIRTUAL + `b` varchar(1024) AS (charset(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2804,7 +2804,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` int(11) AS (coercibility(a)) VIRTUAL + `b` int(11) AS (coercibility(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2819,7 +2819,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (collation(a)) VIRTUAL + `b` varchar(1024) AS (collation(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2834,7 +2834,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (uncompress(compress(a))) VIRTUAL + `b` varchar(1024) AS (uncompress(compress(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2849,7 +2849,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (decode(encode(a,'abc'),'abc')) VIRTUAL + `b` varchar(1024) AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2864,7 +2864,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', - `b` varchar(1024) AS (ifnull(a,default(a))) VIRTUAL + `b` varchar(1024) AS (ifnull(`a`,default(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('any value',default); select * from t1; @@ -2878,7 +2878,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (des_encrypt(des_decrypt(a,'adf'),'adf')) VIRTUAL + `b` varchar(1024) AS (des_encrypt(des_decrypt(`a`,'adf'),'adf')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2893,7 +2893,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (inet_ntoa(inet_aton(a))) VIRTUAL + `b` varchar(1024) AS (inet_ntoa(inet_aton(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('127.0.0.1',default); select * from t1; @@ -2908,7 +2908,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varbinary(32) AS (md5(a)) VIRTUAL + `b` varbinary(32) AS (md5(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('testing',default); select * from t1; @@ -2923,7 +2923,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (password(a)) VIRTUAL + `b` varchar(1024) AS (password(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('badpwd',default); select * from t1; @@ -2938,7 +2938,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha1(a)) VIRTUAL + `b` varchar(1024) AS (sha(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2953,7 +2953,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha(a)) VIRTUAL + `b` varchar(1024) AS (sha(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2968,7 +2968,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha2(a,224)) VIRTUAL + `b` varchar(1024) AS (sha2(`a`,224)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2983,7 +2983,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, - `b` varchar(1024) AS (uncompressed_length(compress(repeat(a,30)))) VIRTUAL + `b` varchar(1024) AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a',default); select * from t1; diff --git a/mysql-test/suite/gcol/r/rpl_gcol.result b/mysql-test/suite/gcol/r/rpl_gcol.result index 245ce3ba2e5..3174858faa6 100644 --- a/mysql-test/suite/gcol/r/rpl_gcol.result +++ b/mysql-test/suite/gcol/r/rpl_gcol.result @@ -7,7 +7,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (2,default); diff --git a/mysql-test/suite/innodb/r/innodb-virtual-columns.result b/mysql-test/suite/innodb/r/innodb-virtual-columns.result index 9837f567954..b28c411fcc5 100644 --- a/mysql-test/suite/innodb/r/innodb-virtual-columns.result +++ b/mysql-test/suite/innodb/r/innodb-virtual-columns.result @@ -30,11 +30,7 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, + `ofis_deg_status` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed' else 'Not Completed' end)) VIRTUAL, `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) @@ -140,46 +136,14 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, - `ofis_deg_status2` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress2' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' - ELSE 'Not Completed2' - END) VIRTUAL, - `ofis_deg_status3` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress3' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' - ELSE 'Not Completed3' - END) VIRTUAL, - `ofis_deg_status4` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress4' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' - ELSE 'Not Completed4' - END) VIRTUAL, - `ofis_deg_status5` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress5' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' - ELSE 'Not Completed5' - END) VIRTUAL, - `ofis_deg_status6` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress6' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' - ELSE 'Not Completed6' - END) VIRTUAL, - `ofis_deg_status7` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress7' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' - ELSE 'Not Completed7' - END) VIRTUAL, - `ofis_deg_status8` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress8' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' - ELSE 'Not Completed8' - END) VIRTUAL, + `ofis_deg_status` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed' else 'Not Completed' end)) VIRTUAL, + `ofis_deg_status2` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress2' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed2' else 'Not Completed2' end)) VIRTUAL, + `ofis_deg_status3` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress3' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed3' else 'Not Completed3' end)) VIRTUAL, + `ofis_deg_status4` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress4' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed4' else 'Not Completed4' end)) VIRTUAL, + `ofis_deg_status5` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress5' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed5' else 'Not Completed5' end)) VIRTUAL, + `ofis_deg_status6` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress6' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed6' else 'Not Completed6' end)) VIRTUAL, + `ofis_deg_status7` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress7' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed7' else 'Not Completed7' end)) VIRTUAL, + `ofis_deg_status8` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress8' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed8' else 'Not Completed8' end)) VIRTUAL, `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) @@ -229,46 +193,14 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, - `ofis_deg_status2` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress2' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' - ELSE 'Not Completed2' - END) VIRTUAL, - `ofis_deg_status3` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress3' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' - ELSE 'Not Completed3' - END) VIRTUAL, - `ofis_deg_status4` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress4' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' - ELSE 'Not Completed4' - END) VIRTUAL, - `ofis_deg_status5` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress5' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' - ELSE 'Not Completed5' - END) VIRTUAL, - `ofis_deg_status6` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress6' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' - ELSE 'Not Completed6' - END) VIRTUAL, - `ofis_deg_status7` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress7' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' - ELSE 'Not Completed7' - END) VIRTUAL, - `ofis_deg_status8` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress8' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' - ELSE 'Not Completed8' - END) VIRTUAL, + `ofis_deg_status` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed' else 'Not Completed' end)) VIRTUAL, + `ofis_deg_status2` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress2' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed2' else 'Not Completed2' end)) VIRTUAL, + `ofis_deg_status3` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress3' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed3' else 'Not Completed3' end)) VIRTUAL, + `ofis_deg_status4` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress4' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed4' else 'Not Completed4' end)) VIRTUAL, + `ofis_deg_status5` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress5' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed5' else 'Not Completed5' end)) VIRTUAL, + `ofis_deg_status6` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress6' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed6' else 'Not Completed6' end)) VIRTUAL, + `ofis_deg_status7` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress7' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed7' else 'Not Completed7' end)) VIRTUAL, + `ofis_deg_status8` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress8' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed8' else 'Not Completed8' end)) VIRTUAL, `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`), KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`) @@ -338,46 +270,14 @@ grad_degree CREATE TABLE `grad_degree` ( `plan` varchar(10) NOT NULL, `admit_term` char(4) NOT NULL, `wdraw_rsn` varchar(4) NOT NULL DEFAULT '', - `ofis_deg_status` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed' - ELSE 'Not Completed' - END) VIRTUAL, - `ofis_deg_status2` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress2' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed2' - ELSE 'Not Completed2' - END) VIRTUAL, - `ofis_deg_status3` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress3' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed3' - ELSE 'Not Completed3' - END) VIRTUAL, - `ofis_deg_status4` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress4' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed4' - ELSE 'Not Completed4' - END) VIRTUAL, - `ofis_deg_status5` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress5' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed5' - ELSE 'Not Completed5' - END) VIRTUAL, - `ofis_deg_status6` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress6' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed6' - ELSE 'Not Completed6' - END) VIRTUAL, - `ofis_deg_status7` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress7' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed7' - ELSE 'Not Completed7' - END) VIRTUAL, - `ofis_deg_status8` varchar(15) AS (CASE -WHEN wdraw_rsn = '' THEN 'In progress8' - WHEN wdraw_rsn = 'DCMP' OR wdraw_rsn = 'TRDC' THEN 'Completed8' - ELSE 'Not Completed8' - END) VIRTUAL, + `ofis_deg_status` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed' else 'Not Completed' end)) VIRTUAL, + `ofis_deg_status2` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress2' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed2' else 'Not Completed2' end)) VIRTUAL, + `ofis_deg_status3` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress3' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed3' else 'Not Completed3' end)) VIRTUAL, + `ofis_deg_status4` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress4' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed4' else 'Not Completed4' end)) VIRTUAL, + `ofis_deg_status5` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress5' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed5' else 'Not Completed5' end)) VIRTUAL, + `ofis_deg_status6` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress6' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed6' else 'Not Completed6' end)) VIRTUAL, + `ofis_deg_status7` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress7' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed7' else 'Not Completed7' end)) VIRTUAL, + `ofis_deg_status8` varchar(15) AS ((case when (`wdraw_rsn` = '') then 'In progress8' when ((`wdraw_rsn` = 'DCMP') or (`wdraw_rsn` = 'TRDC')) then 'Completed8' else 'Not Completed8' end)) VIRTUAL, `deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data', `deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term', PRIMARY KEY (`student_id`,`plan`,`admit_term`) diff --git a/mysql-test/suite/parts/r/partition_datetime_innodb.result b/mysql-test/suite/parts/r/partition_datetime_innodb.result index ced3a1d0b25..0c7b47edcda 100644 --- a/mysql-test/suite/parts/r/partition_datetime_innodb.result +++ b/mysql-test/suite/parts/r/partition_datetime_innodb.result @@ -7,7 +7,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY (a) @@ -37,7 +37,7 @@ partition by key (a) partitions 12; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY (a) diff --git a/mysql-test/suite/parts/r/partition_datetime_myisam.result b/mysql-test/suite/parts/r/partition_datetime_myisam.result index 7939df21d67..40efba9d984 100644 --- a/mysql-test/suite/parts/r/partition_datetime_myisam.result +++ b/mysql-test/suite/parts/r/partition_datetime_myisam.result @@ -7,7 +7,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) @@ -37,7 +37,7 @@ partition by key (a) partitions 12; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) diff --git a/mysql-test/suite/rpl/r/rpl_default.result b/mysql-test/suite/rpl/r/rpl_default.result index a1629b99bb3..3195046a42d 100644 --- a/mysql-test/suite/rpl/r/rpl_default.result +++ b/mysql-test/suite/rpl/r/rpl_default.result @@ -8,7 +8,7 @@ connection slave; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` int(11) DEFAULT (1+1), + `a` int(11) DEFAULT ((1 + 1)), `b` bigint(20) DEFAULT uuid_short(), `u` blob DEFAULT user() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result index 815c2599a65..a07bac9340c 100644 --- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result @@ -675,7 +675,7 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, `c6` int(11) DEFAULT 1, - `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY (c1) diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result index 0d249834e70..280afed0385 100644 --- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result @@ -675,7 +675,7 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, `c6` int(11) DEFAULT 1, - `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (c1) diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result index 075cbc14fe7..a000384909c 100644 --- a/mysql-test/suite/rpl/r/rpl_multi_engine.result +++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result @@ -21,7 +21,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection slave; @@ -38,7 +38,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection master; @@ -80,7 +80,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection master; @@ -122,7 +122,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection master; @@ -164,7 +164,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection slave; @@ -181,7 +181,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection master; @@ -223,7 +223,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection master; @@ -265,7 +265,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection master; @@ -307,7 +307,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection slave; @@ -324,7 +324,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection master; @@ -366,7 +366,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 connection master; @@ -408,7 +408,7 @@ t1 CREATE TABLE `t1` ( `f` float DEFAULT 0, `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, - `t` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`) ) ENGINE=MEMORY DEFAULT CHARSET=latin1 connection master; diff --git a/mysql-test/suite/rpl/r/rpl_partition_innodb.result b/mysql-test/suite/rpl/r/rpl_partition_innodb.result index 4494b757291..4657ed7dde5 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_partition_innodb.result @@ -55,7 +55,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -69,7 +69,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,7 +99,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -113,7 +113,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/mysql-test/suite/rpl/r/rpl_partition_memory.result b/mysql-test/suite/rpl/r/rpl_partition_memory.result index 6073352210d..1d57c48ad78 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_memory.result +++ b/mysql-test/suite/rpl/r/rpl_partition_memory.result @@ -55,7 +55,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -69,7 +69,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,7 +99,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -113,7 +113,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/mysql-test/suite/rpl/r/rpl_partition_myisam.result b/mysql-test/suite/rpl/r/rpl_partition_myisam.result index 8d6cd8e3b77..42ad10c8cf1 100644 --- a/mysql-test/suite/rpl/r/rpl_partition_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_partition_myisam.result @@ -55,7 +55,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -69,7 +69,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,7 +99,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -113,7 +113,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result index 41b3ca9d6fe..ac0a419b7e5 100644 --- a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result +++ b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb.result @@ -12,14 +12,14 @@ Table Create Table mysql050614_temporal0 CREATE TABLE `mysql050614_temporal0` ( `a` time DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE mysql050614_temporal1; Table Create Table mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` ( `a` time(1) DEFAULT NULL, `b` datetime(1) DEFAULT NULL, - `c` timestamp(1) NOT NULL DEFAULT CURRENT_TIMESTAMP(1) ON UPDATE CURRENT_TIMESTAMP(1) + `c` timestamp(1) NOT NULL DEFAULT current_timestamp(1) ON UPDATE current_timestamp(1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection slave; SELECT @@mysql56_temporal_format; diff --git a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result index 2e3af3367ff..ace11d5bd6e 100644 --- a/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result +++ b/mysql-test/suite/rpl/r/rpl_temporal_mysql56_to_mariadb53.result @@ -15,14 +15,14 @@ Table Create Table mysql050614_temporal0 CREATE TABLE `mysql050614_temporal0` ( `a` time DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `c` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW CREATE TABLE mysql050614_temporal1; Table Create Table mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` ( `a` time(1) DEFAULT NULL, `b` datetime(1) DEFAULT NULL, - `c` timestamp(1) NOT NULL DEFAULT CURRENT_TIMESTAMP(1) ON UPDATE CURRENT_TIMESTAMP(1) + `c` timestamp(1) NOT NULL DEFAULT current_timestamp(1) ON UPDATE current_timestamp(1) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 connection slave; SELECT @@mysql56_temporal_format; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result index cdf612e6db8..f214e6d7dac 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_off.result @@ -2,7 +2,7 @@ CREATE TABLE t1 (a TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL); @@ -32,7 +32,7 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL); @@ -60,7 +60,7 @@ CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -81,14 +81,14 @@ CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -96,7 +96,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -104,7 +104,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -112,7 +112,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00'); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -120,7 +120,7 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00') SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; @@ -128,39 +128,39 @@ CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `i` int(1) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 (b TIMESTAMP) AS SELECT a FROM t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; @@ -170,6 +170,6 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result index 1c42da57bfc..5219fd4e9c4 100644 --- a/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result +++ b/mysql-test/suite/sys_vars/r/explicit_defaults_for_timestamp_on.result @@ -37,7 +37,7 @@ CREATE TABLE t1 (a TIMESTAMP DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT NULL); @@ -65,7 +65,7 @@ CREATE TABLE t1 (a TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -86,7 +86,7 @@ CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `a` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL); @@ -134,7 +134,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, - `b` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP); @@ -142,7 +142,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, - `b` timestamp NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP); @@ -150,7 +150,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NULL DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + `b` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP) AS SELECT 1 AS i; diff --git a/mysql-test/suite/vcol/r/delayed.result b/mysql-test/suite/vcol/r/delayed.result new file mode 100644 index 00000000000..ba3ac5c1c65 --- /dev/null +++ b/mysql-test/suite/vcol/r/delayed.result @@ -0,0 +1,7 @@ +create table t (a int primary key, b int, c int as (b), index (c)); +insert t (a,b) values (10,1); +replace delayed t (a,b) values (10,5); +check table t; +Table Op Msg_type Msg_text +test.t check status OK +drop table t; diff --git a/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result b/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result index 934a84cc3cc..7bad8e9f6d4 100644 --- a/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result +++ b/mysql-test/suite/vcol/r/innodb_autoinc_vcol.result @@ -9,7 +9,7 @@ alter table t1 auto_increment = 3; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c2` int(11) AS (1+1) VIRTUAL, + `c2` int(11) AS ((1 + 1)) VIRTUAL, `c1` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`c1`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 diff --git a/mysql-test/suite/vcol/r/rpl_vcol.result b/mysql-test/suite/vcol/r/rpl_vcol.result index a20719ad813..2ec225b0ff6 100644 --- a/mysql-test/suite/vcol/r/rpl_vcol.result +++ b/mysql-test/suite/vcol/r/rpl_vcol.result @@ -7,7 +7,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (2,default); diff --git a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result index dd580c344b0..6605f7c99b4 100644 --- a/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result +++ b/mysql-test/suite/vcol/r/vcol_blocked_sql_funcs.result @@ -21,25 +21,25 @@ create or replace table t1 (a datetime as (current_time()) PERSISTENT); ERROR HY000: Function or expression 'curtime()' cannot be used in the GENERATED ALWAYS AS clause of `a` # CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP create or replace table t1 (a datetime as (current_timestamp()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `a` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `a` create or replace table t1 (a datetime as (current_timestamp) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `a` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `a` # CURTIME() create or replace table t1 (a datetime as (curtime()) PERSISTENT); ERROR HY000: Function or expression 'curtime()' cannot be used in the GENERATED ALWAYS AS clause of `a` # LOCALTIME(), LOCALTIME create or replace table t1 (a datetime, b varchar(10) as (localtime()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` create or replace table t1 (a datetime, b varchar(10) as (localtime) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # LOCALTIMESTAMP, LOCALTIMESTAMP()(v4.0.6) create or replace table t1 (a datetime, b varchar(10) as (localtimestamp()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` create or replace table t1 (a datetime, b varchar(10) as (localtimestamp) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # NOW() create or replace table t1 (a datetime, b varchar(10) as (now()) PERSISTENT); -ERROR HY000: Function or expression 'now()' cannot be used in the GENERATED ALWAYS AS clause of `b` +ERROR HY000: Function or expression 'current_timestamp()' cannot be used in the GENERATED ALWAYS AS clause of `b` # SYSDATE() create or replace table t1 (a int, b varchar(10) as (sysdate()) PERSISTENT); ERROR HY000: Function or expression 'sysdate()' cannot be used in the GENERATED ALWAYS AS clause of `b` @@ -242,7 +242,7 @@ drop function sub1; create or replace table t1 (a int, b varchar(300) as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'))); drop table t1; create or replace table t1 (a int, b varchar(16384) as (concat(a,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'))); -ERROR HY000: Table definition is too large +ERROR HY000: Expression in the GENERATED ALWAYS AS clause is too big # # Constant expression create or replace table t1 (a int as (PI()) PERSISTENT); diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result index e66c2d3a3c3..42b852a7c6c 100644 --- a/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_column_def_options_innodb.result @@ -54,7 +54,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -67,7 +67,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -87,7 +87,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t2; Field Type Null Key Default Extra @@ -109,7 +109,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -131,7 +131,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int as (a % 2)); @@ -141,6 +141,6 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result index d60a3cf1a51..7af1d35b67f 100644 --- a/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_column_def_options_myisam.result @@ -54,7 +54,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -67,7 +67,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -87,7 +87,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL COMMENT 'my comment' + `b` int(11) AS ((`a` % 2)) VIRTUAL COMMENT 'my comment' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t2; Field Type Null Key Default Extra @@ -109,7 +109,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; Field Type Null Key Default Extra @@ -131,7 +131,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int as (a % 2)); @@ -141,6 +141,6 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result index 79450d41684..843bd6efc8e 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result @@ -13,7 +13,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; @@ -28,7 +28,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; @@ -57,7 +57,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `b` (`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; @@ -70,7 +70,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `a` (`a`,`b`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 describe t1; diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result index a62fc2ffda0..2a551956173 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result @@ -129,7 +129,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -144,7 +144,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, UNIQUE KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -173,7 +173,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `b` (`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; @@ -186,7 +186,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a*2) PERSISTENT, + `b` int(11) AS ((`a` * 2)) PERSISTENT, KEY `a` (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 describe t1; diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index d4a583c34b2..4aeeda38cc1 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -130,7 +130,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(32) DEFAULT NULL, - `v` char(32) CHARACTER SET ucs2 AS (a) VIRTUAL + `v` char(32) CHARACTER SET ucs2 AS (`a`) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a int, b int); @@ -155,7 +155,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` char(2) NOT NULL, - `c` enum('Y','N') AS (case when b = 'aa' then 'Y' else 'N' end) PERSISTENT + `c` enum('Y','N') AS ((case when (`b` = 'aa') then 'Y' else 'N' end)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1(a,b) values (1,'bb'), (2,'aa'), (3,'cc'); select * from t1; @@ -173,7 +173,7 @@ Table Create Table t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` set('y','n') AS (if(a=0,if(b=0,('n,n'),('n,y')),if(b=0,('y,n'),('y,y')))) PERSISTENT + `c` set('y','n') AS (if((`a` = 0),if((`b` = 0),'n,n','n,y'),if((`b` = 0),'y,n','y,y'))) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t2(a,b) values (7,0), (2,3), (0,1); select * from t2; @@ -227,7 +227,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` bigint(20) AS (a > '2') VIRTUAL + `b` bigint(20) AS ((`a` > '2')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (1),(3); select * from t1; @@ -244,7 +244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) DEFAULT NULL, - `b` bigint(20) AS (a between 0 and 2) VIRTUAL + `b` bigint(20) AS ((`a` between 0 and 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (1),(3); select * from t1; @@ -261,7 +261,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(10) DEFAULT NULL, - `b` char(10) AS (a between 0 and 2) VIRTUAL + `b` char(10) AS ((`a` between 0 and 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 (a) values (1),(3); select * from t1; @@ -284,8 +284,8 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` varchar(32) DEFAULT NULL, - `c` int(11) AS (a MOD 10) VIRTUAL, - `d` varchar(5) AS (LEFT(b,5)) PERSISTENT + `c` int(11) AS ((`a` % 10)) VIRTUAL, + `d` varchar(5) AS (left(`b`,5)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra @@ -324,7 +324,7 @@ create table t1 (v1 varchar(255) as (c1) persistent, c1 varchar(50)) collate=lat show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `v1` varchar(255) AS (c1) PERSISTENT, + `v1` varchar(255) AS (`c1`) PERSISTENT, `c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci drop table t1; @@ -339,7 +339,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (TIMESTAMP(a)) VIRTUAL + `b` timestamp AS (cast(`a` as datetime)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)),c TIMESTAMP); @@ -347,7 +347,7 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (TIMESTAMP(a)) VIRTUAL, + `b` timestamp AS (cast(`a` as datetime)) VIRTUAL, `c` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result index 76482b39d79..c026637c0a5 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_innodb.result @@ -81,7 +81,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored @@ -92,7 +92,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 9. CREATE LIKE @@ -173,7 +173,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) VIRTUAL, + `c` int(11) AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -194,7 +194,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) PERSISTENT, + `c` int(11) AS (dayofyear(`b`)) PERSISTENT, `b` datetime DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; @@ -216,7 +216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) PERSISTENT + `c` int(11) AS (week(`b`,1)) PERSISTENT ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. @@ -237,7 +237,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) VIRTUAL + `c` int(11) AS (week(`b`,1)) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t1; # diff --git a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result index 233f6778ca9..172fc631f08 100644 --- a/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_non_stored_columns_myisam.result @@ -81,7 +81,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) PERSISTENT + `b` int(11) AS ((`a` % 2)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 8. ALTER. Modify virtual non-stored -> virtual stored @@ -92,7 +92,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 2) VIRTUAL + `b` int(11) AS ((`a` % 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 9. CREATE LIKE @@ -173,7 +173,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) VIRTUAL, + `c` int(11) AS (dayofyear(`b`)) VIRTUAL, `b` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -194,7 +194,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `c` int(11) AS (dayofyear(b)) PERSISTENT, + `c` int(11) AS (dayofyear(`b`)) PERSISTENT, `b` datetime DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; @@ -216,7 +216,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) PERSISTENT + `c` int(11) AS (week(`b`,1)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # Case 15. ALTER. Changing the expression of a virtual non-stored column. @@ -237,7 +237,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` int(11) AS (week(b,1)) VIRTUAL + `c` int(11) AS (week(`b`,1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; # diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result index a6f69edab1a..328184aabca 100644 --- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result +++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result @@ -9,7 +9,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (abs(a)) VIRTUAL + `b` int(11) AS (abs(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1, default); select * from t1; @@ -24,7 +24,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(acos(a),6)) VIRTUAL + `b` double AS (format(acos(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1, default); insert into t1 values (1.0001,default); @@ -43,7 +43,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(asin(a),6)) VIRTUAL + `b` double AS (format(asin(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0.2, default); insert into t1 values (1.0001,default); @@ -61,7 +61,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan(a,b),6)) VIRTUAL + `c` double AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -77,7 +77,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `c` double AS (format(atan(a),6)) VIRTUAL + `c` double AS (format(atan(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,default); insert into t1 values (format(PI(),6),default); @@ -95,7 +95,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(atan2(a,b),6)) VIRTUAL + `c` double AS (format(atan(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-2,2,default); insert into t1 values (format(PI(),6),0,default); @@ -112,7 +112,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (ceil(a)) VIRTUAL + `b` int(11) AS (ceiling(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -131,7 +131,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` int(11) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (conv(a,b,c)) VIRTUAL + `d` varchar(10) AS (conv(`a`,`b`,`c`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a',16,2,default); insert into t1 values ('6e',18,8,default); @@ -152,7 +152,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cos(a),6)) VIRTUAL + `b` double AS (format(cos(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); select * from t1; @@ -167,7 +167,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(cot(a),6)) VIRTUAL + `b` double AS (format(cot(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); insert into t1 values (1,default); @@ -184,7 +184,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (crc32(a)) VIRTUAL + `b` mediumtext AS (crc32(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('mysql',default); @@ -201,7 +201,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(degrees(a),6)) VIRTUAL + `b` double AS (format(degrees(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()/2,6),default); @@ -218,7 +218,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a/2) VIRTUAL + `b` double AS ((`a` / 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -233,7 +233,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(exp(a),6)) VIRTUAL + `b` double AS (format(exp(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -252,7 +252,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` mediumtext AS (floor(a)) VIRTUAL + `b` mediumtext AS (floor(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.23,default); insert into t1 values (-1.23,default); @@ -269,7 +269,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(ln(a),6)) VIRTUAL + `b` double AS (format(ln(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -287,7 +287,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` double AS (format(log(a,b),6)) VIRTUAL + `c` double AS (format(log(`a`,`b`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,65536,default); insert into t1 values (10,100,default); @@ -305,7 +305,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log(a),6)) VIRTUAL + `b` double AS (format(log(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (-2,default); @@ -322,7 +322,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log2(a),6)) VIRTUAL + `b` double AS (format(log2(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (65536,default); insert into t1 values (-100,default); @@ -339,7 +339,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(log10(a),6)) VIRTUAL + `b` double AS (format(log10(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); insert into t1 values (100,default); @@ -358,7 +358,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a-1) VIRTUAL + `b` double AS ((`a` - 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2,default); select * from t1; @@ -373,7 +373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (mod(a,10)) VIRTUAL + `b` int(11) AS ((`a` % 10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -390,7 +390,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a % 10) VIRTUAL + `b` int(11) AS ((`a` % 10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (11,default); @@ -407,7 +407,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(10) AS (oct(a)) VIRTUAL + `b` varchar(10) AS (conv(`a`,10,8)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -422,7 +422,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(PI()*a*a,6)) VIRTUAL + `b` double AS (format(((pi() * `a`) * `a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -437,7 +437,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); select * from t1; @@ -452,8 +452,8 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (pow(a,2)) VIRTUAL, - `c` int(11) AS (power(a,2)) VIRTUAL + `b` int(11) AS (pow(`a`,2)) VIRTUAL, + `c` int(11) AS (pow(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default,default); insert into t1 values (2,default,default); @@ -470,7 +470,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(radians(a),6)) VIRTUAL + `b` double AS (format(radians(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (90,default); select * from t1; @@ -485,7 +485,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (round(a)) VIRTUAL + `b` int(11) AS (round(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1.23,default); insert into t1 values (-1.58,default); @@ -504,7 +504,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, `b` double DEFAULT NULL, - `c` int(11) AS (round(a,b)) VIRTUAL + `c` int(11) AS (round(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.298,1,default); insert into t1 values (1.298,0,default); @@ -523,7 +523,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` int(11) AS (sign(a)) VIRTUAL + `b` int(11) AS (sign(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-32,default); insert into t1 values (0,default); @@ -542,7 +542,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sin(a),6)) VIRTUAL + `b` double AS (format(sin(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI()/2,6),default); select * from t1; @@ -557,7 +557,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(sqrt(a),6)) VIRTUAL + `b` double AS (format(sqrt(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (4,default); insert into t1 values (20,default); @@ -576,7 +576,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (format(tan(a),6)) VIRTUAL + `b` double AS (format(tan(`a`),6)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (format(PI(),6),default); insert into t1 values (format(PI()+1,6),default); @@ -593,7 +593,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (a*3) VIRTUAL + `b` double AS ((`a` * 3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -612,7 +612,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (truncate(a,4)) VIRTUAL + `b` double AS (truncate(`a`,4)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1.223,default); insert into t1 values (1.999,default); @@ -633,7 +633,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` double AS (-a) VIRTUAL + `b` double AS (-(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -653,7 +653,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(2) DEFAULT NULL, - `b` int(11) AS (ascii(a)) VIRTUAL + `b` int(11) AS (ascii(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2',default); insert into t1 values (2,default); @@ -672,7 +672,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (bin(a)) VIRTUAL + `b` varchar(10) AS (conv(`a`,10,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -687,7 +687,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (bit_length(a)) VIRTUAL + `b` mediumtext AS (bit_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -702,7 +702,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (char_length(a)) VIRTUAL + `b` mediumtext AS (char_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -718,7 +718,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` varbinary(10) AS (char(a,b)) VIRTUAL + `c` varbinary(10) AS (char(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (77,121,default); select * from t1; @@ -733,7 +733,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (character_length(a)) VIRTUAL + `b` mediumtext AS (char_length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -749,7 +749,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat_ws(',',a,b)) VIRTUAL + `c` varchar(20) AS (concat_ws(',',`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -765,7 +765,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (concat(a,',',b)) VIRTUAL + `c` varchar(20) AS (concat(`a`,',',`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',default); select * from t1; @@ -782,7 +782,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(10) AS (elt(c,a,b)) VIRTUAL + `d` varchar(10) AS (elt(`c`,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('value1','value2',1,default); insert into t1 values ('value1','value2',2,default); @@ -799,7 +799,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (export_set(a,'1','0','',10)) VIRTUAL + `b` varchar(10) AS (export_set(`a`,'1','0','',10)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (6,default); select * from t1; @@ -815,7 +815,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (field('aa',a,b)) VIRTUAL + `c` int(11) AS (field('aa',`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('aa','bb',default); insert into t1 values ('bb','aa',default); @@ -833,7 +833,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (find_in_set(a,b)) VIRTUAL + `c` int(11) AS (find_in_set(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('aa','aa,bb,cc',default); insert into t1 values ('aa','bb,aa,cc',default); @@ -850,7 +850,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double DEFAULT NULL, - `b` varchar(20) AS (format(a,2)) VIRTUAL + `b` varchar(20) AS (format(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12332.123456,default); select * from t1; @@ -865,7 +865,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) AS (hex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (17,default); select * from t1; @@ -879,7 +879,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (hex(a)) VIRTUAL + `b` varchar(10) AS (hex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -895,7 +895,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(20) AS (insert(a,length(a),length(b),b)) VIRTUAL + `c` varchar(20) AS (insert(`a`,length(`a`),length(`b`),`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('start,','end',default); select * from t1; @@ -911,7 +911,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` int(11) AS (instr(a,b)) VIRTUAL + `c` int(11) AS (locate(`b`,`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar,','bar',default); insert into t1 values ('xbar,','foobar',default); @@ -928,7 +928,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lcase(a)) VIRTUAL + `b` varchar(10) AS (lcase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -943,7 +943,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(5) AS (left(a,5)) VIRTUAL + `b` varchar(5) AS (left(`a`,5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -958,7 +958,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (length(a)) VIRTUAL + `b` int(11) AS (length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -973,7 +973,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a like 'H%!o' escape '!') VIRTUAL + `b` tinyint(1) AS ((`a` like 'H%!o' escape '!')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -990,7 +990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (locate('bar',a)) VIRTUAL + `b` varchar(10) AS (locate('bar',`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1005,7 +1005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lower(a)) VIRTUAL + `b` varchar(10) AS (lcase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1020,7 +1020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (lpad(a,4,' ')) VIRTUAL + `b` varchar(10) AS (lpad(`a`,4,' ')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); insert into t1 values ('M',default); @@ -1037,7 +1037,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (ltrim(a)) VIRTUAL + `b` varchar(10) AS (ltrim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (' MySQL',default); insert into t1 values ('MySQL',default); @@ -1056,7 +1056,7 @@ t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` int(11) DEFAULT NULL, - `d` varchar(30) AS (make_set(c,a,b)) VIRTUAL + `d` varchar(30) AS (make_set(`c`,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',1,default); insert into t1 values ('a','b',3,default); @@ -1073,7 +1073,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (mid(a,1,2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,1,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1088,7 +1088,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not like 'H%o') VIRTUAL + `b` tinyint(1) AS ((not((`a` like 'H%o')))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1105,7 +1105,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a not regexp 'H.+o') VIRTUAL + `b` tinyint(1) AS ((not((`a` regexp 'H.+o')))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1122,7 +1122,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` int(11) AS (octet_length(a)) VIRTUAL + `b` int(11) AS (length(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('text',default); select * from t1; @@ -1137,7 +1137,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` mediumtext AS (ord(a)) VIRTUAL + `b` mediumtext AS (ord(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2',default); select * from t1; @@ -1152,7 +1152,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (position('bar' in a)) VIRTUAL + `b` varchar(10) AS (locate('bar',`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1167,7 +1167,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (quote(a)) VIRTUAL + `b` varchar(10) AS (quote(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Don\'t',default); select * from t1; @@ -1182,7 +1182,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a regexp 'H.+o') VIRTUAL + `b` tinyint(1) AS ((`a` regexp 'H.+o')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('hello',default); @@ -1199,7 +1199,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (repeat(a,3)) VIRTUAL + `b` varchar(30) AS (repeat(`a`,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1214,7 +1214,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (replace(a,'aa','bb')) VIRTUAL + `b` varchar(30) AS (replace(`a`,'aa','bb')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1229,7 +1229,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(30) AS (reverse(a)) VIRTUAL + `b` varchar(30) AS (reverse(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('maa',default); select * from t1; @@ -1244,7 +1244,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (right(a,4)) VIRTUAL + `b` varchar(10) AS (right(`a`,4)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('foobarbar',default); select * from t1; @@ -1259,7 +1259,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` tinyint(1) AS (a rlike 'H.+o') VIRTUAL + `b` tinyint(1) AS ((`a` regexp 'H.+o')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); insert into t1 values ('MySQL',default); @@ -1276,7 +1276,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rpad(a,4,'??')) VIRTUAL + `b` varchar(10) AS (rpad(`a`,4,'??')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('He',default); select * from t1; @@ -1291,7 +1291,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (rtrim(a)) VIRTUAL + `b` varchar(10) AS (rtrim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello ',default); select * from t1; @@ -1306,7 +1306,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(20) AS (soundex(a)) VIRTUAL + `b` varchar(20) AS (soundex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1322,7 +1322,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a sounds like b) VIRTUAL + `c` tinyint(1) AS ((soundex(`a`) = soundex(`b`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello',default); insert into t1 values ('Hello','MySQL',default); @@ -1341,7 +1341,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (concat(a,space(5))) VIRTUAL + `b` varchar(10) AS (concat(`a`,space(5))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello', default); select * from t1; @@ -1357,7 +1357,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(9) DEFAULT NULL, `b` varchar(9) DEFAULT NULL, - `c` tinyint(1) AS (strcmp(a,b)) VIRTUAL + `c` tinyint(1) AS (strcmp(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello','Hello', default); insert into t1 values ('Hello','Hello1', default); @@ -1374,7 +1374,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substr(a,2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1389,7 +1389,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (substring_index(a,'.',2)) VIRTUAL + `b` varchar(10) AS (substring_index(`a`,'.',2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('www.mysql.com',default); select * from t1; @@ -1404,7 +1404,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (substring(a from 2 for 2)) VIRTUAL + `b` varchar(10) AS (substr(`a`,2,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('Hello',default); select * from t1; @@ -1419,7 +1419,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (trim(a)) VIRTUAL + `b` varchar(10) AS (trim(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (' aa ',default); select * from t1; @@ -1434,7 +1434,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (ucase(a)) VIRTUAL + `b` varchar(10) AS (ucase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1449,7 +1449,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(15) DEFAULT NULL, - `b` varchar(10) AS (unhex(a)) VIRTUAL + `b` varchar(10) AS (unhex(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('4D7953514C',default); select * from t1; @@ -1464,7 +1464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(5) DEFAULT NULL, - `b` varchar(10) AS (upper(a)) VIRTUAL + `b` varchar(10) AS (ucase(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -1482,7 +1482,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(16) AS (case a when NULL then 'asd' when 'b' then 'B' else a end) VIRTUAL + `b` varchar(16) AS ((case `a` when NULL then 'asd' when 'b' then 'B' else `a` end)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL,default); insert into t1 values ('b',default); @@ -1502,7 +1502,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (if(a=1,a,b)) VIRTUAL + `c` int(11) AS (if((`a` = 1),`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,2,default); insert into t1 values (3,4,default); @@ -1520,7 +1520,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` varchar(10) AS (ifnull(a,'DEFAULT')) VIRTUAL + `c` varchar(10) AS (ifnull(`a`,'DEFAULT')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (NULL,'adf',default); insert into t1 values ('a','adf',default); @@ -1537,7 +1537,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varchar(10) AS (nullif(a,'DEFAULT')) VIRTUAL + `b` varchar(10) AS (nullif(`a`,'DEFAULT')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('DEFAULT',default); insert into t1 values ('a',default); @@ -1557,7 +1557,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a>0 && a<2) VIRTUAL + `b` tinyint(1) AS (((`a` > 0) and (`a` < 2))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1574,7 +1574,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a between 0 and 2) VIRTUAL + `b` tinyint(1) AS ((`a` between 0 and 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1591,7 +1591,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, - `b` varbinary(10) AS (binary a) VIRTUAL + `b` varbinary(10) AS (cast(`a` as char charset binary)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('11',default); insert into t1 values (1,default); @@ -1608,7 +1608,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a & 5) VIRTUAL + `b` int(11) AS ((`a` & 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1625,7 +1625,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (~a) VIRTUAL + `b` int(11) AS (~(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); Warnings: @@ -1642,7 +1642,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a | 5) VIRTUAL + `b` int(11) AS ((`a` | 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1661,7 +1661,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a ^ 5) VIRTUAL + `b` int(11) AS ((`a` ^ 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (0,default); @@ -1680,7 +1680,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a div 5) VIRTUAL + `b` int(11) AS ((`a` DIV 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (7,default); @@ -1698,7 +1698,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` tinyint(1) AS (a <=> b) VIRTUAL + `c` tinyint(1) AS ((`a` <=> `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,1,default); insert into t1 values (NULL,NULL,default); @@ -1718,7 +1718,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a=b) VIRTUAL + `c` tinyint(1) AS ((`a` = `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1736,7 +1736,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a >= b) VIRTUAL + `c` tinyint(1) AS ((`a` >= `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1754,7 +1754,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a > b) VIRTUAL + `c` tinyint(1) AS ((`a` > `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a','b',default); insert into t1 values ('a','a',default); @@ -1771,7 +1771,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is not null) VIRTUAL + `b` tinyint(1) AS ((`a` is not null)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1788,7 +1788,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a is null) VIRTUAL + `b` tinyint(1) AS (isnull(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (NULL,default); @@ -1805,7 +1805,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a << 2) VIRTUAL + `b` int(11) AS ((`a` << 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (3,default); @@ -1823,7 +1823,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <= b) VIRTUAL + `c` tinyint(1) AS ((`a` <= `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1843,7 +1843,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a < b) VIRTUAL + `c` tinyint(1) AS ((`a` < `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1862,7 +1862,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` tinyint(1) AS (a not between 0 and 2) VIRTUAL + `b` tinyint(1) AS ((`a` not between 0 and 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (-1,default); insert into t1 values (1,default); @@ -1880,7 +1880,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a <> b) VIRTUAL + `c` tinyint(1) AS ((`a` <> `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1900,7 +1900,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(10) DEFAULT NULL, `b` varchar(10) DEFAULT NULL, - `c` tinyint(1) AS (a != b) VIRTUAL + `c` tinyint(1) AS ((`a` <> `b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('b','a',default); insert into t1 values ('b','b',default); @@ -1919,7 +1919,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a>5 || a<3) VIRTUAL + `b` int(11) AS (((`a` > 5) or (`a` < 3))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (4,default); @@ -1936,7 +1936,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a >> 2) VIRTUAL + `b` int(11) AS ((`a` >> 2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (8,default); insert into t1 values (3,default); @@ -1953,7 +1953,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a xor 5) VIRTUAL + `b` int(11) AS ((`a` xor 5)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (0,default); insert into t1 values (1,default); @@ -1975,7 +1975,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (adddate(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` + interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -1990,7 +1990,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (addtime(a,'02:00:00')) VIRTUAL + `b` datetime AS (addtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2005,7 +2005,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (convert_tz(a,'MET','UTC')) VIRTUAL + `b` datetime AS (convert_tz(`a`,'MET','UTC')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2020,7 +2020,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_add(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` + interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2035,7 +2035,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date_sub(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` - interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2050,7 +2050,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (date(a)) VIRTUAL + `b` datetime AS (cast(`a` as date)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:00:00',default); select * from t1; @@ -2065,7 +2065,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` mediumtext AS (datediff(a,'2000-01-01')) VIRTUAL + `b` mediumtext AS ((to_days(`a`) - to_days('2000-01-01'))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2080,7 +2080,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (day(a)) VIRTUAL + `b` int(11) AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2095,7 +2095,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofmonth(a)) VIRTUAL + `b` int(11) AS (dayofmonth(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2110,7 +2110,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofweek(a)) VIRTUAL + `b` int(11) AS (dayofweek(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2125,7 +2125,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (dayofyear(a)) VIRTUAL + `b` int(11) AS (dayofyear(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2140,7 +2140,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (extract(year from a)) VIRTUAL + `b` int(11) AS (extract(year from `a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2155,7 +2155,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, - `b` datetime AS (from_days(a)) VIRTUAL + `b` datetime AS (from_days(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (730669,default); select * from t1; @@ -2171,7 +2171,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, - `b` datetime AS (from_unixtime(a)) VIRTUAL + `b` datetime AS (from_unixtime(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1196440219,default); select * from t1; @@ -2186,7 +2186,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` mediumtext AS (hour(a)) VIRTUAL + `b` mediumtext AS (hour(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2201,7 +2201,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (last_day(a)) VIRTUAL + `b` datetime AS (last_day(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-05',default); insert into t1 values ('2003-02-32',default); @@ -2220,7 +2220,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` datetime AS (makedate(a,1)) VIRTUAL + `b` datetime AS (makedate(`a`,1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2001,default); select * from t1; @@ -2235,7 +2235,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` time AS (maketime(a,1,3)) VIRTUAL + `b` time AS (maketime(`a`,1,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (12,default); select * from t1; @@ -2250,7 +2250,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` mediumtext AS (microsecond(a)) VIRTUAL + `b` mediumtext AS (microsecond(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 12:00:00.123456',default); insert into t1 values ('2009-12-31 23:59:59.000010',default); @@ -2267,7 +2267,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (minute(a)) VIRTUAL + `b` int(11) AS (minute(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2282,7 +2282,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (month(a)) VIRTUAL + `b` int(11) AS (month(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2009-12-31 23:59:59.000010',default); select * from t1; @@ -2297,7 +2297,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (period_add(a,2)) VIRTUAL + `b` int(11) AS (period_add(`a`,2)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (200801,default); select * from t1; @@ -2313,7 +2313,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL, - `c` int(11) AS (period_diff(a,b)) VIRTUAL + `c` int(11) AS (period_diff(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (200802,200703,default); select * from t1; @@ -2328,7 +2328,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (quarter(a)) VIRTUAL + `b` int(11) AS (quarter(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2343,7 +2343,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumtext DEFAULT NULL, - `b` time AS (sec_to_time(a)) VIRTUAL + `b` time AS (sec_to_time(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (2378,default); select * from t1; @@ -2358,7 +2358,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (second(a)) VIRTUAL + `b` int(11) AS (second(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('10:05:03',default); select * from t1; @@ -2373,7 +2373,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(64) DEFAULT NULL, - `b` datetime AS (str_to_date(a,'%m/%d/%Y')) VIRTUAL + `b` datetime AS (str_to_date(`a`,'%m/%d/%Y')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('04/30/2004',default); select * from t1; @@ -2388,7 +2388,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subdate(a,interval 1 month)) VIRTUAL + `b` datetime AS ((`a` - interval 1 month)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2403,7 +2403,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` datetime AS (subtime(a,'02:00:00')) VIRTUAL + `b` datetime AS (subtime(`a`,'02:00:00')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31',default); select * from t1; @@ -2418,7 +2418,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time DEFAULT NULL, - `b` mediumtext AS (time_to_sec(a)) VIRTUAL + `b` mediumtext AS (time_to_sec(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('22:23:00',default); select * from t1; @@ -2433,7 +2433,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` time AS (time(a)) VIRTUAL + `b` time AS (cast(`a` as time)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-08-31 02:03:04',default); select * from t1; @@ -2449,7 +2449,7 @@ Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, `b` datetime DEFAULT NULL, - `c` mediumtext AS (timediff(a,b)) VIRTUAL + `c` mediumtext AS (timediff(`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31 23:59:59.000001','2008-12-30 01:01:01.000002',default); select * from t1; @@ -2464,7 +2464,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestamp(a)) VIRTUAL + `b` timestamp AS (cast(`a` as datetime)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-12-31',default); select * from t1; @@ -2479,7 +2479,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` timestamp AS (timestampadd(minute,1,a)) VIRTUAL + `b` timestamp AS ((`a` + interval 1 minute)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-01-02',default); select * from t1; @@ -2493,9 +2493,9 @@ create table t1 (a timestamp, b timestamp, c long as (timestampdiff(MONTH, a,b)) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `c` mediumtext AS (timestampdiff(MONTH, a,b)) VIRTUAL + `c` mediumtext AS (timestampdiff(MONTH,`a`,`b`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2003-02-01','2003-05-01',default); select * from t1; @@ -2510,7 +2510,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` mediumtext AS (to_days(a)) VIRTUAL + `b` mediumtext AS (to_days(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2007-10-07',default); select * from t1; @@ -2525,7 +2525,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (week(a,0)) VIRTUAL + `b` int(11) AS (week(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2540,7 +2540,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekday(a)) VIRTUAL + `b` int(11) AS (weekday(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2555,7 +2555,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (weekofyear(a)) VIRTUAL + `b` int(11) AS (week(`a`,3)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2570,7 +2570,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (year(a)) VIRTUAL + `b` int(11) AS (year(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2585,7 +2585,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` int(11) AS (yearweek(a)) VIRTUAL + `b` int(11) AS (yearweek(`a`,0)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2008-09-01',default); select * from t1; @@ -2607,7 +2607,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` mediumtext AS (cast(a as unsigned)) VIRTUAL + `b` mediumtext AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2628,7 +2628,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` mediumtext AS (convert(a,unsigned)) VIRTUAL + `b` mediumtext AS (cast(`a` as unsigned)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (1,default); insert into t1 values (-1,default); @@ -2656,7 +2656,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (aes_encrypt(aes_decrypt(a,'adf'),'adf')) VIRTUAL + `b` varchar(1024) AS (aes_encrypt(aes_decrypt(`a`,'adf'),'adf')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2671,7 +2671,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (bit_count(a)) VIRTUAL + `b` int(11) AS (bit_count(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values (5,default); select * from t1; @@ -2686,7 +2686,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (uncompress(compress(a))) VIRTUAL + `b` varchar(1024) AS (uncompress(compress(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2701,7 +2701,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (decode(encode(a,'abc'),'abc')) VIRTUAL + `b` varchar(1024) AS (decode(encode(`a`,'abc'),'abc')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('MySQL',default); select * from t1; @@ -2716,7 +2716,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT 'aaa', - `b` varchar(1024) AS (ifnull(a,default(a))) VIRTUAL + `b` varchar(1024) AS (ifnull(`a`,default(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('any value',default); select * from t1; @@ -2731,7 +2731,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (inet_ntoa(inet_aton(a))) VIRTUAL + `b` varchar(1024) AS (inet_ntoa(inet_aton(`a`))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('127.0.0.1',default); select * from t1; @@ -2746,7 +2746,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varbinary(32) AS (md5(a)) VIRTUAL + `b` varbinary(32) AS (md5(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('testing',default); select * from t1; @@ -2761,7 +2761,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (old_password(a)) VIRTUAL + `b` varchar(1024) AS (old_password(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('badpwd',default); select * from t1; @@ -2776,7 +2776,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (password(a)) VIRTUAL + `b` varchar(1024) AS (password(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('badpwd',default); select * from t1; @@ -2791,7 +2791,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha1(a)) VIRTUAL + `b` varchar(1024) AS (sha(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2806,7 +2806,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(1024) DEFAULT NULL, - `b` varchar(1024) AS (sha(a)) VIRTUAL + `b` varchar(1024) AS (sha(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('abc',default); select * from t1; @@ -2821,7 +2821,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(1) DEFAULT NULL, - `b` varchar(1024) AS (uncompressed_length(compress(repeat(a,30)))) VIRTUAL + `b` varchar(1024) AS (uncompressed_length(compress(repeat(`a`,30)))) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('a',default); select * from t1; @@ -2836,7 +2836,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` varchar(100) AS (monthname(a)) VIRTUAL + `b` varchar(100) AS (monthname(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2010-10-10',default); select * from t1; @@ -2851,7 +2851,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` varchar(100) AS (dayname(a)) VIRTUAL + `b` varchar(100) AS (dayname(`a`)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2011-11-11',default); select * from t1; @@ -2866,7 +2866,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` varchar(100) AS (date_format(a, '%W %a %M %b')) VIRTUAL + `b` varchar(100) AS (date_format(`a`,'%W %a %M %b')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2012-12-12',default); select * from t1; @@ -2896,7 +2896,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime DEFAULT NULL, - `b` varchar(10) AS (time_format(a,"%d.%m.%Y")) VIRTUAL + `b` varchar(10) AS (time_format(`a`,'%d.%m.%Y')) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 insert into t1 values ('2001-01-01 02:02:02',default); select * from t1; diff --git a/mysql-test/suite/vcol/r/vcol_syntax.result b/mysql-test/suite/vcol/r/vcol_syntax.result index 8515d790359..14c376797d6 100644 --- a/mysql-test/suite/vcol/r/vcol_syntax.result +++ b/mysql-test/suite/vcol/r/vcol_syntax.result @@ -5,7 +5,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int as (a+1) virtual); @@ -13,7 +13,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) VIRTUAL + `b` int(11) AS ((`a` + 1)) VIRTUAL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 (a int, b int generated always as (a+1) persistent); @@ -21,7 +21,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, - `b` int(11) AS (a+1) PERSISTENT + `b` int(11) AS ((`a` + 1)) PERSISTENT ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; set session sql_mode='ORACLE'; @@ -30,7 +30,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, - "b" int(11) AS (a+1) VIRTUAL + "b" int(11) AS (("a" + 1)) VIRTUAL ) drop table t1; create table t1 (a int, b int generated always as (a+1) virtual); @@ -38,7 +38,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, - "b" int(11) AS (a+1) VIRTUAL + "b" int(11) AS (("a" + 1)) VIRTUAL ) drop table t1; create table t1 (a int, b int as (a+1) persistent); @@ -46,7 +46,7 @@ show create table t1; Table Create Table t1 CREATE TABLE "t1" ( "a" int(11) DEFAULT NULL, - "b" int(11) AS (a+1) PERSISTENT + "b" int(11) AS (("a" + 1)) PERSISTENT ) drop table t1; set session sql_mode=@OLD_SQL_MODE; diff --git a/mysql-test/suite/vcol/t/delayed.test b/mysql-test/suite/vcol/t/delayed.test new file mode 100644 index 00000000000..62065abdba8 --- /dev/null +++ b/mysql-test/suite/vcol/t/delayed.test @@ -0,0 +1,5 @@ +create table t (a int primary key, b int, c int as (b), index (c)); +insert t (a,b) values (10,1); +replace delayed t (a,b) values (10,5); +check table t; +drop table t; diff --git a/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc b/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc index 492082af30c..708dbd42a8d 100644 --- a/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc +++ b/mysql-test/suite/vcol/t/vcol_blocked_sql_funcs_main.inc @@ -345,7 +345,7 @@ eval create or replace table t1 (a int, b varchar(16384) as (concat(a,'$tmp_long --disable_query_log let $tmp_long_string = `SELECT repeat('a',65535)`; ---error ER_TOO_MANY_FIELDS +--error ER_EXPRESSION_IS_TOO_BIG eval create or replace table t1 (a int, b varchar(16384) as (concat(a,'$tmp_long_string'))); --enable_query_log diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test index 5f00debbc3a..6eca3a64562 100644 --- a/mysql-test/t/default.test +++ b/mysql-test/t/default.test @@ -448,11 +448,12 @@ DEALLOCATE PREPARE stmt; # We can't have an expression for prepared statements # -PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?+?))'; +prepare stmt from 'create table t1 (a int default(?+?))'; set @a=1; ---error ER_PARSE_ERROR execute stmt using @a,@a; -DEALLOCATE PREPARE stmt; +deallocate prepare stmt; +show create table t1; +drop table t1; --echo # --echo # Parenthesized Item_basic_constant @@ -1974,3 +1975,21 @@ DROP TABLE t1; --echo # end of 10.2 test + +# +# ANSI_QUOTES +# +set sql_mode=ansi_quotes; +create table t1 (a int, b int default (a+1)); +show create table t1; +insert t1 (a) values (10); +set sql_mode=''; +show create table t1; +insert t1 (a) values (20); +flush tables; +show create table t1; +insert t1 (a) values (30); +select * from t1; +drop table t1; +set sql_mode=default; + diff --git a/mysql-test/t/partition_bug18198.test b/mysql-test/t/partition_bug18198.test index 75544f58ce8..720d483e8ed 100644 --- a/mysql-test/t/partition_bug18198.test +++ b/mysql-test/t/partition_bug18198.test @@ -163,7 +163,7 @@ create table t1 (col1 date) partition by range(unix_timestamp(col1)) (partition p0 values less than (10), partition p1 values less than (30)); --- error ER_PARSE_ERROR +-- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED create table t1 (col1 datetime) partition by range(week(col1)) (partition p0 values less than (10), partition p1 values less than (30)); diff --git a/sql/field.cc b/sql/field.cc index be6259e6a11..88af4f321dd 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4956,8 +4956,8 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg, this field will be automaticly updated on insert. */ flags|= TIMESTAMP_FLAG; - flags|= ON_UPDATE_NOW_FLAG; - DBUG_ASSERT(unireg_check == TIMESTAMP_UN_FIELD); + if (unireg_check != TIMESTAMP_DN_FIELD) + flags|= ON_UPDATE_NOW_FLAG; } } @@ -9773,35 +9773,32 @@ void Column_definition::create_length_to_internal_length(void) } -bool check_expression(Virtual_column_info *vcol, const char *type, - const char *name, bool must_be_determinstic) +bool check_expression(Virtual_column_info *vcol, const char *name, + enum_vcol_info_type type) + { bool ret; Item::vcol_func_processor_result res; - /* We use 2 bytes to store the expression length */ - if (vcol->expr_str.length > UINT_MAX32) - { - my_error(ER_EXPRESSION_IS_TOO_BIG, MYF(0), type, name); - return TRUE; - } + + if (!vcol->name.length) + vcol->name.str= const_cast<char*>(name); /* Walk through the Item tree checking if all items are valid to be part of the virtual column */ - res.errors= 0; ret= vcol->expr_item->walk(&Item::check_vcol_func_processor, 0, &res); vcol->flags= res.errors; uint filter= VCOL_IMPOSSIBLE; - if (must_be_determinstic) + if (type != VCOL_GENERATED_VIRTUAL && type != VCOL_DEFAULT) filter|= VCOL_NOT_STRICTLY_DETERMINISTIC; if (ret || (res.errors & filter)) { my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name, - type, name); + vcol_type_name(type), name); return TRUE; } /* @@ -9826,20 +9823,19 @@ bool Column_definition::check(THD *thd) { DBUG_ASSERT(vcol_info->expr_item); vcol_info->set_field_type(sql_type); - if (check_expression(vcol_info, "GENERATED ALWAYS AS", field_name, - vcol_info->stored_in_db)) + if (check_expression(vcol_info, field_name, vcol_info->stored_in_db + ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL)) DBUG_RETURN(TRUE); } if (check_constraint && - check_expression(check_constraint, "CHECK", field_name, 0)) - DBUG_RETURN(1); + check_expression(check_constraint, field_name, VCOL_CHECK_FIELD)) + DBUG_RETURN(1); if (default_value) { Item *def_expr= default_value->expr_item; - - if (check_expression(default_value, "DEFAULT", field_name, 0)) + if (check_expression(default_value, field_name, VCOL_DEFAULT)) DBUG_RETURN(TRUE); /* Constant's are stored in the 'empty_record', except for blobs */ @@ -10556,8 +10552,8 @@ Column_definition::Column_definition(THD *thd, Field *old_field, if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) && old_field->ptr != NULL && orig_field != NULL) { - if (orig_field->has_update_default_function()) - unireg_check= Field::TIMESTAMP_UN_FIELD; + if (orig_field->unireg_check != Field::NEXT_NUMBER) + unireg_check= orig_field->unireg_check; /* Get the value from default_values */ const uchar *dv= orig_field->table->s->default_values; @@ -10567,8 +10563,6 @@ Column_definition::Column_definition(THD *thd, Field *old_field, String *res= orig_field->val_str(&tmp, orig_field->ptr_in_record(dv)); char *pos= (char*) thd->strmake(res->ptr(), res->length()); default_value= new (thd->mem_root) Virtual_column_info(); - default_value->expr_str.str= pos; - default_value->expr_str.length= res->length(); default_value->expr_item= new (thd->mem_root) Item_string(thd, pos, res->length(), charset); default_value->utf8= 0; diff --git a/sql/field.h b/sql/field.h index c44463248a3..83997c70032 100644 --- a/sql/field.h +++ b/sql/field.h @@ -560,6 +560,28 @@ inline bool is_temporal_type_with_time(enum_field_types type) } } +enum enum_vcol_info_type +{ + VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED, + VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE +}; + +static inline const char *vcol_type_name(enum_vcol_info_type type) +{ + switch (type) + { + case VCOL_GENERATED_VIRTUAL: + case VCOL_GENERATED_STORED: + return "GENERATED ALWAYS AS"; + case VCOL_DEFAULT: + return "DEFAULT"; + case VCOL_CHECK_FIELD: + case VCOL_CHECK_TABLE: + return "CHECK"; + } + return 0; +} + /* Flags for Virtual_column_info. If none is set, the expression must be a constant with no side-effects, so it's calculated at CREATE TABLE time, @@ -599,10 +621,7 @@ public: /* Flag indicating that the field is physically stored in the database */ bool stored_in_db; bool utf8; /* Already in utf8 */ - /* The expression to compute the value of the virtual column */ Item *expr_item; - /* Text representation of the defining expression */ - LEX_STRING expr_str; LEX_STRING name; /* Name of constraint */ uint flags; @@ -611,7 +630,7 @@ public: in_partitioning_expr(FALSE), stored_in_db(FALSE), utf8(TRUE), expr_item(NULL), flags(0) { - expr_str.str= name.str= NULL; + name.str= NULL; name.length= 0; }; ~Virtual_column_info() {} @@ -640,13 +659,8 @@ public: { in_partitioning_expr= TRUE; } - bool is_equal(const Virtual_column_info* vcol) const - { - return field_type == vcol->get_real_type() - && stored_in_db == vcol->is_stored() - && expr_str.length == vcol->expr_str.length - && memcmp(expr_str.str, vcol->expr_str.str, expr_str.length) == 0; - } + inline bool is_equal(const Virtual_column_info* vcol) const; + void print(String*); }; class Field: public Value_source @@ -920,7 +934,12 @@ public: bool has_update_default_function() const { - return unireg_check == TIMESTAMP_UN_FIELD; + return flags & ON_UPDATE_NOW_FLAG; + } + bool has_default_now_unireg_check() const + { + return unireg_check == TIMESTAMP_DN_FIELD + || unireg_check == TIMESTAMP_DNUN_FIELD; } /* @@ -941,14 +960,6 @@ public: virtual void set_explicit_default(Item *value); /** - Evaluates the @c INSERT default function and stores the result in the - field. If no such function exists for the column, or the function is not - valid for the column's data type, invoking this function has no effect. - */ - virtual int evaluate_insert_default_function() { return 0; } - - - /** Evaluates the @c UPDATE default function, if one exists, and stores the result in the record buffer. If no such function exists for the column, or the function is not valid for the column's data type, invoking this @@ -2785,7 +2796,11 @@ public: const char *field_name_arg) :Field_temporal_with_date(ptr_arg, length_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg) - {} + { + if (unireg_check == TIMESTAMP_UN_FIELD || + unireg_check == TIMESTAMP_DNUN_FIELD) + flags|= ON_UPDATE_NOW_FLAG; + } enum_field_types type() const { return MYSQL_TYPE_DATETIME;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; } double val_real(void); @@ -3779,8 +3794,7 @@ public: bool has_default_function() const { - return (unireg_check == Field::TIMESTAMP_UN_FIELD || - unireg_check == Field::NEXT_NUMBER); + return unireg_check != Field::NONE; } Field *make_field(TABLE_SHARE *share, MEM_ROOT *mem_root, @@ -3801,6 +3815,12 @@ public: } /* Return true if default is an expression that must be saved explicitely */ bool has_default_expression(); + + bool has_default_now_unireg_check() const + { + return unireg_check == Field::TIMESTAMP_DN_FIELD + || unireg_check == Field::TIMESTAMP_DNUN_FIELD; + } }; @@ -3897,8 +3917,8 @@ uint32 calc_pack_length(enum_field_types type,uint32 length); int set_field_to_null(Field *field); int set_field_to_null_with_conversions(Field *field, bool no_conversions); int convert_null_to_field_value_or_error(Field *field); -bool check_expression(Virtual_column_info *vcol, const char *type, - const char *name, bool must_be_deterministic); +bool check_expression(Virtual_column_info *vcol, const char *name, + enum_vcol_info_type type); /* The following are for the interface with the .frm file diff --git a/sql/item.cc b/sql/item.cc index 04c573ee8b4..c8cff0859c0 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2638,16 +2638,50 @@ void Item_ident::print(String *str, enum_query_type query_type) THD *thd= current_thd; char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME]; const char *d_name= db_name, *t_name= table_name; + bool use_table_name= table_name && table_name[0]; + bool use_db_name= use_table_name && db_name && db_name[0] && !alias_name_used; + + if (use_db_name && (query_type & QT_ITEM_IDENT_SKIP_DB_NAMES)) + use_db_name= !thd->db || strcmp(thd->db, db_name); + + if (use_db_name) + use_db_name= !(cached_table && cached_table->belong_to_view && + cached_table->belong_to_view->compact_view_format); + + if (!use_db_name && use_table_name && + (query_type & QT_ITEM_IDENT_SKIP_TABLE_NAMES)) + { + /* + Don't print the table name if it's the only table in the context + XXX technically, that's a sufficient, but too strong condition + */ + if (!context) + use_table_name= false; + else if (context->outer_context) + use_table_name= true; + else if (context->last_name_resolution_table == context->first_name_resolution_table) + use_table_name= false; + else if (!context->last_name_resolution_table && + !context->first_name_resolution_table->next_name_resolution_table) + use_table_name= false; + } + + if (!field_name || !field_name[0]) + { + append_identifier(thd, str, STRING_WITH_LEN("tmp_field")); + return; + } + if (lower_case_table_names== 1 || (lower_case_table_names == 2 && !alias_name_used)) { - if (table_name && table_name[0]) + if (use_table_name) { strmov(t_name_buff, table_name); my_casedn_str(files_charset_info, t_name_buff); t_name= t_name_buff; } - if (db_name && db_name[0]) + if (use_db_name) { strmov(d_name_buff, db_name); my_casedn_str(files_charset_info, d_name_buff); @@ -2655,43 +2689,18 @@ void Item_ident::print(String *str, enum_query_type query_type) } } - if (!table_name || !field_name || !field_name[0]) - { - const char *nm= (field_name && field_name[0]) ? - field_name : name ? name : "tmp_field"; - append_identifier(thd, str, nm, (uint) strlen(nm)); - return; - } - if (db_name && db_name[0] && !alias_name_used) + if (use_db_name) { - /* - When printing EXPLAIN, don't print database name when it's the same as - current database. - */ - bool skip_db= (query_type & QT_ITEM_IDENT_SKIP_CURRENT_DATABASE) && - thd->db && !strcmp(thd->db, db_name); - if (!skip_db && - !(cached_table && cached_table->belong_to_view && - cached_table->belong_to_view->compact_view_format)) - { - append_identifier(thd, str, d_name, (uint)strlen(d_name)); - str->append('.'); - } - append_identifier(thd, str, t_name, (uint)strlen(t_name)); + append_identifier(thd, str, d_name, (uint)strlen(d_name)); str->append('.'); - append_identifier(thd, str, field_name, (uint)strlen(field_name)); + DBUG_ASSERT(use_table_name); } - else + if (use_table_name) { - if (table_name[0]) - { - append_identifier(thd, str, t_name, (uint) strlen(t_name)); - str->append('.'); - append_identifier(thd, str, field_name, (uint) strlen(field_name)); - } - else - append_identifier(thd, str, field_name, (uint) strlen(field_name)); + append_identifier(thd, str, t_name, (uint) strlen(t_name)); + str->append('.'); } + append_identifier(thd, str, field_name, (uint) strlen(field_name)); } /* ARGSUSED */ @@ -10442,3 +10451,12 @@ void Item::register_in(THD *thd) next= thd->free_list; thd->free_list= this; } + +void Virtual_column_info::print(String *str) +{ + expr_item->print(str, (enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF | + QT_ITEM_IDENT_SKIP_DB_NAMES | + QT_ITEM_IDENT_SKIP_TABLE_NAMES | + QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | + QT_TO_SYSTEM_CHARSET)); +} diff --git a/sql/item.h b/sql/item.h index 1aa613a25b8..c3128b35c52 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2583,6 +2583,7 @@ public: bool update_vcol_processor(void *arg); bool check_vcol_func_processor(void *arg) { + context= 0; return mark_unsupported_function(field_name, arg, VCOL_FIELD_REF); } void cleanup(); @@ -5783,5 +5784,11 @@ bool fix_escape_item(THD *thd, Item *escape_item, String *tmp_str, bool escape_used_in_parsing, CHARSET_INFO *cmp_cs, int *escape); +inline bool Virtual_column_info::is_equal(const Virtual_column_info* vcol) const +{ + return field_type == vcol->get_real_type() + && stored_in_db == vcol->is_stored() + && expr_item->eq(vcol->expr_item, true); +} #endif /* SQL_ITEM_INCLUDED */ diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index c35606781ec..a9aaf5dd241 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1651,6 +1651,15 @@ bool Item_func_curtime::get_date(MYSQL_TIME *res, return 0; } +void Item_func_curtime::print(String *str, enum_query_type query_type) +{ + str->append(func_name()); + str->append('('); + if (decimals) + str->append_ulonglong(decimals); + str->append(')'); +} + static void set_sec_part(ulong sec_part, MYSQL_TIME *ltime, Item *item) { DBUG_ASSERT(item->decimals == AUTO_SEC_PART_DIGITS || @@ -1704,6 +1713,15 @@ bool Item_func_now::fix_fields(THD *thd, Item **items) return Item_temporal_func::fix_fields(thd, items); } +void Item_func_now::print(String *str, enum_query_type query_type) +{ + str->append(func_name()); + str->append('('); + if (decimals) + str->append_ulonglong(decimals); + str->append(')'); +} + /** Converts current time in my_time_t to MYSQL_TIME represenatation for local time zone. Defines time zone (local) used for whole NOW function. @@ -2336,7 +2354,7 @@ void Item_temporal_typecast::print(String *str, enum_query_type query_type) args[0]->print(str, query_type); str->append(STRING_WITH_LEN(" as ")); str->append(cast_type()); - if (decimals) + if (decimals && decimals != NOT_FIXED_DEC) { str->append('('); str->append(llstr(decimals, buf)); diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 07b4ef92b2e..949401e19fd 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -655,6 +655,7 @@ public: { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } + void print(String *str, enum_query_type query_type); }; @@ -740,6 +741,7 @@ public: */ return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } + void print(String *str, enum_query_type query_type); }; @@ -747,7 +749,7 @@ class Item_func_now_local :public Item_func_now { public: Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - const char *func_name() const { return "now"; } + const char *func_name() const { return "current_timestamp"; } virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); virtual enum Functype functype() const { return NOW_FUNC; } Item *get_copy(THD *thd, MEM_ROOT *mem_root) diff --git a/sql/mysqld.h b/sql/mysqld.h index 02bbdf839c1..96944c012ce 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -662,13 +662,15 @@ enum enum_query_type QT_WITHOUT_INTRODUCERS= (1 << 1), /// view internal representation (like QT_ORDINARY except ORDER BY clause) QT_VIEW_INTERNAL= (1 << 2), - /// If identifiers should not include database names for the current database - QT_ITEM_IDENT_SKIP_CURRENT_DATABASE= (1 << 3), + /// If identifiers should not include database names, where unambiguous + QT_ITEM_IDENT_SKIP_DB_NAMES= (1 << 3), + /// If identifiers should not include table names, where unambiguous + QT_ITEM_IDENT_SKIP_TABLE_NAMES= (1 << 4), /// If Item_cache_wrapper should not print <expr_cache> - QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS= (1 << 4), + QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS= (1 << 5), /// If Item_subselect should print as just "(subquery#1)" /// rather than display the subquery body - QT_ITEM_SUBSELECT_ID_ONLY= (1 << 5), + QT_ITEM_SUBSELECT_ID_ONLY= (1 << 6), /// If NULLIF(a,b) should print itself as /// CASE WHEN a_for_comparison=b THEN NULL ELSE a_for_return_value END /// when "a" was replaced to two different items @@ -678,11 +680,11 @@ enum enum_query_type /// a_for_return_value is not the same as a_for_comparison. /// SHOW CREATE {VIEW|PROCEDURE|FUNCTION} and other cases where the /// original representation is required, should set this flag. - QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 <<6), + QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 << 7), /// This value means focus on readability, not on ability to parse back, etc. QT_EXPLAIN= QT_TO_SYSTEM_CHARSET | - QT_ITEM_IDENT_SKIP_CURRENT_DATABASE | + QT_ITEM_IDENT_SKIP_DB_NAMES | QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | QT_ITEM_SUBSELECT_ID_ONLY, diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 8f81d23816e..1fc22fa415f 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7395,9 +7395,9 @@ ER_CONSTRAINT_FAILED 23000 rus "проверка CONSTRAINT %`s для %`-.192s.%`-.192s провалилась" ukr "Перевірка CONSTRAINT %`s для %`-.192s.%`-.192s не пройшла" ER_EXPRESSION_IS_TOO_BIG - eng "%s expression in the %s clause is too big" + eng "Expression in the %s clause is too big" ER_ERROR_EVALUATING_EXPRESSION - eng "Got an error evaluating stored expression %`s" + eng "Got an error evaluating stored expression %s" ER_CALCULATING_DEFAULT_VALUE eng "Got an error when calculating default value for %`s" ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 01000 diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 003fe4f5366..f918e547148 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2353,6 +2353,12 @@ end_create: DBUG_RETURN(thd->is_error()); } +#define memdup_vcol(thd, vcol) \ + if (vcol) \ + { \ + (vcol)= (Virtual_column_info*)(thd)->memdup((vcol), sizeof(*(vcol))); \ + (vcol)->expr_item= NULL; \ + } /** As we can't let many client threads modify the same TABLE @@ -2374,7 +2380,6 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) { my_ptrdiff_t adjust_ptrs; Field **field,**org_field, *found_next_number_field; - Field **vfield= 0, **dfield_ptr= 0; TABLE *copy; TABLE_SHARE *share; uchar *bitmap; @@ -2437,14 +2442,6 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (!copy_tmp) goto error; - if (share->virtual_fields) - { - vfield= (Field **) client_thd->alloc((share->virtual_fields+1)* - sizeof(Field*)); - if (!vfield) - goto error; - } - /* Copy the TABLE object. */ copy= new (copy_tmp) TABLE; *copy= *table; @@ -2463,7 +2460,14 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) sizeof(Field*)); if (!copy->default_field) goto error; - dfield_ptr= copy->default_field; + } + + if (share->virtual_fields) + { + copy->vfield= (Field **) client_thd->alloc((share->virtual_fields+1)* + sizeof(Field*)); + if (!copy->vfield) + goto error; } copy->expr_arena= NULL; @@ -2481,12 +2485,14 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) found_next_number_field= table->found_next_number_field; for (org_field= table->field; *org_field; org_field++, field++) { - if (!(*field= (*org_field)->make_new_field(client_thd->mem_root, copy, - 1))) + if (!(*field= (*org_field)->make_new_field(client_thd->mem_root, copy, 1))) goto error; (*field)->unireg_check= (*org_field)->unireg_check; (*field)->orig_table= copy; // Remove connection (*field)->move_field_offset(adjust_ptrs); // Point at copy->record[0] + memdup_vcol(client_thd, (*field)->vcol_info); + memdup_vcol(client_thd, (*field)->default_value); + memdup_vcol(client_thd, (*field)->check_constraint); if (*org_field == found_next_number_field) (*field)->table->found_next_number_field= *field; } @@ -2499,42 +2505,9 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd) if (!(copy->def_vcol_set= (MY_BITMAP*) alloc_root(client_thd->mem_root, sizeof(MY_BITMAP)))) goto error; - copy->vfield= vfield; - for (field= copy->field; *field; field++) - { - Virtual_column_info *vcol; - if ((*field)->vcol_info) - { - if (!(vcol= unpack_vcol_info_from_frm(client_thd, - client_thd->mem_root, - copy, - 0, - (*field)->vcol_info, - &error_reported))) - goto error; - (*field)->vcol_info= vcol; - *vfield++= *field; - } - if ((*field)->default_value) - { - if (!(vcol= unpack_vcol_info_from_frm(client_thd, - client_thd->mem_root, - copy, - 0, - (*field)->default_value, - &error_reported))) - goto error; - (*field)->default_value= vcol; - *dfield_ptr++= *field; - } - else - if ((*field)->has_update_default_function()) - *dfield_ptr++= *field; - } - if (vfield) - *vfield= 0; - if (dfield_ptr) - *dfield_ptr= 0; + + if (parse_vcol_defs(client_thd, client_thd->mem_root, copy, &error_reported)) + goto error; } switch_defaults_to_nullable_trigger_fields(copy); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 273615e1489..e2f9e9432af 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1635,9 +1635,11 @@ static bool print_on_update_clause(Field *field, String *val, bool lcase) val->append(STRING_WITH_LEN("on update ")); else val->append(STRING_WITH_LEN("ON UPDATE ")); - val->append(STRING_WITH_LEN("CURRENT_TIMESTAMP")); + val->append(STRING_WITH_LEN("current_timestamp")); if (field->decimals() > 0) val->append_parenthesized(field->decimals()); + else + val->append(STRING_WITH_LEN("()")); return true; } return false; @@ -1657,51 +1659,42 @@ static bool get_field_default_value(THD *thd, Field *field, String *def_value, def_value->length(0); if (has_default) { + StringBuffer<MAX_FIELD_WIDTH> str(field->charset()); if (field->default_value) { + field->default_value->print(&str); if (field->default_value->expr_item->need_parentheses_in_default()) { def_value->set_charset(&my_charset_utf8mb4_general_ci); def_value->append('('); - def_value->append(field->default_value->expr_str.str, - field->default_value->expr_str.length); + def_value->append(str); def_value->append(')'); } - else if (field->unireg_check) - def_value->append(field->default_value->expr_str.str, - field->default_value->expr_str.length); else - def_value->set(field->default_value->expr_str.str, - field->default_value->expr_str.length, - &my_charset_utf8mb4_general_ci); + def_value->append(str); } else if (!field->is_null()) { // Not null by default - char tmp[MAX_FIELD_WIDTH]; - String type(tmp, sizeof(tmp), field->charset()); if (field_type == MYSQL_TYPE_BIT) { - longlong dec= field->val_int(); - char *ptr= longlong2str(dec, tmp + 2, 2); - uint32 length= (uint32) (ptr - tmp); - tmp[0]= 'b'; - tmp[1]= '\''; - tmp[length]= '\''; - type.length(length + 1); + str.qs_append('b'); + str.qs_append('\''); + str.qs_append(field->val_int(), 2); + str.qs_append('\''); quoted= 0; } else { - field->val_str(&type); + field->val_str(&str); if (!field->str_needs_quotes()) quoted= 0; } - if (type.length()) + if (str.length()) { - String def_val; + StringBuffer<MAX_FIELD_WIDTH> def_val; uint dummy_errors; /* convert to system_charset_info == utf8 */ - def_val.copy(type.ptr(), type.length(), field->charset(), + def_val.copy(str.ptr(), str.length(), field->charset(), system_charset_info, &dummy_errors); if (quoted) append_unescaped(def_value, def_val.ptr(), def_val.length()); @@ -1918,10 +1911,10 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, if (field->vcol_info) { + StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci); + field->vcol_info->print(&str); packet->append(STRING_WITH_LEN(" AS (")); - packet->append(field->vcol_info->expr_str.str, - field->vcol_info->expr_str.length, - &my_charset_utf8mb4_general_ci); + packet->append(str); packet->append(STRING_WITH_LEN(")")); if (field->vcol_info->stored_in_db) packet->append(STRING_WITH_LEN(" PERSISTENT")); @@ -1961,10 +1954,10 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, } if (field->check_constraint) { + StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci); + field->check_constraint->print(&str); packet->append(STRING_WITH_LEN(" CHECK (")); - packet->append(field->check_constraint->expr_str.str, - field->check_constraint->expr_str.length, - &my_charset_utf8mb4_general_ci); + packet->append(str); packet->append(STRING_WITH_LEN(")")); } @@ -2062,7 +2055,9 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, for (uint i= share->field_check_constraints; i < share->table_check_constraints ; i++) { + StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci); Virtual_column_info *check= table->check_constraints[i]; + check->print(&str); packet->append(STRING_WITH_LEN(",\n ")); if (check->name.length) @@ -2071,9 +2066,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, append_identifier(thd, packet, check->name.str, check->name.length); } packet->append(STRING_WITH_LEN(" CHECK (")); - packet->append(check->expr_str.str, - check->expr_str.length, - &my_charset_utf8mb4_general_ci); + packet->append(str); packet->append(STRING_WITH_LEN(")")); } } @@ -8447,7 +8440,7 @@ ST_FIELD_INFO columns_fields_info[]= OPEN_FRM_ONLY}, {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", OPEN_FRM_ONLY}, {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY}, - {"EXTRA", 27, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, + {"EXTRA", 30, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY}, {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 49442260704..62473e082c3 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -733,7 +733,7 @@ void String::qs_append(int i) void String::qs_append(ulonglong i) { char *buff= Ptr + str_length; - char *end= longlong10_to_str(i, buff,10); + char *end= longlong10_to_str(i, buff, 10); str_length+= (int) (end-buff); } diff --git a/sql/sql_string.h b/sql/sql_string.h index 8be23184741..4b70675dca4 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -584,6 +584,12 @@ public: qs_append((ulonglong)i); } void qs_append(ulonglong i); + void qs_append(longlong i, int radix) + { + char *buff= Ptr + str_length; + char *end= ll2str(i, buff, radix, 0); + str_length+= (int) (end-buff); + } /* Inline (general) functions used by the protocol functions */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5e93fac1ddd..1e985bc240b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3339,45 +3339,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (prepare_blob_field(thd, sql_field)) DBUG_RETURN(TRUE); - if (sql_field->default_value) - { - Virtual_column_info *def= sql_field->default_value; - - if (!sql_field->has_default_expression()) - def->expr_str= null_lex_str; - - if (!def->expr_item->basic_const_item() && !def->flags) - { - Item *expr= def->expr_item; - int err= !expr->fixed && // may be already fixed if ALTER TABLE - expr->fix_fields(thd, &expr); - if (!err) - { - if (expr->result_type() == REAL_RESULT) - { // don't convert floats to string and back, it can be lossy - double res= expr->val_real(); - if (expr->null_value) - expr= new (thd->mem_root) Item_null(thd); - else - expr= new (thd->mem_root) Item_float(thd, res, expr->decimals); - } - else - { - StringBuffer<MAX_FIELD_WIDTH> buf; - String *res= expr->val_str(&buf); - if (expr->null_value) - expr= new (thd->mem_root) Item_null(thd); - else - { - char *str= (char*) thd->strmake(res->ptr(), res->length()); - expr= new (thd->mem_root) Item_string(thd, str, res->length(), res->charset()); - } - } - thd->change_item_tree(&def->expr_item, expr); - } - } - } - /* Convert the default value from client character set into the column character set if necessary. @@ -4205,11 +4166,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (check_string_char_length(&check->name, 0, NAME_CHAR_LEN, system_charset_info, 1)) { - my_error(ER_TOO_LONG_IDENT, MYF(0), key->name.str); + my_error(ER_TOO_LONG_IDENT, MYF(0), check->name.str); DBUG_RETURN(TRUE); } - if (check_expression(check, "CONSTRAINT CHECK", - check->name.str ? check->name.str : "", 0)) + if (check_expression(check, check->name.str, VCOL_CHECK_TABLE)) DBUG_RETURN(TRUE); } } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6c6895434e4..1885c2e5aa5 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -910,27 +910,14 @@ bool LEX::set_bincmp(CHARSET_INFO *cs, bool bin) MYSQL_YYABORT; \ } while(0) -Virtual_column_info *add_virtual_expression(THD *thd, const char *txt, - size_t size, Item *expr) +Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) { - CHARSET_INFO *cs= thd->charset(); Virtual_column_info *v= new (thd->mem_root) Virtual_column_info(); if (!v) { mem_alloc_error(sizeof(Virtual_column_info)); return 0; } - /* - We have to remove white space as remember_cur_pos may have pointed to end - of previous expression. - */ - while (cs->state_map[*(uchar*)txt] == MY_LEX_SKIP) - { - txt++; - size--; - } - v->expr_str.str= (char* ) thd->strmake(txt, size); - v->expr_str.length= size; v->expr_item= expr; v->utf8= 0; /* connection charset */ return v; @@ -1761,7 +1748,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); table_ident_opt_wild create_like %type <simple_string> - remember_name remember_end opt_db remember_tok_start remember_cur_pos + remember_name remember_end opt_db remember_tok_start wild_and_where field_length opt_field_length opt_field_length_default_1 @@ -2005,7 +1992,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); definer_opt no_definer definer get_diagnostics parse_vcol_expr vcol_opt_specifier vcol_opt_attribute vcol_opt_attribute_list vcol_attribute - explainable_command opt_impossible_action + explainable_command END_OF_INPUT %type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt @@ -6120,10 +6107,10 @@ opt_check_constraint: ; check_constraint: - CHECK_SYM '(' remember_name expr remember_end ')' + CHECK_SYM '(' expr ')' { Virtual_column_info *v= - add_virtual_expression(thd, $3+1, (uint)($5 - $3) - 1, $4); + add_virtual_expression(thd, $3); if (!v) { MYSQL_YYABORT; @@ -6264,10 +6251,10 @@ parenthesized_expr: ; virtual_column_func: - '(' remember_cur_pos parenthesized_expr remember_end ')' + '(' parenthesized_expr ')' { Virtual_column_info *v= - add_virtual_expression(thd, $2, (uint)($4 - $2), $3); + add_virtual_expression(thd, $2); if (!v) { MYSQL_YYABORT; @@ -6280,19 +6267,13 @@ expr_or_literal: column_default_non_parenthesized_expr | signed_literal ; column_default_expr: virtual_column_func - | remember_name expr_or_literal opt_impossible_action remember_end + | expr_or_literal { - if (!($$= add_virtual_expression(thd, $1, (uint) ($4- $1), $2))) + if (!($$= add_virtual_expression(thd, $1))) MYSQL_YYABORT; } ; -/* This is to force remember_end to look at next token */ -opt_impossible_action: - IMPOSSIBLE_ACTION {} - | /* empty */ {} - - field_type: int_type opt_field_length field_options { $$.set($1, $2); } | real_type opt_precision field_options { $$.set($1, $2); } @@ -8747,12 +8728,6 @@ remember_tok_start: } ; -remember_cur_pos: - { - $$= (char*) YYLIP->get_cpp_ptr(); - } - ; - remember_name: { $$= (char*) YYLIP->get_cpp_tok_start(); diff --git a/sql/table.cc b/sql/table.cc index 6e54b6800e7..848352419d5 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -47,6 +47,9 @@ #define MYSQL57_GENERATED_FIELD 128 #define MYSQL57_GCOL_HEADER_SIZE 4 +static Virtual_column_info * unpack_vcol_info_from_frm(THD *, MEM_ROOT *, + TABLE *, const uchar *, size_t, Virtual_column_info *, bool *); +static bool check_vcol_forward_refs(Field *, Virtual_column_info *); /* INFORMATION_SCHEMA name */ LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")}; @@ -957,6 +960,159 @@ static void mysql57_calculate_null_position(TABLE_SHARE *share, } } + +/** Parse TABLE_SHARE::vcol_defs + + unpack_vcol_info_from_frm + 5.7 + byte 1 = 1 + byte 2,3 = expr length + byte 4 = stored_in_db + expression + 10.1- + byte 1 = 1 | 2 + byte 2 = sql_type + byte 3 = stored_in_db + [byte 4] = optional interval_id for sql_type (if byte 1 == 2) + expression + 10.2+ + byte 1 = type + byte 2,3 = field_number + byte 4,5 = length of expression + byte 6 = length of name + name + expression +*/ +bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, + bool *error_reported) +{ + const uchar *pos= table->s->vcol_defs.str; + const uchar *end= pos + table->s->vcol_defs.length; + Field **field_ptr= table->field - 1; + Field **vfield_ptr= table->vfield; + Field **dfield_ptr= table->default_field; + Virtual_column_info **check_constraint_ptr= table->check_constraints; + Virtual_column_info *vcol; + DBUG_ENTER("parse_vcol_defs"); + + if (check_constraint_ptr) + memcpy(table->check_constraints + table->s->field_check_constraints, + table->s->check_constraints, + table->s->table_check_constraints * sizeof(Virtual_column_info*)); + + while (pos < end) + { + uint type, expr_length; + if (table->s->mysql_version >= 100202) + { + uint field_nr, name_length; + /* see pack_expression() for how data is stored */ + type= pos[0]; + field_nr= uint2korr(pos+1); + expr_length= uint2korr(pos+3); + name_length= pos[5]; + pos+= FRM_VCOL_NEW_HEADER_SIZE + name_length; + field_ptr= table->field + field_nr; + } + else + { + /* + see below in ::init_from_binary_frm_image for how data is stored + in versions below 10.2 (that includes 5.7 too) + */ + while (*++field_ptr && !(*field_ptr)->vcol_info) /* no-op */; + if (!*field_ptr) + { + open_table_error(table->s, OPEN_FRM_CORRUPTED, 1); + DBUG_RETURN(1); + } + type= (*field_ptr)->vcol_info->stored_in_db + ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL; + expr_length= uint2korr(pos+1); + if (table->s->mysql_version > 50700 && table->s->mysql_version < 100000) + pos+= 4; // MySQL from 5.7 + else + pos+= pos[0] == 2 ? 4 : 3; // MariaDB from 5.2 to 10.1 + } + switch (type) { + case VCOL_GENERATED_VIRTUAL: + case VCOL_GENERATED_STORED: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, pos, expr_length, + (*field_ptr)->vcol_info, error_reported); + DBUG_ASSERT((*field_ptr)->vcol_info->expr_item == NULL); + (*field_ptr)->vcol_info= vcol; + *(vfield_ptr++)= *field_ptr; + break; + case VCOL_DEFAULT: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, pos, expr_length, + (*field_ptr)->default_value, + error_reported); + DBUG_ASSERT((*field_ptr)->default_value->expr_item == NULL); + (*field_ptr)->default_value= vcol; + *(dfield_ptr++)= *field_ptr; + break; + case VCOL_CHECK_FIELD: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, pos, expr_length, + (*field_ptr)->check_constraint, + error_reported); + DBUG_ASSERT((*field_ptr)->check_constraint->expr_item == NULL); + (*field_ptr)->check_constraint= vcol; + *check_constraint_ptr++= vcol; + break; + case VCOL_CHECK_TABLE: + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, pos, expr_length, + *check_constraint_ptr, error_reported); + *check_constraint_ptr++= vcol; + break; + } + if (!vcol) + DBUG_RETURN(1); + pos+= expr_length; + } + + /* Now, initialize CURRENT_TIMESTAMP fields */ + for (field_ptr= table->field; *field_ptr; field_ptr++) + { + Field *field= *field_ptr; + if (field->has_default_now_unireg_check()) + { + char buf[256]; + size_t len= my_snprintf(buf, sizeof(buf), "current_timestamp(%u)", field->decimals()); + vcol= unpack_vcol_info_from_frm(thd, mem_root, table, (uchar*)buf, len, + (*field_ptr)->default_value, + error_reported); + DBUG_ASSERT((*field_ptr)->default_value->expr_item == NULL); + (*field_ptr)->default_value= vcol; + *(dfield_ptr++)= *field_ptr; + if (!field->default_value->expr_item) + DBUG_RETURN(1); + } + else if (field->has_update_default_function() && !field->default_value) + *(dfield_ptr++)= *field_ptr; + } + + if (vfield_ptr) + *vfield_ptr= 0; + + if (dfield_ptr) + *dfield_ptr= 0; + + if (check_constraint_ptr) + *check_constraint_ptr= 0; + + /* Check that expressions aren't refering to not yet initialized fields */ + for (field_ptr= table->field; *field_ptr; field_ptr++) + { + Field *field= *field_ptr; + if (check_vcol_forward_refs(field, field->vcol_info) || + check_vcol_forward_refs(field, field->check_constraint) || + check_vcol_forward_refs(field, field->default_value)) + DBUG_RETURN(1); + } + + DBUG_RETURN(0); +} + /** Read data from a binary .frm file image into a TABLE_SHARE @@ -1452,6 +1608,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (!interval_count) share->intervals= 0; // For better debugging + share->vcol_defs.str= vcol_screen_pos; + share->vcol_defs.length= vcol_screen_length; + memcpy(names, strpos+(share->fields*field_pack_length), n_length+int_length); memcpy(comment_pos, disk_buff+read_length-com_length-vcol_screen_length, com_length); @@ -1535,8 +1694,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, mysql57_vcol_null_bit_pos= null_bit_pos; mysql57_calculate_null_position(share, &mysql57_vcol_null_pos, &mysql57_vcol_null_bit_pos, - strpos, - vcol_screen_pos); + strpos, vcol_screen_pos); } for (i=0 ; i < share->fields; i++, strpos+=field_pack_length, field_ptr++) @@ -1631,18 +1789,20 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, { unireg_type&= MYSQL57_GENERATED_FIELD; + /* + MySQL 5.7 generated fields + + byte 1 = 1 + byte 2,3 = expr length + byte 4 = stored_in_db + byte 5.. = expr + */ if ((uint)(vcol_screen_pos)[0] != 1) goto err; vcol_info= new (&share->mem_root) Virtual_column_info(); vcol_info_length= uint2korr(vcol_screen_pos + 1); DBUG_ASSERT(vcol_info_length); vcol_info->stored_in_db= vcol_screen_pos[3]; - if (!(vcol_info->expr_str.str= - (char *)memdup_root(&share->mem_root, - vcol_screen_pos + MYSQL57_GCOL_HEADER_SIZE, - vcol_info_length))) - goto err; - vcol_info->expr_str.length= vcol_info_length; vcol_info->utf8= 0; vcol_screen_pos+= vcol_info_length + MYSQL57_GCOL_HEADER_SIZE;; share->virtual_fields++; @@ -1657,8 +1817,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, Get virtual column data stored in the .frm file as follows: byte 1 = 1 | 2 byte 2 = sql_type - byte 3 = flags (as of now, 0 - no flags, - 1 - field is physically stored) + byte 3 = flags. 1 for stored_in_db [byte 4] = optional interval_id for sql_type (if byte 1 == 2) next byte ... = virtual column expression (text data) */ @@ -1670,20 +1829,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, interval_nr= (uint)vcol_screen_pos[3]; else if ((uint)vcol_screen_pos[0] != 1) goto err; - - vcol_info->stored_in_db= vcol_screen_pos[2]; + vcol_info->stored_in_db= vcol_screen_pos[2] & 1; vcol_expr_length= vcol_info_length - (uint)(FRM_VCOL_OLD_HEADER_SIZE(opt_interval_id)); - if (!(vcol_info->expr_str.str= - (char *)memdup_root(&share->mem_root, - vcol_screen_pos + - (uint) FRM_VCOL_OLD_HEADER_SIZE(opt_interval_id), - vcol_expr_length))) - goto err; - if (opt_interval_id) - interval_nr= (uint) vcol_screen_pos[3]; - vcol_info->expr_str.length= vcol_expr_length; vcol_info->utf8= 0; // before 10.2.1 the charset was unknown + int2store(vcol_screen_pos+1, vcol_expr_length); // for parse_vcol_defs() vcol_screen_pos+= vcol_info_length; share->virtual_fields++; } @@ -1768,11 +1918,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, /* Convert pre-10.2.2 timestamps to use Field::default_value */ unireg_check= (Field::utype) MTYP_TYPENR(unireg_type); - if (unireg_check == Field::TIMESTAMP_DNUN_FIELD) - unireg_check= Field::TIMESTAMP_UN_FIELD; - if (unireg_check == Field::TIMESTAMP_DN_FIELD) - unireg_check= Field::NONE; - *field_ptr= reg_field= make_field(share, &share->mem_root, record+recpos, (uint32) field_length, null_pos, null_bit_pos, pack_flag, field_type, charset, @@ -1782,17 +1927,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (!reg_field) // Not supported field type goto err; - if (unireg_check != (Field::utype) MTYP_TYPENR(unireg_type)) + if (unireg_check == Field::TIMESTAMP_DNUN_FIELD || + unireg_check == Field::TIMESTAMP_DN_FIELD) { - char buf[32]; - if (reg_field->decimals()) - my_snprintf(buf, sizeof(buf), "CURRENT_TIMESTAMP(%d)", reg_field->decimals()); - else - strmov(buf, "CURRENT_TIMESTAMP"); - reg_field->default_value= new (&share->mem_root) Virtual_column_info(); reg_field->default_value->stored_in_db= 1; - thd->make_lex_string(®_field->default_value->expr_str, buf, strlen(buf)); share->default_expressions++; } @@ -1814,11 +1953,15 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, null_pos++; } - if (mysql57_null_bits && vcol_info && !vcol_info->stored_in_db) + if (vcol_info) { - /* MySQL 5.7 has null bits last */ - swap_variables(uchar*, null_pos, mysql57_vcol_null_pos); - swap_variables(uint, null_bit_pos, mysql57_vcol_null_bit_pos); + vcol_info->name.str= const_cast<char*>(reg_field->field_name); + if (mysql57_null_bits && !vcol_info->stored_in_db) + { + /* MySQL 5.7 has null bits last */ + swap_variables(uchar*, null_pos, mysql57_vcol_null_pos); + swap_variables(uint, null_bit_pos, mysql57_vcol_null_bit_pos); + } } if (f_no_default(pack_flag)) @@ -2169,6 +2312,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, /* Skip header */ vcol_screen_pos+= FRM_VCOL_NEW_BASE_SIZE; + share->vcol_defs.str+= FRM_VCOL_NEW_BASE_SIZE; + share->vcol_defs.length-= FRM_VCOL_NEW_BASE_SIZE; /* Read virtual columns, default values and check constraints @@ -2181,40 +2326,28 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, uint field_nr= uint2korr(vcol_screen_pos+1); uint expr_length= uint2korr(vcol_screen_pos+3); uint name_length= (uint) vcol_screen_pos[5]; - LEX_STRING name; - char *expr; - vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE; - - name.str= 0; - if ((name.length= name_length)) - { - if (!(name.str= strmake_root(&share->mem_root, - (char*) vcol_screen_pos, - name_length))) - goto err; - } - vcol_screen_pos+= name_length; - if (!(vcol_info= new (&share->mem_root) Virtual_column_info()) || - !(expr= (char *) strmake_root(&share->mem_root, - (char*) vcol_screen_pos, - expr_length))) + if (!(vcol_info= new (&share->mem_root) Virtual_column_info())) goto err; - vcol_info->name= name; - /* The following can only be true for check_constraints */ + if (field_nr != UINT_MAX16) { DBUG_ASSERT(field_nr < share->fields); reg_field= share->field[field_nr]; } - vcol_info->expr_str.str= expr; - vcol_info->expr_str.length= expr_length; - vcol_screen_pos+= expr_length; + vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE; + vcol_info->name.length= name_length; + if (name_length) + vcol_info->name.str= strmake_root(&share->mem_root, + (char*)vcol_screen_pos, name_length); + else + vcol_info->name.str= const_cast<char*>(reg_field->field_name); + vcol_screen_pos+= name_length + expr_length; switch (type) { - case 0: // Generated virtual field + case VCOL_GENERATED_VIRTUAL: { uint recpos; reg_field->vcol_info= vcol_info; @@ -2226,24 +2359,24 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, share->stored_rec_length= recpos-1; break; } - case 1: // Generated stored field + case VCOL_GENERATED_STORED: vcol_info->stored_in_db= 1; DBUG_ASSERT(!reg_field->vcol_info); reg_field->vcol_info= vcol_info; share->virtual_fields++; break; - case 2: // Default expression + case VCOL_DEFAULT: vcol_info->stored_in_db= 1; DBUG_ASSERT(!reg_field->default_value); reg_field->default_value= vcol_info; share->default_expressions++; break; - case 3: // Field check constraint + case VCOL_CHECK_FIELD: DBUG_ASSERT(!reg_field->check_constraint); reg_field->check_constraint= vcol_info; share->field_check_constraints++; break; - case 4: // Table check constraint + case VCOL_CHECK_TABLE: *(table_check_constraints++)= vcol_info; break; } @@ -2537,7 +2670,9 @@ static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol) if (unlikely(error)) { - my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), vcol->expr_str); + StringBuffer<MAX_FIELD_WIDTH> str; + vcol->print(&str); + my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), str.c_ptr()); DBUG_RETURN(1); } @@ -2609,7 +2744,7 @@ bool fix_session_vcol_expr_for_read(THD *thd, Field *field, FALSE Otherwise */ -static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, +static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Virtual_column_info *vcol) { Item* func_expr= vcol->expr_item; @@ -2647,7 +2782,7 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, if (error || (res.errors & VCOL_IMPOSSIBLE)) { // this can only happen if the frm was corrupted my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name, - "???", field ? field->field_name : "?????"); + "???", "?????"); DBUG_RETURN(1); } vcol->flags= res.errors; @@ -2697,12 +2832,10 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, Field *field, @retval NULL Error */ -Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, - MEM_ROOT *mem_root, - TABLE *table, - Field *field, - Virtual_column_info *vcol, - bool *error_reported) +static Virtual_column_info * +unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table, + const uchar *expr_str, size_t expr_str_length, + Virtual_column_info *vcol, bool *error_reported) { char *vcol_expr_str; int str_len; @@ -2713,12 +2846,10 @@ Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, Create_field vcol_storage; // placeholder for vcol_info Parser_state parser_state; Virtual_column_info *vcol_info= 0; - LEX_STRING *vcol_expr= &vcol->expr_str; LEX *old_lex= thd->lex; LEX lex; bool error; DBUG_ENTER("unpack_vcol_info_from_frm"); - DBUG_ASSERT(vcol_expr); save_character_set_client= thd->variables.character_set_client; save_collation= thd->variables.collation_connection; @@ -2731,14 +2862,14 @@ Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, */ if (!(vcol_expr_str= (char*) alloc_root(mem_root, - vcol_expr->length + + expr_str_length + parse_vcol_keyword.length + 3))) DBUG_RETURN(0); memcpy(vcol_expr_str, parse_vcol_keyword.str, parse_vcol_keyword.length); str_len= parse_vcol_keyword.length; vcol_expr_str[str_len++]= '('; - memcpy(vcol_expr_str + str_len, vcol_expr->str, vcol_expr->length); - str_len+= vcol_expr->length; + memcpy(vcol_expr_str + str_len, expr_str, expr_str_length); + str_len+= expr_str_length; vcol_expr_str[str_len++]= ')'; vcol_expr_str[str_len++]= 0; @@ -2787,7 +2918,7 @@ Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, vcol_storage.vcol_info->stored_in_db= vcol->stored_in_db; vcol_storage.vcol_info->name= vcol->name; vcol_storage.vcol_info->utf8= vcol->utf8; - if (!fix_and_check_vcol_expr(thd, table, field, vcol_storage.vcol_info)) + if (!fix_and_check_vcol_expr(thd, table, vcol_storage.vcol_info)) { vcol_info= vcol_storage.vcol_info; // Expression ok goto end; @@ -3023,104 +3154,14 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, if (share->table_check_constraints || share->field_check_constraints) outparam->check_constraints= check_constraint_ptr; - /* Reuse the same loop both for virtual, default and check fields */ - for (field_ptr= outparam->field; *field_ptr; field_ptr++) - { - Field *field= *field_ptr; - if (field->vcol_info) - { - Virtual_column_info *vcol; - field->vcol_info->name.str= (char*) field->field_name; - if (!(vcol= unpack_vcol_info_from_frm(thd, &outparam->mem_root, - outparam, *field_ptr, - field->vcol_info, - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - field->vcol_info= vcol; - *(vfield_ptr++)= *field_ptr; - } - - if (field->check_constraint) - { - Virtual_column_info *vcol; - field->check_constraint->name.str= - (char*) field->field_name; - if (!(vcol= unpack_vcol_info_from_frm(thd, &outparam->mem_root, - outparam, 0, - field->check_constraint, - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - field->check_constraint= vcol; - *(check_constraint_ptr++)= vcol; - } - - if (field->default_value) - { - Virtual_column_info *vcol; - field->default_value->name.str= - (char*) field->field_name; - if (!(vcol= unpack_vcol_info_from_frm(thd, &outparam->mem_root, - outparam, *field_ptr, - field->default_value, - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - field->default_value= vcol; - *(dfield_ptr++)= *field_ptr; - } - else - if (field->has_update_default_function()) - *(dfield_ptr++)= *field_ptr; - - } - *vfield_ptr= 0; // End marker - *dfield_ptr= 0; // End marker - - /* Check that expressions aren't refering to not yet initialized fields */ - for (field_ptr= outparam->field; *field_ptr; field_ptr++) + if (parse_vcol_defs(thd, &outparam->mem_root, outparam, &error_reported)) { - Field *field= *field_ptr; - if (check_vcol_forward_refs(field, field->vcol_info) || - check_vcol_forward_refs(field, field->check_constraint) || - check_vcol_forward_refs(field, field->default_value)) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } + error= OPEN_FRM_CORRUPTED; + goto err; } /* Update to use trigger fields */ switch_defaults_to_nullable_trigger_fields(outparam); - - /* Copy table level constraints to check_constraint_ptr */ - for (i= 0 ; - i < share->table_check_constraints - share->field_check_constraints; - i++) - { - if (!(*check_constraint_ptr= - unpack_vcol_info_from_frm(thd, - &outparam->mem_root, - outparam, - 0, - share->check_constraints[i], - &error_reported))) - { - error= OPEN_FRM_CORRUPTED; - goto err; - } - (*check_constraint_ptr)->name= share->check_constraints[i]->name; - check_constraint_ptr++; - } - - *check_constraint_ptr= 0; // End marker } #ifdef WITH_PARTITION_STORAGE_ENGINE @@ -3776,8 +3817,8 @@ rename_file_ext(const char * from,const char * to,const char * ext) bool get_field(MEM_ROOT *mem, Field *field, String *res) { - char buff[MAX_FIELD_WIDTH], *to; - String str(buff,sizeof(buff),&my_charset_bin); + char *to; + StringBuffer<MAX_FIELD_WIDTH> str; bool rc; THD *thd= field->get_thd(); sql_mode_t sql_mode_backup= thd->variables.sql_mode; @@ -4060,13 +4101,11 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def) is backward compatible. */ } - char buffer[1024]; + StringBuffer<1024> sql_type(system_charset_info); + sql_type.extra_allocation(256); // Allocate min 256 characters at once for (i=0 ; i < table_def->count; i++, field_def++) { - String sql_type(buffer, sizeof(buffer), system_charset_info); sql_type.length(0); - /* Allocate min 256 characters at once */ - sql_type.extra_allocation(256); if (i < table->s->fields) { Field *field= table->field[i]; @@ -7390,7 +7429,7 @@ int TABLE::update_virtual_field(Field *vf) int TABLE::update_default_fields(bool update_command, bool ignore_errors) { - DBUG_ENTER("update_default_fields"); + DBUG_ENTER("TABLE::update_default_fields"); Field **field_ptr; int res= 0; DBUG_ASSERT(default_field); @@ -7412,8 +7451,6 @@ int TABLE::update_default_fields(bool update_command, bool ignore_errors) if (field->default_value && (field->default_value->flags || field->flags & BLOB_FLAG)) res|= (field->default_value->expr_item->save_in_field(field, 0) < 0); - else - res|= field->evaluate_insert_default_function(); } else res|= field->evaluate_update_default_function(); diff --git a/sql/table.h b/sql/table.h index 4ecc8f89b9e..c2c523181a0 100644 --- a/sql/table.h +++ b/sql/table.h @@ -582,6 +582,7 @@ struct TABLE_SHARE KEY *key_info; /* data of keys in database */ Virtual_column_info **check_constraints; uint *blob_field; /* Index to blobs in Field arrray*/ + LEX_CUSTRING vcol_defs; /* definitions of generated columns */ TABLE_STATISTICS_CB stats_cb; @@ -2668,11 +2669,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); bool fix_session_vcol_expr_for_read(THD *thd, Field *field, Virtual_column_info *vcol); -Virtual_column_info *unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, - TABLE *table, - Field *field, - Virtual_column_info *vcol, - bool *error_reported); +bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, + bool *error_reported); TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, const char *key, uint key_length); void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, diff --git a/sql/unireg.cc b/sql/unireg.cc index 66fde186b5b..c102835a7bb 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -42,13 +42,11 @@ static uint pack_keys(uchar *,uint, KEY *, ulong); static bool pack_header(THD *, uchar *, List<Create_field> &, HA_CREATE_INFO *, ulong, handler *); +static bool pack_vcols(String *, List<Create_field> &, List<Virtual_column_info> *); static uint get_interval_id(uint *,List<Create_field> &, Create_field *); static bool pack_fields(uchar **, List<Create_field> &, HA_CREATE_INFO*, ulong); -static void pack_constraints(uchar **buff, List<Virtual_column_info> *constr); static size_t packed_fields_length(List<Create_field> &); -static size_t packed_constraints_length(THD *, HA_CREATE_INFO*, - List<Virtual_column_info> *); static bool make_empty_rec(THD *, uchar *, uint, List<Create_field> &, uint, ulong); @@ -120,6 +118,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, int error; uchar *frm_ptr, *pos; LEX_CUSTRING frm= {0,0}; + StringBuffer<MAX_FIELD_WIDTH> vcols; DBUG_ENTER("build_frm_image"); /* If fixed row records, we need one bit to check for deleted rows */ @@ -127,9 +126,19 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, create_info->null_bits++; data_offset= (create_info->null_bits + 7) / 8; + sql_mode_t save_sql_mode= thd->variables.sql_mode; + thd->variables.sql_mode &= ~MODE_ANSI_QUOTES; + error= pack_vcols(&vcols, create_fields, create_info->check_constraint_list); + thd->variables.sql_mode= save_sql_mode; + + if (error) + DBUG_RETURN(frm); + + if (vcols.length()) + create_info->expression_length= vcols.length() + FRM_VCOL_NEW_BASE_SIZE; + error= pack_header(thd, forminfo, create_fields, create_info, data_offset, db_file); - if (error) DBUG_RETURN(frm); @@ -336,6 +345,15 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table, if (pack_fields(&pos, create_fields, create_info, data_offset)) goto err; + if (vcols.length()) + { + /* Store header for packed fields (extra space for future) */ + bzero(pos, FRM_VCOL_NEW_BASE_SIZE); + pos+= FRM_VCOL_NEW_BASE_SIZE; + memcpy(pos, vcols.ptr(), vcols.length()); + pos+= vcols.length(); + } + { /* Restore all UCS2 intervals. @@ -496,92 +514,73 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, /** - Calculate and check length of stored expression (virtual, def, check) - - Convert string to utf8, if it isn't already + Pack the expression (for GENERATED ALWAYS AS, DEFAULT, CHECK) - @param thd Thread handler. Used for memory allocation - @param v_col Virtual expression. Can be 0 - @param CREATE INFO For characterset - @param length Sum total lengths here - - Note to make calls easier, one can call this with v_col == 0 + The data is stored as: + 1 byte type (enum_vcol_info_type) + 2 bytes field_number + 2 bytes length of expression + 1 byte length of name + name + next bytes column expression (text data) @return 0 ok @return 1 error (out of memory or wrong characters in expression) */ -static bool add_expr_length(THD *thd, Virtual_column_info **v_col_ptr, - size_t *length) +static bool pack_expression(String *buf, Virtual_column_info *vcol, + uint field_nr, enum_vcol_info_type type) { - Virtual_column_info *v_col= *v_col_ptr; - if (!v_col) - return 0; - - /* - Convert string to utf8 for storage. - */ - if (!v_col->utf8) - { - /* - This v_col comes from the parser (e.g. CREATE TABLE) or - from old (before 10.2.1) frm. - - We have to create a new Virtual_column_info as for alter table, - the current one may be shared with the original table. - */ - Virtual_column_info *new_vcol= new (thd->mem_root) Virtual_column_info(); - LEX_STRING to; - if (thd->copy_with_error(&my_charset_utf8mb4_general_ci, - &to, - thd->variables.character_set_client, - v_col->expr_str.str, v_col->expr_str.length)) - return 1; - *new_vcol= *v_col; - new_vcol->expr_str= to; - new_vcol->utf8= 1; - *v_col_ptr= new_vcol; - v_col= new_vcol; - } - - /* - Sum up the length of the expression string, it's optional name - and the header. - */ - (*length)+= (FRM_VCOL_NEW_HEADER_SIZE + v_col->name.length + - v_col->expr_str.length); + if (buf->reserve(FRM_VCOL_NEW_HEADER_SIZE + vcol->name.length)) + return 1; + + buf->q_append((char) type); + buf->q_append2b(field_nr); + size_t len_off= buf->length(); + buf->q_append2b(0); // to be added later + buf->q_append((char)vcol->name.length); + buf->q_append(vcol->name.str, vcol->name.length); + size_t expr_start= buf->length(); + vcol->print(buf); + size_t expr_len= buf->length() - expr_start; + if (expr_len >= 65536) + { + my_error(ER_EXPRESSION_IS_TOO_BIG, MYF(0), vcol_type_name(type)); + return 1; + } + int2store(buf->ptr() + len_off, expr_len); return 0; } -/* - pack_expression - - The data is stored as: - 1 byte type (0 virtual, 1 virtual stored, 2 def, 3 check) - 2 bytes field_number - 2 bytes length of expression - 1 byte length of name - name - next bytes column expression (text data) -*/ - -static void pack_expression(uchar **buff, Virtual_column_info *vcol, - uint offset, uint type) +static bool pack_vcols(String *buf, List<Create_field> &create_fields, + List<Virtual_column_info> *check_constraint_list) { - (*buff)[0]= (uchar) type; - int2store((*buff)+1, offset); - /* - expr_str.length < 64K as we have checked that the total size of the - frm file is < 64K - */ - int2store((*buff)+3, vcol->expr_str.length); - (*buff)[5]= vcol->name.length; - (*buff)+= FRM_VCOL_NEW_HEADER_SIZE; - memcpy((*buff), vcol->name.str, vcol->name.length); - (*buff)+= vcol->name.length; - memcpy((*buff), vcol->expr_str.str, vcol->expr_str.length); - (*buff)+= vcol->expr_str.length; + List_iterator<Create_field> it(create_fields); + Create_field *field; + + for (uint field_nr=0; (field= it++); field_nr++) + { + if (field->vcol_info) + if (pack_expression(buf, field->vcol_info, field_nr, + field->vcol_info->stored_in_db + ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL)) + return 1; + if (field->has_default_expression() && !field->has_default_now_unireg_check()) + if (pack_expression(buf, field->default_value, field_nr, VCOL_DEFAULT)) + return 1; + if (field->check_constraint) + if (pack_expression(buf, field->check_constraint, field_nr, + VCOL_CHECK_FIELD)) + return 1; + } + + List_iterator<Virtual_column_info> cit(*check_constraint_list); + Virtual_column_info *check; + while ((check= cit++)) + if (pack_expression(buf, check, UINT_MAX32, VCOL_CHECK_TABLE)) + return 1; + return 0; } @@ -592,10 +591,10 @@ static bool pack_header(THD *thd, uchar *forminfo, HA_CREATE_INFO *create_info, ulong data_offset, handler *file) { - uint length,int_count,int_length, int_parts; + uint int_count,int_length, int_parts; uint time_stamp_pos,null_fields; uint table_options= create_info->table_options; - size_t reclength, totlength, n_length, com_length, expression_length; + size_t length, reclength, totlength, n_length, com_length; DBUG_ENTER("pack_header"); if (create_fields.elements > MAX_FIELDS) @@ -611,16 +610,6 @@ static bool pack_header(THD *thd, uchar *forminfo, n_length=2L; create_info->field_check_constraints= 0; - if (create_info->check_constraint_list->elements) - { - expression_length= packed_constraints_length(thd, create_info, - create_info->check_constraint_list); - if (!expression_length) - DBUG_RETURN(1); // Wrong characterset - } - else - expression_length= 0; - /* Check fields */ List_iterator<Create_field> it(create_fields); Create_field *field; @@ -630,14 +619,6 @@ static bool pack_header(THD *thd, uchar *forminfo, ER_TOO_LONG_FIELD_COMMENT, field->field_name)) DBUG_RETURN(1); - if (add_expr_length(thd, &field->vcol_info, &expression_length)) - DBUG_RETURN(1); - if (field->default_value && field->default_value->expr_str.length) - if (add_expr_length(thd, &field->default_value, &expression_length)) - DBUG_RETURN(1); - if (add_expr_length(thd, &field->check_constraint, &expression_length)) - DBUG_RETURN(1); - totlength+= field->length; com_length+= field->comment.length; /* @@ -714,31 +695,22 @@ static bool pack_header(THD *thd, uchar *forminfo, DBUG_RETURN(1); } - if (expression_length) - { - expression_length+= FRM_VCOL_NEW_BASE_SIZE; - create_info->expression_length= expression_length; - } - /* Hack to avoid bugs with small static rows in MySQL */ - reclength=MY_MAX(file->min_record_length(table_options),reclength); - if ((ulong) create_fields.elements*FCOMP+FRM_FORMINFO_SIZE+ - n_length+int_length+com_length+expression_length > 65535L || - int_count > 255) + reclength= MY_MAX(file->min_record_length(table_options), reclength); + length= n_length + create_fields.elements*FCOMP + FRM_FORMINFO_SIZE + + int_length + com_length + create_info->expression_length; + if (length > 65535L || int_count > 255) { my_message(ER_TOO_MANY_FIELDS, "Table definition is too large", MYF(0)); DBUG_RETURN(1); } bzero((char*)forminfo,FRM_FORMINFO_SIZE); - length=(create_fields.elements*FCOMP+FRM_FORMINFO_SIZE+n_length+int_length+ - com_length+expression_length); int2store(forminfo,length); - forminfo[256] = 0; int2store(forminfo+258,create_fields.elements); - int2store(forminfo+260,0); // Screen length, not used anymore + // bytes 260-261 are unused int2store(forminfo+262,totlength); - int2store(forminfo+264,0); // unused + // bytes 264-265 are unused int2store(forminfo+266,reclength); int2store(forminfo+268,n_length); int2store(forminfo+270,int_count); @@ -749,7 +721,7 @@ static bool pack_header(THD *thd, uchar *forminfo, int2store(forminfo+280,22); /* Rows needed */ int2store(forminfo+282,null_fields); int2store(forminfo+284,com_length); - int2store(forminfo+286,expression_length); + int2store(forminfo+286,create_info->expression_length); DBUG_RETURN(0); } /* pack_header */ @@ -811,29 +783,6 @@ static size_t packed_fields_length(List<Create_field> &create_fields) DBUG_RETURN(length); } - -static size_t packed_constraints_length(THD *thd, HA_CREATE_INFO *info, - List<Virtual_column_info> *constr) -{ - List_iterator<Virtual_column_info> it(*constr); - size_t length= 0; - Virtual_column_info *check; - - while ((check= it++)) - if (add_expr_length(thd, it.ref(), &length)) - return 0; - return length; -} - -static void pack_constraints(uchar **buff, List<Virtual_column_info> *constr) -{ - List_iterator<Virtual_column_info> it(*constr); - Virtual_column_info *check; - while ((check= it++)) - pack_expression(buff, check, UINT_MAX32, 4); -} - - /* Save fields, fieldnames and intervals */ static bool pack_fields(uchar **buff_arg, List<Create_field> &create_fields, @@ -959,27 +908,6 @@ static bool pack_fields(uchar **buff_arg, List<Create_field> &create_fields, buff+= field->comment.length; } } - - if (create_info->expression_length) - { - /* Store header for packed fields (extra space for future) */ - bzero(buff, FRM_VCOL_NEW_BASE_SIZE); - buff+= FRM_VCOL_NEW_BASE_SIZE; - - /* Store expressions */ - it.rewind(); - for (uint field_nr=0 ; (field= it++) ; field_nr++) - { - if (field->vcol_info) - pack_expression(&buff, field->vcol_info, field_nr, - field->vcol_info->stored_in_db ? 1 : 0); - if (field->default_value && field->default_value->expr_str.length) - pack_expression(&buff, field->default_value, field_nr, 2); - if (field->check_constraint) - pack_expression(&buff, field->check_constraint, field_nr, 3); - } - pack_constraints(&buff, create_info->check_constraint_list); - } *buff_arg= buff; DBUG_RETURN(0); } @@ -1028,12 +956,9 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, field->sql_type, field->charset, field->geom_type, field->srid, - field->unireg_check == Field::TIMESTAMP_DNUN_FIELD - ? Field::TIMESTAMP_UN_FIELD - : field->unireg_check == Field::TIMESTAMP_DN_FIELD - ? Field::NONE : field->unireg_check, - field->save_interval ? field->save_interval : - field->interval, + field->unireg_check, + field->save_interval ? field->save_interval + : field->interval, field->field_name); if (!regfield) { @@ -1053,9 +978,14 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options, if (field->sql_type == MYSQL_TYPE_BIT && !f_bit_as_char(field->pack_flag)) null_count+= field->length & 7; - if (field->default_value && !field->has_default_expression()) + if (field->default_value && !field->default_value->flags && + !(field->flags & BLOB_FLAG)) { - int res= field->default_value->expr_item->save_in_field(regfield, 1); + Item *expr= field->default_value->expr_item; + int res= !expr->fixed && // may be already fixed if ALTER TABLE + expr->fix_fields(thd, &expr); + if (!res) + res= expr->save_in_field(regfield, 1); /* If not ok or warning of level 'note' */ if (res != 0 && res != 3) { diff --git a/storage/connect/mysql-test/connect/r/mysql_new.result b/storage/connect/mysql-test/connect/r/mysql_new.result index 05071ef7be6..9236ee691e5 100644 --- a/storage/connect/mysql-test/connect/r/mysql_new.result +++ b/storage/connect/mysql-test/connect/r/mysql_new.result @@ -200,7 +200,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `e` year(4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); @@ -220,7 +220,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `e` year(4) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' SELECT * FROM t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result index 0190f4cdd30..cd75598a7ee 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_fractional_seconds_with_index.result @@ -11,7 +11,7 @@ Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` text DEFAULT NULL, - `created_at` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `created_at` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `updated_at` timestamp(6) NOT NULL DEFAULT '0000-00-00 00:00:00.000000', PRIMARY KEY (`id`), KEY `updated_at` (`updated_at`) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result index 4690200c872..3f93ce03ca6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_timestamp_with_index.result @@ -11,7 +11,7 @@ Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` text DEFAULT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `updated_at` (`updated_at`) diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result index d2a00b777ec..54a9a274835 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/create_table_TODO_SPLIT_ME.result @@ -64,7 +64,7 @@ drop table t1; create table t1 (c1 timestamp); desc t1; Field Type Null Key Default Extra -c1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +c1 timestamp NO current_timestamp() on update current_timestamp() drop table t1; create table t1 (c1 datetime); desc t1; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result index dc7127b7245..bdffb91739b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_with_fractional_seconds.result @@ -6,7 +6,7 @@ title TEXT SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), + `time` timestamp(6) NOT NULL DEFAULT current_timestamp(6) ON UPDATE current_timestamp(6), `title` text DEFAULT NULL, PRIMARY KEY (`time`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result index 3a782044128..6ad90fb4107 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/index_primary_timestamp_without_fractional_seconds.result @@ -6,7 +6,7 @@ title TEXT SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `time` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `title` text DEFAULT NULL, PRIMARY KEY (`time`) ) ENGINE=Mroonga DEFAULT CHARSET=utf8 diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result index b3814331038..49e5e0a1466 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/create_table_TODO_SPLIT_ME.result @@ -63,7 +63,7 @@ drop table t1; create table t1 (c1 timestamp primary key) COMMENT = 'engine "innodb"'; desc t1; Field Type Null Key Default Extra -c1 timestamp NO PRI CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +c1 timestamp NO PRI current_timestamp() on update current_timestamp() drop table t1; create table t1 (c1 datetime primary key) COMMENT = 'engine "innodb"'; desc t1; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result index f0ceb937a01..ab3e86baec3 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_primary_key_myisam.result @@ -8,7 +8,7 @@ PRIMARY KEY (date, title) SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( - `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `title` varchar(100) NOT NULL, `content` text NOT NULL, PRIMARY KEY (`date`,`title`) diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result index 97428b768a6..0a9709a1d31 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/insert_on_duplicate_key_update_multiple_column_unique_index_myisam.result @@ -10,7 +10,7 @@ SHOW CREATE TABLE diaries; Table Create Table diaries CREATE TABLE `diaries` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `title` varchar(100) NOT NULL, `content` text NOT NULL, PRIMARY KEY (`id`), diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result index d2f0b52c446..7ca36e07438 100644 --- a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result +++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result @@ -123,7 +123,7 @@ show create table t1; Table Create Table t1 CREATE TABLE t1 ( a int(11) NOT NULL DEFAULT 5, - b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + b timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), c tinyblob DEFAULT NULL, d decimal(5,2) DEFAULT NULL, e varchar(30) CHARACTER SET ascii DEFAULT NULL, diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_slave_tokudb.result b/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_slave_tokudb.result index e27a42a0af5..6caa51128f9 100644 --- a/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_slave_tokudb.result +++ b/storage/tokudb/mysql-test/rpl/r/rpl_extra_col_slave_tokudb.result @@ -675,7 +675,7 @@ t16 CREATE TABLE `t16` ( `c4` blob DEFAULT NULL, `c5` char(5) DEFAULT NULL, `c6` int(11) DEFAULT 1, - `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `c7` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`c1`) ) ENGINE=TokuDB DEFAULT CHARSET=latin1 PARTITION BY KEY (c1) diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_partition_tokudb.result b/storage/tokudb/mysql-test/rpl/r/rpl_partition_tokudb.result index d8344e088e2..7b731bc785c 100644 --- a/storage/tokudb/mysql-test/rpl/r/rpl_partition_tokudb.result +++ b/storage/tokudb/mysql-test/rpl/r/rpl_partition_tokudb.result @@ -55,7 +55,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -69,7 +69,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -99,7 +99,7 @@ show create table test.byrange_tbl; Table Create Table byrange_tbl CREATE TABLE `byrange_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, @@ -113,7 +113,7 @@ show create table test.regular_tbl; Table Create Table regular_tbl CREATE TABLE `regular_tbl` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` varbinary(255) DEFAULT NULL, `fkid` int(11) DEFAULT NULL, diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_bug28430.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_bug28430.result index 57e69bbb007..4858d5f099b 100644 --- a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_bug28430.result +++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_bug28430.result @@ -108,7 +108,7 @@ show create table test.byrange_tbl; Table byrange_tbl Create Table CREATE TABLE `byrange_tbl` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, - `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `dt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `user` char(255) DEFAULT NULL, `uuidf` longblob DEFAULT NULL, `fkid` mediumint(9) DEFAULT NULL, diff --git a/storage/tokudb/mysql-test/tokudb/r/type_ranges.result b/storage/tokudb/mysql-test/tokudb/r/type_ranges.result index 12f1bcde3e2..07803071fe8 100644 --- a/storage/tokudb/mysql-test/tokudb/r/type_ranges.result +++ b/storage/tokudb/mysql-test/tokudb/r/type_ranges.result @@ -55,7 +55,7 @@ ushort smallint(5) unsigned zerofill NULL NO MUL 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field date NULL YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -227,7 +227,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO MUL 0 # ulong int(11) unsigned NULL NO MUL 0 # ulonglong bigint(13) unsigned NULL NO MUL 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # @@ -253,7 +253,7 @@ ushort smallint(5) unsigned zerofill NULL NO 00000 # umedium mediumint(8) unsigned NULL NO 0 # ulong int(11) unsigned NULL NO 0 # ulonglong bigint(13) unsigned NULL NO 0 # -time_stamp timestamp NULL NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP # +time_stamp timestamp NULL NO current_timestamp() on update current_timestamp() # date_field char(10) latin1_swedish_ci YES NULL # time_field time NULL YES NULL # date_time datetime NULL YES NULL # diff --git a/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result b/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result index c412620173c..c19bf85e2b1 100644 --- a/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result +++ b/storage/tokudb/mysql-test/tokudb/r/type_timestamp.result @@ -216,13 +216,13 @@ t1 t2 t3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp(), `t2` datetime DEFAULT NULL, `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=TokuDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; @@ -243,12 +243,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT '2003-01-01 00:00:00' ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=TokuDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO 2003-01-01 00:00:00 on update CURRENT_TIMESTAMP +t1 timestamp NO 2003-01-01 00:00:00 on update current_timestamp() t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp NOT NULL DEFAULT now() on update now(), t2 datetime); @@ -268,12 +268,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=TokuDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL drop table t1; create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'); @@ -293,13 +293,13 @@ t1 t2 t3 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL, `t3` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ) ENGINE=TokuDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL t3 timestamp NO 0000-00-00 00:00:00 drop table t1; @@ -320,12 +320,12 @@ t1 t2 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `t1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `t1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `t2` datetime DEFAULT NULL ) ENGINE=TokuDB DEFAULT CHARSET=latin1 show columns from t1; Field Type Null Key Default Extra -t1 timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +t1 timestamp NO current_timestamp() on update current_timestamp() t2 datetime YES NULL truncate table t1; insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00'); @@ -390,7 +390,7 @@ create table t1 (a timestamp null default current_timestamp on update current_ti show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `b` timestamp NULL DEFAULT NULL ) ENGINE=TokuDB DEFAULT CHARSET=latin1 insert into t1 values (NULL, NULL); diff --git a/storage/tokudb/mysql-test/tokudb_parts/r/partition_datetime_tokudb.result b/storage/tokudb/mysql-test/tokudb_parts/r/partition_datetime_tokudb.result index a3517e91b0c..58a82b8f684 100644 --- a/storage/tokudb/mysql-test/tokudb_parts/r/partition_datetime_tokudb.result +++ b/storage/tokudb/mysql-test/tokudb_parts/r/partition_datetime_tokudb.result @@ -7,7 +7,7 @@ partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=TokuDB DEFAULT CHARSET=latin1 PARTITION BY KEY (a) @@ -37,7 +37,7 @@ partition by key (a) partitions 12; show create table t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`a`) ) ENGINE=TokuDB DEFAULT CHARSET=latin1 PARTITION BY KEY (a) diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 54ac30861c1..228e3227649 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -7552,7 +7552,7 @@ static void test_explain_bug() verify_prepare_field(result, 5, "Extra", "EXTRA", mysql_get_server_version(mysql) <= 50000 ? MYSQL_TYPE_STRING : MYSQL_TYPE_VAR_STRING, - 0, 0, "information_schema", 27, 0); + 0, 0, "information_schema", 30, 0); mysql_free_result(result); mysql_stmt_close(stmt); |