Commit 43f185e1 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-5528 Command line variable to choose MariaDB-5.3 vs MySQL-5.6 temporal data formats

parent a245543b
......@@ -2769,7 +2769,7 @@ id select_type table type possible_keys key key_len ref rows Extra
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition
DROP TABLE t1;
#
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
......
......@@ -3161,7 +3161,7 @@ id select_type table type possible_keys key key_len ref rows Extra
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition
DROP TABLE t1;
#
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
......
......@@ -3445,7 +3445,7 @@ id select_type table type possible_keys key key_len ref rows Extra
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition
DROP TABLE t1;
#
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
......
......@@ -4352,7 +4352,7 @@ id select_type table type possible_keys key key_len ref rows Extra
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition
DROP TABLE t1;
#
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
......
......@@ -5220,7 +5220,7 @@ id select_type table type possible_keys key key_len ref rows Extra
ALTER TABLE t1 MODIFY date_column DATETIME DEFAULT NULL;
EXPLAIN SELECT * FROM t1 WHERE date_column BETWEEN '2010-09-01' AND '2010-10-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range date_column date_column 9 NULL 1 Using index condition
1 SIMPLE t1 range date_column date_column 6 NULL 1 Using index condition
DROP TABLE t1;
#
# Bug #31384 DATE_ADD() and DATE_SUB() return binary data
......
......@@ -925,9 +925,6 @@ set join_buffer_size=1024;
SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
id
7
8
9
18
20
24
......@@ -937,34 +934,37 @@ id
51
61
64
7
71
74
77
78
8
9
93
94
set join_buffer_size=1024*16;
SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
id
7
9
18
20
24
8
43
45
50
51
61
43
45
71
64
7
71
74
77
78
94
8
9
93
94
set join_buffer_size=default;
SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
......
......@@ -271,7 +271,7 @@ select * from t2 where a NOT IN (
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a a 9 NULL 18 Using index condition
1 SIMPLE t2 range a a 6 NULL 12 Using index condition
select * from t2 where a NOT IN (
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
......@@ -701,11 +701,11 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE c_datetime
IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using index condition
1 SIMPLE t1 range c_datetime c_datetime 5 NULL 3 Using index condition
EXPLAIN SELECT * FROM t1 WHERE c_datetime
IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c_datetime c_datetime 8 NULL 3 Using index condition
1 SIMPLE t1 range c_datetime c_datetime 5 NULL 3 Using index condition
EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
......
......@@ -479,6 +479,10 @@ The following options may be given as the first argument:
NULLS_UNEQUAL (default behavior for 4.1 and later),
NULLS_EQUAL (emulate 4.0 behavior), and NULLS_IGNORED
--myisam-use-mmap Use memory mapping for reading and writing MyISAM tables
--mysql56-temporal-format
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
......@@ -1226,6 +1230,7 @@ myisam-repair-threads 1
myisam-sort-buffer-size 134216704
myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE
mysql56-temporal-format TRUE
net-buffer-length 16384
net-read-timeout 30
net-retry-count 10
......
......@@ -104,6 +104,7 @@ DROP TABLE t1;
#
# MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast
#
SET @@global.mysql56_temporal_format=true;
SET @@old_mode=zero_date_time_cast;
CREATE TABLE t1 (a TIME,b TIME(1));
INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30');
......@@ -114,3 +115,15 @@ Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
DROP TABLE t1;
SET @@global.mysql56_temporal_format=false;
SET @@old_mode=zero_date_time_cast;
CREATE TABLE t1 (a TIME,b TIME(1));
INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30');
SELECT TO_DAYS(a), TO_DAYS(b) FROM t1;
TO_DAYS(a) TO_DAYS(b)
NULL NULL
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
DROP TABLE t1;
SET @@global.mysql56_temporal_format=DEFAULT;
This diff is collapsed.
......@@ -300,7 +300,7 @@ t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show table status from test like ''t9%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t9 MyISAM 10 Dynamic 2 216 432 # 2048 0 NULL # # # latin1_swedish_ci NULL
t9 MyISAM 10 Dynamic 2 212 424 # 2048 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show status like ''Threads_running'' ';
execute stmt4;
Variable_name Value
......
......@@ -3698,8 +3698,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......
......@@ -287,7 +287,7 @@ ORDER BY mirror_date ASC
) AS calculated_result;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 range date date 9 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using filesort
2 DERIVED t1 range date date 6 NULL 2 Using index condition; Using where; Rowid-ordered scan; Using filesort
SELECT * FROM (
SELECT node_uid, date, mirror_date, @result := 0 AS result
FROM t1
......@@ -310,7 +310,7 @@ ORDER BY mirror_date ASC
) AS calculated_result;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED t1 range date date 9 NULL 2 Using index condition; Using where; Using filesort
2 DERIVED t1 range date date 6 NULL 2 Using index condition; Using where; Using filesort
SELECT * FROM (
SELECT node_uid, date, mirror_date, @result := 0 AS result
FROM t1
......
......@@ -3701,8 +3701,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......
......@@ -3701,8 +3701,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......
......@@ -3697,8 +3697,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......
......@@ -3704,8 +3704,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......
......@@ -3697,8 +3697,8 @@ WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 system NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
1 PRIMARY t1 index NULL PRIMARY 13 NULL 11 Using where; Using index
2 SUBQUERY t1 range PRIMARY PRIMARY 13 NULL 5 Using where; Using index
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......
......@@ -103,7 +103,7 @@ date numfacture expedition
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref expedition expedition 8 const 1
1 SIMPLE t1 ref expedition expedition 5 const 1
drop table t1;
create table t1 (a datetime not null, b datetime not null);
insert into t1 values (now(), now());
......@@ -745,7 +745,7 @@ SET NAMES CP850;
INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12');
EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ref AtTime AtTime 9 const 1 100.00
1 SIMPLE t1 ref AtTime AtTime 6 const 1 100.00
Warnings:
Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = '2010-02-22 18:40:07')
DROP TABLE t1;
......@@ -773,7 +773,7 @@ f1
t2 should be const
explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 8 const 1 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 5 const 1 Using index
DROP TABLE t1,t2;
#
# Bug#57095: Wrongly chosen expression cache type led to a wrong
......
This diff is collapsed.
......@@ -1625,7 +1625,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=2001-02-03 10:20:30 /* DATETIME meta=0 nullable=1 is_null=0 */
### @1='2001-02-03 10:20:30' /* DATETIME(0) meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
......@@ -1642,7 +1642,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=2001-02-03 10:20:30 /* DATETIME meta=0 nullable=1 is_null=0 */
### @1='2001-02-03 10:20:30' /* DATETIME(0) meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
......@@ -1675,7 +1675,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1=981184830 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @1=981184830 /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
......@@ -1693,7 +1693,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=981184830 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @1=981184830 /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
......@@ -1726,7 +1726,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1`
### SET
### @1='11:22:33' /* TIME meta=0 nullable=1 is_null=0 */
### @1='11:22:33' /* TIME(0) meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
......@@ -1743,7 +1743,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1='11:22:33' /* TIME meta=0 nullable=1 is_null=0 */
### @1='11:22:33' /* TIME(0) meta=0 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
......
......@@ -112,7 +112,7 @@ t1_BLOB DATA_BLOB
t1_CHAR_100 DATA_CHAR
t1_CHAR_100_BINARY DATA_MYSQL
t1_DATE DATA_INT
t1_DATETIME DATA_INT
t1_DATETIME DATA_FIXBINARY
t1_DATETIME_6 DATA_FIXBINARY
t1_DECIMAL_10_3 DATA_FIXBINARY
t1_DECIMAL_10_3_UNSIGNED DATA_FIXBINARY UNSIGNED
......@@ -137,8 +137,8 @@ t1_SET_BINARY DATA_INT UNSIGNED
t1_SMALLINT DATA_INT
t1_SMALLINT_UNSIGNED DATA_INT UNSIGNED
t1_TEXT DATA_BLOB
t1_TIME DATA_INT
t1_TIMESTAMP DATA_INT UNSIGNED
t1_TIME DATA_FIXBINARY
t1_TIMESTAMP DATA_FIXBINARY UNSIGNED
t1_TIMESTAMP_5 DATA_FIXBINARY UNSIGNED
t1_TIME_4 DATA_FIXBINARY
t1_TINYBLOB DATA_BLOB
......
include/master-slave.inc
[connection master]
SELECT @@global.mysql56_temporal_format AS on_master;
on_master
1
SELECT @@global.mysql56_temporal_format AS on_slave;
on_slave
1
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 34 34
t2 1 41 41
t3 1 48 48
SELECT * FROM t1;;
c0 01:01:01
c1 01:01:01.1
c2 01:01:01.11
c3 01:01:01.111
c4 01:01:01.1111
c5 01:01:01.11111
c6 01:01:01.111111
SELECT * FROM t2;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT * FROM t3;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 34 34
t2 1 41 41
t3 1 48 48
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
SET @@global.mysql56_temporal_format=DEFAULT;
SET @@global.mysql56_temporal_format=DEFAULT;
include/rpl_end.inc
include/master-slave.inc
[connection master]
SET @@global.mysql56_temporal_format=false;;
SET @@global.mysql56_temporal_format=false;;
SELECT @@global.mysql56_temporal_format AS on_master;
on_master
0
SELECT @@global.mysql56_temporal_format AS on_slave;
on_slave
0
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 33 33
t2 1 41 41
t3 1 50 50
SELECT * FROM t1;;
c0 01:01:01
c1 01:01:01.1
c2 01:01:01.11
c3 01:01:01.111
c4 01:01:01.1111
c5 01:01:01.11111
c6 01:01:01.111111
SELECT * FROM t2;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT * FROM t3;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 33 33
t2 1 41 41
t3 1 50 50
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
SET @@global.mysql56_temporal_format=DEFAULT;
SET @@global.mysql56_temporal_format=DEFAULT;
include/rpl_end.inc
include/master-slave.inc
[connection master]
SET @@global.mysql56_temporal_format=false;;
SET @@global.mysql56_temporal_format=true;;
SELECT @@global.mysql56_temporal_format AS on_master;
on_master
0
SELECT @@global.mysql56_temporal_format AS on_slave;
on_slave
1
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 33 33
t2 1 41 41
t3 1 50 50
SELECT * FROM t1;;
c0 01:01:01
c1 01:01:01.1
c2 01:01:01.11
c3 01:01:01.111
c4 01:01:01.1111
c5 01:01:01.11111
c6 01:01:01.111111
SELECT * FROM t2;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT * FROM t3;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 34 34
t2 1 41 41
t3 1 48 48
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
SET @@global.mysql56_temporal_format=DEFAULT;
SET @@global.mysql56_temporal_format=DEFAULT;
include/rpl_end.inc
include/master-slave.inc
[connection master]
SET @@global.mysql56_temporal_format=true;;
SET @@global.mysql56_temporal_format=false;;
SELECT @@global.mysql56_temporal_format AS on_master;
on_master
1
SELECT @@global.mysql56_temporal_format AS on_slave;
on_slave
0
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 34 34
t2 1 41 41
t3 1 48 48
SELECT * FROM t1;;
c0 01:01:01
c1 01:01:01.1
c2 01:01:01.11
c3 01:01:01.111
c4 01:01:01.1111
c5 01:01:01.11111
c6 01:01:01.111111
SELECT * FROM t2;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT * FROM t3;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 33 33
t2 1 41 41
t3 1 50 50
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
SET @@global.mysql56_temporal_format=DEFAULT;
SET @@global.mysql56_temporal_format=DEFAULT;
include/rpl_end.inc
include/master-slave.inc
[connection master]
SET @@global.mysql56_temporal_format=true;;
SET @@global.mysql56_temporal_format=true;;
SELECT @@global.mysql56_temporal_format AS on_master;
on_master
1
SELECT @@global.mysql56_temporal_format AS on_slave;
on_slave
1
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 34 34
t2 1 41 41
t3 1 48 48
SELECT * FROM t1;;
c0 01:01:01
c1 01:01:01.1
c2 01:01:01.11
c3 01:01:01.111
c4 01:01:01.1111
c5 01:01:01.11111
c6 01:01:01.111111
SELECT * FROM t2;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT * FROM t3;;
c0 2001-01-01 01:01:01
c1 2001-01-01 01:01:01.1
c2 2001-01-01 01:01:01.11
c3 2001-01-01 01:01:01.111
c4 2001-01-01 01:01:01.1111
c5 2001-01-01 01:01:01.11111
c6 2001-01-01 01:01:01.111111
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
t1 1 34 34
t2 1 41 41
t3 1 48 48
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
SET @@global.mysql56_temporal_format=DEFAULT;
SET @@global.mysql56_temporal_format=DEFAULT;
include/rpl_end.inc
......@@ -20,17 +20,31 @@ mysql050614_temporal1 CREATE TABLE `mysql050614_temporal1` (
`b` datetime(1) DEFAULT NULL,
`c` timestamp(1) NOT NULL DEFAULT CURRENT_TIMESTAMP(1) ON UPDATE CURRENT_TIMESTAMP(1)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @@mysql56_temporal_format;
@@mysql56_temporal_format
1
SET TIME_ZONE='+00:00';
CREATE TABLE mysql050614_temporal0 (a time(0), b datetime(0), c timestamp(0)) engine=myisam;
CREATE TABLE mysql050614_temporal1 (a time(1), b datetime(1), c timestamp(1)) engine=myisam;
INSERT INTO mysql050614_temporal0 VALUES ('00:00:02','2001-01-01 00:00:02','2001-01-01 00:00:02');
INSERT INTO mysql050614_temporal1 VALUES ('00:00:02.1','2001-01-01 00:00:02.2','2001-01-01 00:00:02.3');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'mysql050614_temporal%' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
mysql050614_temporal0 2 13 26
mysql050614_temporal1 1 16 16
SELECT * FROM mysql050614_temporal0;
a b c
00:00:02 2001-01-01 00:00:02 2001-01-01 00:00:02
SELECT * FROM mysql050614_temporal1;
a b c
00:00:02.1 2001-01-01 00:00:02.2 2001-01-01 00:00:02.3
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'mysql050614_temporal%' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
mysql050614_temporal0 1 13 13
mysql050614_temporal1 1 16 16
SET @@global.mysql56_temporal_format=DEFAULT;
DROP TABLE mysql050614_temporal0;
DROP TABLE mysql050614_temporal1;
include/rpl_end.inc
include/master-slave.inc
[connection master]
SET @@global.mysql56_temporal_format=false;;
#
# Testing replication from MariaDB-10.0 master
# started over MySQL-5.6 data directory
# to MariaDB-10.0 slave running with natively created tables
#
SET TIME_ZONE='+00:00';
SHOW CREATE TABLE mysql050614_temporal0;
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
) 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)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT @@mysql56_temporal_format;
@@mysql56_temporal_format
0
SET TIME_ZONE='+00:00';
CREATE TABLE mysql050614_temporal0 (a time(0), b datetime(0), c timestamp(0)) engine=myisam;
CREATE TABLE mysql050614_temporal1 (a time(1), b datetime(1), c timestamp(1)) engine=myisam;
INSERT INTO mysql050614_temporal0 VALUES ('00:00:02','2001-01-01 00:00:02','2001-01-01 00:00:02');
INSERT INTO mysql050614_temporal1 VALUES ('00:00:02.1','2001-01-01 00:00:02.2','2001-01-01 00:00:02.3');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'mysql050614_temporal%' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
mysql050614_temporal0 2 13 26
mysql050614_temporal1 1 16 16
SELECT * FROM mysql050614_temporal0;
a b c
00:00:02 2001-01-01 00:00:02 2001-01-01 00:00:02
SELECT * FROM mysql050614_temporal1;
a b c
00:00:02.1 2001-01-01 00:00:02.2 2001-01-01 00:00:02.3
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'mysql050614_temporal%' ORDER BY TABLE_NAME;
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH
mysql050614_temporal0 1 16 16
mysql050614_temporal1 1 16 16
SET @@global.mysql56_temporal_format=DEFAULT;
DROP TABLE mysql050614_temporal0;
DROP TABLE mysql050614_temporal1;
include/rpl_end.inc
--source include/master-slave.inc
if ($force_master_mysql56_temporal_format)
{
connection master;
eval SET @@global.mysql56_temporal_format=$force_master_mysql56_temporal_format;
}
if ($force_slave_mysql56_temporal_format)
{
connection slave;
eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format;
}
connection master;
SELECT @@global.mysql56_temporal_format AS on_master;
connection slave;
SELECT @@global.mysql56_temporal_format AS on_slave;
connection master;
CREATE TABLE t1
(
c0 TIME(0),
c1 TIME(1),
c2 TIME(2),
c3 TIME(3),
c4 TIME(4),
c5 TIME(5),
c6 TIME(6)
);
CREATE TABLE t2
(
c0 TIMESTAMP(0),
c1 TIMESTAMP(1),
c2 TIMESTAMP(2),
c3 TIMESTAMP(3),
c4 TIMESTAMP(4),
c5 TIMESTAMP(5),
c6 TIMESTAMP(6)
);
CREATE TABLE t3
(
c0 DATETIME(0),
c1 DATETIME(1),
c2 DATETIME(2),
c3 DATETIME(3),
c4 DATETIME(4),
c5 DATETIME(5),
c6 DATETIME(6)
);
INSERT INTO t1 VALUES ('01:01:01','01:01:01.1','01:01:01.11','01:01:01.111','01:01:01.1111','01:01:01.11111','01:01:01.111111');
INSERT INTO t2 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
INSERT INTO t3 VALUES ('2001-01-01 01:01:01','2001-01-01 01:01:01.1','2001-01-01 01:01:01.11','2001-01-01 01:01:01.111','2001-01-01 01:01:01.1111','2001-01-01 01:01:01.11111','2001-01-01 01:01:01.111111');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
sync_slave_with_master;
connection slave;
--query_vertical SELECT * FROM t1;
--query_vertical SELECT * FROM t2;
--query_vertical SELECT * FROM t3;
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME RLIKE 't[1-3]' ORDER BY TABLE_NAME;
connection master;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
connection slave;
SET @@global.mysql56_temporal_format=DEFAULT;
connection master;
SET @@global.mysql56_temporal_format=DEFAULT;
--source include/rpl_end.inc
--let $force_master_mysql56_temporal_format=false;
--let $force_slave_mysql56_temporal_format=false;
--source rpl_temporal_format_default_to_default.test
#
# MariaDB-5.3 fractional temporal types do not store metadata
# when running with --binlog-format=row, thus can replicate
# only into a field with exactly the same data type and format.
#
# Skip when running with --binlog-format=row.
# But mixed and statement formats should work without problems.
#
-- source include/have_binlog_format_mixed_or_statement.inc
--let $force_master_mysql56_temporal_format=false;
--let $force_slave_mysql56_temporal_format=true;
--source rpl_temporal_format_default_to_default.test
--let $force_master_mysql56_temporal_format=true;
--let $force_slave_mysql56_temporal_format=false;
--source rpl_temporal_format_default_to_default.test
--let $force_master_mysql56_temporal_format=true;
--let $force_slave_mysql56_temporal_format=true;
--source rpl_temporal_format_default_to_default.test
--source include/master-slave.inc
if ($force_slave_mysql56_temporal_format)
{
connection slave;
eval SET @@global.mysql56_temporal_format=$force_slave_mysql56_temporal_format;
connection master;
}
--echo #
--echo # Testing replication from MariaDB-10.0 master
......@@ -22,6 +29,7 @@ SHOW CREATE TABLE mysql050614_temporal0;
SHOW CREATE TABLE mysql050614_temporal1;
connection slave;
SELECT @@mysql56_temporal_format;
SET TIME_ZONE='+00:00';
CREATE TABLE mysql050614_temporal0 (a time(0), b datetime(0), c timestamp(0)) engine=myisam;
CREATE TABLE mysql050614_temporal1 (a time(1), b datetime(1), c timestamp(1)) engine=myisam;
......@@ -29,11 +37,16 @@ CREATE TABLE mysql050614_temporal1 (a time(1), b datetime(1), c timestamp(1)) en
connection master;
INSERT INTO mysql050614_temporal0 VALUES ('00:00:02','2001-01-01 00:00:02','2001-01-01 00:00:02');
INSERT INTO mysql050614_temporal1 VALUES ('00:00:02.1','2001-01-01 00:00:02.2','2001-01-01 00:00:02.3');
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'mysql050614_temporal%' ORDER BY TABLE_NAME;
sync_slave_with_master;
connection slave;
SELECT * FROM mysql050614_temporal0;
SELECT * FROM mysql050614_temporal1;
SELECT TABLE_NAME, TABLE_ROWS, AVG_ROW_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE 'mysql050614_temporal%' ORDER BY TABLE_NAME;
SET @@global.mysql56_temporal_format=DEFAULT;
connection master;
DROP TABLE mysql050614_temporal0;
......
--let $force_slave_mysql56_temporal_format=false;
--source rpl_temporal_mysql56_to_mariadb.test
SET @start_value = @@global.mysql56_temporal_format;
SELECT @start_value;
@start_value
1
'#--------------------FN_DYNVARS_030_01------------------------#'
SET @@global.mysql56_temporal_format = ON;
SET @@global.mysql56_temporal_format = DEFAULT;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
1
'#---------------------FN_DYNVARS_030_02-------------------------#'
SET @@global.mysql56_temporal_format = @start_value;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
1
'#--------------------FN_DYNVARS_030_03------------------------#'
SET @@global.mysql56_temporal_format = ON;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
1
SET @@global.mysql56_temporal_format = OFF;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
0
SET @@global.mysql56_temporal_format = 0;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
0
SET @@global.mysql56_temporal_format = 1;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
1
'#--------------------FN_DYNVARS_030_04-------------------------#'
SET @@global.mysql56_temporal_format = 2;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of '2'
SET @@global.mysql56_temporal_format = -1;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of '-1'
SET @@global.mysql56_temporal_format = TRUEF;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of 'TRUEF'
SET @@global.mysql56_temporal_format = TRUE_F;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of 'TRUE_F'
SET @@global.mysql56_temporal_format = FALSE0;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of 'FALSE0'
SET @@global.mysql56_temporal_format = OON;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of 'OON'
SET @@global.mysql56_temporal_format = ONN;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of 'ONN'
SET @@global.mysql56_temporal_format = OOFF;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of 'OOFF'
SET @@global.mysql56_temporal_format = 0FF;
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of '0FF'
SET @@global.mysql56_temporal_format = ' ';
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of ' '
SET @@global.mysql56_temporal_format = " ";
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of ' '
SET @@global.mysql56_temporal_format = '';
ERROR 42000: Variable 'mysql56_temporal_format' can't be set to the value of ''
'#-------------------FN_DYNVARS_030_05----------------------------#'
SET @@session.mysql56_temporal_format = 1;
ERROR HY000: Variable 'mysql56_temporal_format' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@session.mysql56_temporal_format;
ERROR HY000: Variable 'mysql56_temporal_format' is a GLOBAL variable
'#----------------------FN_DYNVARS_030_06------------------------#'
SELECT IF(@@global.mysql56_temporal_format, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='mysql56_temporal_format';
IF(@@global.mysql56_temporal_format, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_030_07----------------------#'
SET @@global.mysql56_temporal_format = TRUE;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
1
SET @@global.mysql56_temporal_format = FALSE;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
0
'#---------------------FN_DYNVARS_030_08----------------------#'
SET @@global.mysql56_temporal_format = 1;
SELECT @@mysql56_temporal_format = @@global.mysql56_temporal_format;
@@mysql56_temporal_format = @@global.mysql56_temporal_format
1
'#---------------------FN_DYNVARS_030_09----------------------#'
SET mysql56_temporal_format = 1;
ERROR HY000: Variable 'mysql56_temporal_format' is a GLOBAL variable and should be set with SET GLOBAL
SET global.mysql56_temporal_format = 1;
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 'mysql56_temporal_format = 1' at line 1
SELECT global.mysql56_temporal_format;
ERROR 42S02: Unknown table 'global' in field list
SELECT mysql56_temporal_format = @@session.mysql56_temporal_format;
ERROR 42S22: Unknown column 'mysql56_temporal_format' in 'field list'
SET @@global.mysql56_temporal_format = @start_value;
SELECT @@global.mysql56_temporal_format;
@@global.mysql56_temporal_format
1
#
# MariaDB-5.3 format
#
SET @@global.mysql56_temporal_format=false;
CREATE TABLE t1 (a DATETIME NOT NULL, b DATETIME NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10','2001-01-01 10:10:10');
SELECT * FROM t1;
a b
2001-01-01 10:10:10 2001-01-01 10:10:10
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
FIELD_LENGTH DATA_LENGTH
8 17
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(5) NOT NULL, b DATETIME(5) NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10.12345','2001-01-01 10:10:10.12345');
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
FIELD_LENGTH DATA_LENGTH
7 15
SELECT * FROM t1;
a b
2001-01-01 10:10:10.12345 2001-01-01 10:10:10.12345
DROP TABLE t1;
CREATE TABLE t1 (a TIME(5) NOT NULL,b TIME(5) NOT NULL);
INSERT INTO t1 VALUES ('10:10:10.12345','10:10:10.12345');
SELECT * FROM t1;
a b
10:10:10.12345 10:10:10.12345
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
FIELD_LENGTH DATA_LENGTH
5 11
DROP TABLE t1;
#
# MySQL-5.6 format
#
SET @@global.mysql56_temporal_format=true;
CREATE TABLE t1 (a DATETIME NOT NULL, b DATETIME NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10','2001-01-01 10:10:10');
SELECT * FROM t1;
a b
2001-01-01 10:10:10 2001-01-01 10:10:10
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
FIELD_LENGTH DATA_LENGTH
5 11
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(5) NOT NULL, b DATETIME(5) NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10.12345','2001-01-01 10:10:10.12345');
SELECT * FROM t1;
a b
2001-01-01 10:10:10.12345 2001-01-01 10:10:10.12345
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
FIELD_LENGTH DATA_LENGTH
8 17
DROP TABLE t1;
CREATE TABLE t1 (a TIME(5) NOT NULL,b TIME(5) NOT NULL);
INSERT INTO t1 VALUES ('10:10:10.12345','10:10:10.12345');
SELECT * FROM t1;
a b
10:10:10.12345 10:10:10.12345
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
FIELD_LENGTH DATA_LENGTH
6 13
DROP TABLE t1;
SET @@global.mysql56_temporal_format=DEFAULT;
......@@ -2317,6 +2317,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME MYSQL56_TEMPORAL_FORMAT
SESSION_VALUE NULL
GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns.
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME NET_BUFFER_LENGTH
SESSION_VALUE 16384
GLOBAL_VALUE 16384
......
############## mysql-test\t\mysql56_temporal_format_basic.test ################
# #
# Variable Name: mysql56_temporal_format #
# Scope: GLOBAL #
# Access Type: Dynamic #
# Data Type: boolean #
# Default Value: OFF #
# Range: #
# #
# Creation Date: 2014-08-27 #
# #
# Description: Test Cases of Dynamic System Variable mysql56_temporal_format #
# that checks the behavior of this variable in the following ways#
# * Default Value #
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# #
###############################################################################
--source include/load_sysvars.inc
########################################################################
# START OF mysql56_temporal_format TESTS #
########################################################################
###########################################################################
# Saving initial value of mysql56_temporal_format in a temporary variable #
###########################################################################
SET @start_value = @@global.mysql56_temporal_format;
SELECT @start_value;
--echo '#--------------------FN_DYNVARS_030_01------------------------#'
#############################################################
# Display the DEFAULT value of mysql56_temporal_format #
#############################################################
SET @@global.mysql56_temporal_format = ON;
SET @@global.mysql56_temporal_format = DEFAULT;
SELECT @@global.mysql56_temporal_format;
--echo '#---------------------FN_DYNVARS_030_02-------------------------#'
###############################################
# Verify default value of variable #
###############################################
SET @@global.mysql56_temporal_format = @start_value;
SELECT @@global.mysql56_temporal_format;
--echo '#--------------------FN_DYNVARS_030_03------------------------#'
################################################################
# Change the value of mysql56_temporal_format to a valid value #
################################################################
SET @@global.mysql56_temporal_format = ON;
SELECT @@global.mysql56_temporal_format;
SET @@global.mysql56_temporal_format = OFF;
SELECT @@global.mysql56_temporal_format;
SET @@global.mysql56_temporal_format = 0;
SELECT @@global.mysql56_temporal_format;
SET @@global.mysql56_temporal_format = 1;
SELECT @@global.mysql56_temporal_format;
--echo '#--------------------FN_DYNVARS_030_04-------------------------#'
###########################################################################
# Change the value of mysql56_temporal_format to invalid value #
###########################################################################
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = 2;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = -1;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = TRUEF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = TRUE_F;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = FALSE0;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = OON;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = ONN;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = OOFF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = 0FF;
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = ' ';
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = " ";
--Error ER_WRONG_VALUE_FOR_VAR
SET @@global.mysql56_temporal_format = '';
--echo '#-------------------FN_DYNVARS_030_05----------------------------#'
###########################################################################
# Test if accessing session mysql56_temporal_format gives error #
###########################################################################
--Error ER_GLOBAL_VARIABLE
SET @@session.mysql56_temporal_format = 1;
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.mysql56_temporal_format;
--echo '#----------------------FN_DYNVARS_030_06------------------------#'
####################################################################
# Check if the value in GLOBAL Tables matches values in variable #
####################################################################
SELECT IF(@@global.mysql56_temporal_format, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='mysql56_temporal_format';
--echo '#---------------------FN_DYNVARS_030_07----------------------#'
###################################################################
# Check if TRUE and FALSE values can be used on variable #
###################################################################
SET @@global.mysql56_temporal_format = TRUE;
SELECT @@global.mysql56_temporal_format;
SET @@global.mysql56_temporal_format = FALSE;
SELECT @@global.mysql56_temporal_format;
--echo '#---------------------FN_DYNVARS_030_08----------------------#'
###############################################################################
# Check if accessing variable without SCOPE points to same global variable #
###############################################################################
SET @@global.mysql56_temporal_format = 1;
SELECT @@mysql56_temporal_format = @@global.mysql56_temporal_format;
--echo '#---------------------FN_DYNVARS_030_09----------------------#'
#############################################################################
# Check if mysql56_temporal_format can be accessed with and without @@ sign #
#############################################################################
--Error ER_GLOBAL_VARIABLE
SET mysql56_temporal_format = 1;
--Error ER_PARSE_ERROR
SET global.mysql56_temporal_format = 1;
--Error ER_UNKNOWN_TABLE
SELECT global.mysql56_temporal_format;
--Error ER_BAD_FIELD_ERROR
SELECT mysql56_temporal_format = @@session.mysql56_temporal_format;
##############################
# Restore initial value #
##############################
SET @@global.mysql56_temporal_format = @start_value;
SELECT @@global.mysql56_temporal_format;
#############################################################
# END OF mysql56_temporal_format TESTS #
#############################################################
#
# This test checks that DATETIME, DATETIME(5), TIME(5) columns
# occupy different data length depending on @@mysql56_temporal_format:
#
# Type MariaDB MySQL
# ---- ------- -----
# DATETIME 8 5
# DATETIME(5) 7 8
# TIME(5) 5 6
#
# The DATETIME(1-3,4,6) and TIME(0-4,6) data types use the same size
# in both MariaDB and MySQL formats.
# TIMESTAMP(0-6) also uses the same size in both formats.
#
# We use two columns in the tests below, to make sure the record length
# is longer than 7. Records whose fields occupy less then 7 bytes use
# 7 bytes anyway (assuming the default MAX_ROWS values), to store deleted
# record list pointers.
#
--echo #
--echo # MariaDB-5.3 format
--echo #
SET @@global.mysql56_temporal_format=false;
CREATE TABLE t1 (a DATETIME NOT NULL, b DATETIME NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10','2001-01-01 10:10:10');
SELECT * FROM t1;
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(5) NOT NULL, b DATETIME(5) NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10.12345','2001-01-01 10:10:10.12345');
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a TIME(5) NOT NULL,b TIME(5) NOT NULL);
INSERT INTO t1 VALUES ('10:10:10.12345','10:10:10.12345');
SELECT * FROM t1;
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
--echo #
--echo # MySQL-5.6 format
--echo #
SET @@global.mysql56_temporal_format=true;
CREATE TABLE t1 (a DATETIME NOT NULL, b DATETIME NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10','2001-01-01 10:10:10');
SELECT * FROM t1;
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
CREATE TABLE t1 (a DATETIME(5) NOT NULL, b DATETIME(5) NOT NULL);
INSERT INTO t1 VALUES ('2001-01-01 10:10:10.12345','2001-01-01 10:10:10.12345');
SELECT * FROM t1;
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
CREATE TABLE t1 (a TIME(5) NOT NULL,b TIME(5) NOT NULL);
INSERT INTO t1 VALUES ('10:10:10.12345','10:10:10.12345');
SELECT * FROM t1;
SELECT (AVG_ROW_LENGTH-1) DIV 2 AS FIELD_LENGTH,DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
SET @@global.mysql56_temporal_format=DEFAULT;
......@@ -727,10 +727,12 @@ SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
set join_buffer_size=1024;
--sorted_result
SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
set join_buffer_size=1024*16;
--sorted_result
SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
......
......@@ -68,8 +68,17 @@ DROP TABLE t1;
--echo #
--echo # MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast
--echo #
SET @@global.mysql56_temporal_format=true;
SET @@old_mode=zero_date_time_cast;
CREATE TABLE t1 (a TIME,b TIME(1));
INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30');
SELECT TO_DAYS(a), TO_DAYS(b) FROM t1;
DROP TABLE t1;
SET @@global.mysql56_temporal_format=false;
SET @@old_mode=zero_date_time_cast;
CREATE TABLE t1 (a TIME,b TIME(1));
INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30');
SELECT TO_DAYS(a), TO_DAYS(b) FROM t1;
DROP TABLE t1;
SET @@global.mysql56_temporal_format=DEFAULT;
......@@ -656,6 +656,11 @@ set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
prepare stmt from @str;
execute stmt;
set @str="alter table mysql.innodb_table_stats modify last_update timestamp not null default current_timestamp on update current_timestamp";
set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
prepare stmt from @str;
execute stmt;
set @str=replace(@str, "innodb_index_stats", "innodb_table_stats");
prepare stmt from @str;
execute stmt;
......
......@@ -5042,7 +5042,8 @@ int Field_timestamp_with_dec::set_time()
{
THD *thd= get_thd();
set_notnull();
store_TIME(thd->query_start(), thd->query_start_sec_part());
// Avoid writing microseconds into binlog for FSP=0
store_TIME(thd->query_start(), decimals() ? thd->query_start_sec_part() : 0);
return 0;
}
......
......@@ -1528,6 +1528,7 @@ Item_splocal::Item_splocal(const LEX_STRING &sp_var_name,
{
maybe_null= TRUE;
sp_var_type= real_type_to_type(sp_var_type);
m_type= sp_map_item_type(sp_var_type);
m_field_type= sp_var_type;
m_result_type= sp_map_result_type(sp_var_type);
......
......@@ -432,6 +432,7 @@ my_bool opt_safe_user_create = 0;
my_bool opt_show_slave_auth_info;
my_bool opt_log_slave_updates= 0;
my_bool opt_replicate_annotate_row_events= 0;
my_bool opt_mysql56_temporal_format= 0;
char *opt_slave_skip_errors;
/*
......
......@@ -742,6 +742,7 @@ extern my_bool opt_master_verify_checksum;
extern my_bool opt_stack_trace;
extern my_bool opt_expect_abort;
extern my_bool opt_slave_sql_verify_checksum;
extern my_bool opt_mysql56_temporal_format;
extern ulong binlog_checksum_options;
extern bool max_user_connections_checking;
extern ulong opt_binlog_dbug_fsync_sleep;
......
......@@ -6196,22 +6196,26 @@ type:
| DATE_SYM
{ $$=MYSQL_TYPE_DATE; }
| TIME_SYM opt_field_length
{ $$=MYSQL_TYPE_TIME; }
{ $$= opt_mysql56_temporal_format ?
MYSQL_TYPE_TIME2 : MYSQL_TYPE_TIME; }
| TIMESTAMP opt_field_length
{
if (thd->variables.sql_mode & MODE_MAXDB)
$$=MYSQL_TYPE_DATETIME;
$$= opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME;
else
{
/*
Unlike other types TIMESTAMP fields are NOT NULL by default.
*/
Lex->type|= NOT_NULL_FLAG;
$$=MYSQL_TYPE_TIMESTAMP;
$$= opt_mysql56_temporal_format ?
MYSQL_TYPE_TIMESTAMP2 : MYSQL_TYPE_TIMESTAMP;
}
}
| DATETIME opt_field_length
{ $$=MYSQL_TYPE_DATETIME; }
{ $$= opt_mysql56_temporal_format ?
MYSQL_TYPE_DATETIME2 : MYSQL_TYPE_DATETIME; }
| TINYBLOB
{
Lex->charset=&my_charset_bin;
......
......@@ -5071,3 +5071,8 @@ static Sys_var_mybool Sys_pseudo_slave_mode(
SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode));
static Sys_var_mybool Sys_mysql56_temporal_format(
"mysql56_temporal_format",
"Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns.",
GLOBAL_VAR(opt_mysql56_temporal_format),
CMD_LINE(OPT_ARG), DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG);
......@@ -194,7 +194,7 @@ dict_stats_persistent_storage_check(
{"table_name", DATA_VARMYSQL,
DATA_NOT_NULL, 192},
{"last_update", DATA_INT,
{"last_update", DATA_FIXBINARY,
DATA_NOT_NULL, 4},
{"n_rows", DATA_INT,
......@@ -225,7 +225,7 @@ dict_stats_persistent_storage_check(
{"index_name", DATA_VARMYSQL,
DATA_NOT_NULL, 192},
{"last_update", DATA_INT,
{"last_update", DATA_FIXBINARY,
DATA_NOT_NULL, 4},
{"stat_name", DATA_VARMYSQL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment