1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#
# Start of 10.4 tests
#
#
# MDEV-17776 CAST(x AS INTERVAL DAY_SECOND(N))
#
CREATE TABLE t1 (a VARCHAR(128));
INSERT INTO t1 VALUES
('00:00:00'),
('+00:00:01'),
('-00:00:01'),
('838:59:59'),
('839:00:00'),
('2018:01:02'),
('87649415:59:59'),
('3652058 23:59:59'),
('87649416:00:00'),
('3652059 00:00:00');
SELECT
EXTRACT(DAY FROM a) AS d,
EXTRACT(HOUR FROM a) AS h,
a,
CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds
FROM t1;
d h a cast_itds
0 0 00:00:00 00:00:00.000000
0 0 +00:00:01 00:00:01.000000
0 0 -00:00:01 -00:00:01.000000
34 22 838:59:59 34 22:59:59.000000
34 23 839:00:00 34 23:00:00.000000
84 2 2018:01:02 84 02:01:02.000000
3652058 23 87649415:59:59 3652058 23:59:59.000000
3652058 23 3652058 23:59:59 3652058 23:59:59.000000
NULL NULL 87649416:00:00 NULL
NULL NULL 3652059 00:00:00 NULL
Warnings:
Warning 1292 Incorrect interval value: '87649416:00:00'
Warning 1292 Incorrect interval value: '87649416:00:00'
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649416:00:00'
Warning 1292 Incorrect interval value: '3652059 00:00:00'
Warning 1292 Incorrect interval value: '3652059 00:00:00'
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '3652059 00:00:00'
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL(32,9));
INSERT INTO t1 VALUES
(0),
(1),
(-1),
(8385959),
(8390000),
(20180102),
(876494155959),
(876494160000);
SELECT
EXTRACT(DAY FROM a) AS d,
EXTRACT(HOUR FROM a) AS h,
a,
CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds
FROM t1;
d h a cast_itds
0 0 0.000000000 00:00:00.000000
0 0 1.000000000 00:00:01.000000
0 0 -1.000000000 -00:00:01.000000
34 22 8385959.000000000 34 22:59:59.000000
34 23 8390000.000000000 34 23:00:00.000000
84 2 20180102.000000000 84 02:01:02.000000
3652058 23 876494155959.000000000 3652058 23:59:59.000000
NULL NULL 876494160000.000000000 NULL
Warnings:
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.000000000'
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '1.000000000'
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '-1.000000000'
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.000000000'
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8390000.000000000'
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '20180102.000000000'
Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.000000000'
Warning 1292 Incorrect interval value: '876494160000.000000000' for column `test`.`t1`.`a` at row 8
Warning 1292 Incorrect interval value: '876494160000.000000000' for column `test`.`t1`.`a` at row 8
Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494160000.000000000'
DROP TABLE t1;
#
# End of 10.4 tests
#
|